| name | review-hooks |
| description | Audit the Claude Code hook configuration (or equivalent enforcement layer) for completeness, correctness, handler type appropriateness, and performance risks. Use when someone asks to "review hooks", "audit the enforcement layer", "check hook config", "are my hooks set up correctly?", or "is my settings.json right?". Also triggers on: editing .claude/settings.json, adding a new hook script, or asking whether a hook should use command vs prompt vs agent type.
|
Hook Configuration Auditor
Evaluate the enforcement layer for completeness, correctness, and handler type fit.
Catch configuration mistakes before they cause silent failures or agent loops.
Inputs
Read in order:
.claude/settings.json โ the hook wiring
- All scripts in
.claude/hooks/ โ the hook implementations
CLAUDE.md โ to cross-reference rules that should be enforced
The Four-Layer Check
Every project's enforcement layer should cover all four lifecycle layers:
| Layer | Event | Purpose | Blocking? |
|---|
| Context | SessionStart | Inject current project state | No |
| Prevention | PreToolUse | Block hard-to-undo violations | Yes |
| Correction | PostToolUse | Lint/format/typecheck per file edit | Soft |
| Completion gate | Stop | Full test suite must pass | Yes |
Flag any missing layer. A project with no Stop hook has no completion gate โ
the agent can declare "done" while tests are failing.
Per-Hook Checks
SessionStart
PreToolUse
PostToolUse
Stop
Handler Type Appropriateness
For each hook, evaluate whether the handler type matches the check complexity:
| Check type | Correct handler | Wrong handler |
|---|
| Run linter, check exit code | command (shell) | prompt or agent |
| Block specific string pattern | command (shell) | prompt or agent |
| "Does this look like a production command?" | prompt | command |
| "Do tests exist for this module?" | agent | command or prompt |
| Org-wide policy, audit log | http | command |
Flag any hook using a more complex handler than needed (adds latency) or
a simpler handler than needed (produces unreliable results).
Performance Audit
Synchronous hooks add latency to every agent action. Estimate:
- SessionStart: acceptable up to ~3 seconds (fires once)
- PreToolUse: must be <1 second (fires before every tool call)
- PostToolUse: should be <5 seconds (fires after every file edit)
- Stop: acceptable up to ~60 seconds (fires at task completion)
Flag any hook that runs full test suite in PreToolUse or PostToolUse โ that
belongs in Stop only.
Flag any hook that makes network calls in PreToolUse without a fast timeout.
Security Check
Output Format
HOOK CONFIGURATION AUDIT REPORT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Config: .claude/settings.json
Audited: [date]
FOUR-LAYER COVERAGE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Context layer โ SessionStart: [script name]
โ Prevention layer โ PreToolUse: [script name]
โ Correction layer โ PostToolUse: [script name]
โ Completion gate โ Stop: MISSING
PER-HOOK FINDINGS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SessionStart ([script]):
โ Injects context
โ Non-blocking
โ Output format โ using raw stdout, should use additionalContext JSON
PreToolUse ([script]):
โ Covers Bash and file-write tools
โ Using deprecated top-level `decision` field โ use hookSpecificOutput
โ Deny reasons are actionable
...
PostToolUse ([script]):
...
Stop ([script]):
โ stop_hook_active guard MISSING โ infinite loop risk
โ Exits 2 on test failure
...
HANDLER TYPE ASSESSMENT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[For each hook: current type โ assessment]
PostToolUse: command โ โ correct for deterministic lint check
PreToolUse: command โ โ correct for pattern-match guards
PERFORMANCE ASSESSMENT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SessionStart: ~Xs estimated [OK / SLOW]
PreToolUse: ~Xs estimated [OK / SLOW]
PostToolUse: ~Xs estimated [OK / SLOW]
Stop: ~Xs estimated [OK / acceptable]
SECURITY FINDINGS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[Findings or "No issues found"]
CRITICAL ISSUES (fix before using hooks)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[Issues that will cause silent failures, infinite loops, or security problems]
RECOMMENDATIONS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[Non-critical improvements, ordered by impact]
VERDICT: PASS โ / NEEDS ATTENTION โ / FAIL โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Critical Failure Patterns
These will cause real problems โ always flag as CRITICAL:
- Missing
stop_hook_active guard โ causes infinite loop when tests fail
- Stop hook exits 1 instead of 2 โ non-blocking, agent stops anyway, gate is ineffective
- PreToolUse using deprecated
decision field โ may silently fail in newer versions
- PostToolUse running full test suite โ extreme latency on every file save
- Missing Stop hook entirely โ no completion gate, agent can finish with failing tests