Claude Code Hooks Reference
Anthropic's official hooks documentation — the authoritative reference for hook events, JSON input/output schemas, matchers, exit-code semantics, and security considerations.
How to Install Hooks
- Copy the hook configuration using the button below
- Add to your .claude/hooks/ directory in your project
- Save the hook as an executable script with appropriate permissions
- The hook will trigger on the specified events in your Claude Code workflows
The official reference documentation for Claude Code hooks. It specifies every lifecycle event (PreToolUse, PostToolUse, UserPromptSubmit, Notification, Stop, SubagentStop, PreCompact, SessionStart), the JSON schema each receives on stdin, how exit codes and JSON output control Claude's behavior (allow, deny, feedback), and how matchers target specific tools.
Read this before writing your first hook — most hook bugs come from guessing at the input schema or exit-code semantics that this page defines precisely.Categories:
Ad