Tech News
← Back to articles

Claude Code now supports Hooks

read original related products more articles

Customize and extend Claude Code’s behavior by registering shell commands

Claude Code hooks are user-defined shell commands that execute at various points in Claude Code’s lifecycle. Hooks provide deterministic control over Claude Code’s behavior, ensuring certain actions always happen rather than relying on the LLM to choose to run them.

Example use cases include:

Notifications : Customize how you get notified when Claude Code is awaiting your input or permission to run something.

: Customize how you get notified when Claude Code is awaiting your input or permission to run something. Automatic formatting : Run prettier on .ts files, gofmt on .go files, etc. after every file edit.

: Run on .ts files, on .go files, etc. after every file edit. Logging : Track and count all executed commands for compliance or debugging.

: Track and count all executed commands for compliance or debugging. Feedback : Provide automated feedback when Claude Code produces code that does not follow your codebase conventions.

: Provide automated feedback when Claude Code produces code that does not follow your codebase conventions. Custom permissions: Block modifications to production files or sensitive directories.

By encoding these rules as hooks rather than prompting instructions, you turn suggestions into app-level code that executes every time it is expected to run.

Hooks execute shell commands with your full user permissions without confirmation. You are responsible for ensuring your hooks are safe and secure. Anthropic is not liable for any data loss or system damage resulting from hook usage. Review Security Considerations.

... continue reading