Claude Code hooks allow developers to customize and extend Claude's behavior by registering shell commands that execute at specific points in the lifecycle. These hooks provide deterministic control for tasks like automatic code formatting, logging, notifications, and custom permissions. The system supports various hook events (PreToolUse, PostToolUse, Notification, Stop) with configurable matchers and JSON-based input/output. Hooks can integrate with MCP tools and offer both simple exit code and advanced JSON output formats for sophisticated control flow.

8m read timeFrom docs.anthropic.com
Post cover image
Table of contents
​ Quickstart​ Configuration​ Hook Events​ Hook Input​ Hook Output​ Working with MCP Tools​ Examples​ Security Considerations​ Hook Execution Details​ Debugging
1 Comment

Sort: