Hooks System
Shell hooks that execute in response to Claude Code events like tool calls, file changes, and task completion.
Tagline
Automate everything.
Value Proposition
Hooks make development faster and more consistent
Who Uses This
Overview
Hooks are shell scripts that execute automatically in response to Claude Code events. Use them to automate formatting, testing, type generation, and more.
Hook Types
Tool Call Hooks
Execute when specific Claude Code tools are called.
File Write Hooks
Execute when files are written.
Task Hooks
Execute on task events.
Available Hooks
bash- After bash commandread- After reading filewrite- After writing fileedit- After editing fileglob- After globbing filesgrep- After greppingtodo- Load current cycle contextdone- Mark cycle completesubmit- When user submits prompterror- When operation fails
Configuration
Hooks are discovered in .claude/hooks/ directory. Name files after the event.
Make executable with chmod +x .claude/hooks/*
Ontology Alignment
How this feature maps to the 6-dimension ontology
Hooks are automation things
Hooks execute on events like tool_called, file_written
Capabilities
Tool Call Hooks
Execute code when specific tools are called
File Change Hooks
Trigger on file write/edit events
Task Hooks
Execute on task completion, error, etc.
Environment Variables
Access context via env vars
Hook Chaining
Hooks can trigger other hooks
Use Cases
Format code when files are edited
Execute tests before committing code
Auto-generate TypeScript types from schema
Technical Specifications
moderate
24h
Quality Metrics
88%
99/100
Lessons from Ants at Work
