| name | custom-hooks |
| version | 1.0.0 |
| description | Create project-specific hook scripts and register them in settings.json. Extends the framework's enforcement layer. |
| trigger | manual |
| depends-on | [] |
| references | [] |
| disable-model-invocation | true |
| user-invocable | true |
| allowed-tools | Read, Glob, Grep, Bash, Edit, Write |
| argument-hint | <hook-event> "<description>" |
custom-hooks
Creating a custom hook: $ARGUMENTS
Supported Hook Events
Present available Claude Code hook events:
| Event | When It Fires | Can Block? | Input Fields |
|---|
SessionStart | Once at session start | No | session data |
PreToolUse | Before any tool call | Yes (exit 2) | tool_name, tool_input |
PostToolUse | After any tool call | No | tool_name, tool_input, tool_output |
Stop | When model wants to stop | Yes (exit 2) | last_assistant_message |
UserPromptSubmit | When user submits prompt | No | user_prompt |
SubagentStop | When a subagent completes | No | last_assistant_message |
WorktreeCreate | When a worktree is created | No | — |
WorktreeRemove | When a worktree is removed | No | — |
Matchers (for PreToolUse and PostToolUse): Filter by tool name — Bash, Edit, Write, Read, Glob, Grep, or combinations with | (e.g., Edit|Write).
1. Understand Requirements
Parse $ARGUMENTS to determine:
- Event type: Which hook event to listen to
- Purpose: What the hook should do
- Blocking vs Advisory: Should it block (exit 2) or just warn (exit 0)?
If unclear, ask:
- "Should this hook block the action or just warn?"
- "Should it fire on specific tools only, or all tools?"
- "Should it run on subagents too?"
2. Generate Hook Script