writing-hooks
Installation
SKILL.md
Writing Hooks
Scope: covers hooks.json authoring and hook script design. For plugin architecture, see [[writing-plugins]]. For rules (which are simpler but static), see [[writing-rules]].
1. Three Hook Types
| Type | What it does | When to use | Complexity |
|---|---|---|---|
command |
Runs a shell script, reads JSON from stdin | Deterministic checks: file existence, JSON validation, regex matching | Medium |
prompt |
Injects text into Claude's context | Advisory: reminders, context injection, style guidance | Low |
agent |
Spawns a verification agent | Complex verification: code quality, semantic analysis, multi-file checks | High |