Hooks
Automatic actions before or after tool usage
What is a Hook?
A hook is a shell command automatically executed before (PreToolUse) or after (PostToolUse) Claude uses a tool.
┌────────────────────────────────────────────────────────────────┐
│ │
│ Claude wants to use the "Edit" tool │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────┐ │
│ │ PreToolUse Hook │ │
│ │ │ │
│ │ Matcher: "Edit|Write" │ │
│ │ Command: scripts/validate.sh protect │ │