← ClaudeAtlas

creating-hookslisted

Creates Claude Code hooks for automation and workflow customization. Guides through hook events, configuration, and script creation. Use when user wants to create a hook, automate Claude Code, or asks about hook events.
aiskillstore/marketplace · ★ 329 · AI & Automation · score 79
Install: claude install-skill aiskillstore/marketplace
# Creating Hooks Guides creation of Claude Code hooks for automation and workflow customization. ## Quick Start 1. Choose hook event (when should it trigger?) 2. Configure in settings.json 3. Create hook script 4. Test the hook ## Workflow: Create New Hook ``` Progress: - [ ] Select hook event - [ ] Add to settings.json - [ ] Create hook script - [ ] Test and validate ``` ### Step 1: Select Hook Event | Event | When It Triggers | Common Use | |-------|------------------|------------| | `PreToolUse` | Before tool runs | Block/modify tools | | `PostToolUse` | After tool succeeds | Validate, log, feedback | | `UserPromptSubmit` | User sends message | Inject context, validate | | `SessionStart` | Session begins | Load context, init state | | `SessionEnd` | Session ends | Cleanup, save state | | `Stop` | Agent finishes | Decide if should continue | Full event reference: [reference.md](reference.md) ### Step 2: Configure settings.json Location priority (highest wins): 1. `.claude/settings.local.json` (local, not committed) 2. `.claude/settings.json` (project) 3. `~/.claude/settings.json` (user) Basic structure: ```json { "hooks": { "EventName": [ { "matcher": "ToolPattern", "hooks": [ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/my-hook.sh\"" } ] } ] } } ``` ### Step 3: Create Hook Script Use templates from [templates/](templates/) directory. Key re