Claude Code Hooks
Shell commands that run automatically on every Claude Code event (over thirty documented events, including SessionStart, PostToolUse, SubagentStart and Stop). Configured in settings.json. Examples you can write yourself: a formatter run after each Edit, a guard checking naming conventions after each write, an alert when the context nears its limit.
Strengths
- Transparent automation, activates every session without manual reminder
- Configurable business guardrails: type validation, format, secrets, coverage
- Granular events: pre-tool, post-tool, prompt submit, stop
Limitations
- Risk surface: a badly written hook can block the entire session or execute unwanted code
- Non-trivial debugging, hook errors display in sometimes hard-to-read format
Best for
- Teams wanting to enforce conventions without thinking about it every prompt
- Power users wanting to automate validation, format and context alerts
- Anyone running several sessions in parallel who wants them on a single screen: a few lines in settings.json send each event (a subagent starting, a tool call, the end of a turn) to a local dashboard, such as the open source repository claude-code-hooks-multi-agent-observability