
Debug Hooks
Debug hook failures in Claude Code with systematic diagnostics
What You Can Do
You can systematically diagnose why hooks aren't firing, producing incorrect output, or behaving unexpectedly. This skill guides you through verification steps—checking hook registration, confirming file existence, testing hooks manually, and identifying silent failures—to pinpoint the exact cause of hook breakdowns and implement targeted fixes.
Features
verify hook outputs and debug logs are being written to correct project and global directories
check .claude/settings.json at both project and global scope to confirm hooks are registered
confirm hook shell wrappers and compiled TypeScript bundles exist and are in expected locations
run hooks directly with sample JSON payloads to isolate failures outside the Claude Code runtime
identify detached spawns with stdio: 'ignore' that hide hook errors from standard output
systematically debug SessionEnd, PostToolUse, and UserPromptSubmit hooks with hook-specific test patterns
catch common mistakes like incorrect CLAUDE_PROJECT_DIR references or wrong cache paths
Example Output
Hook Registration Check:
Project settings found:
SessionEnd: /project/.claude/hooks/session-end-cleanup.sh ✓
PostToolUse: /project/.claude/hooks/handoff-index.sh ✓
Global settings: ~/.claude/settings.json also checked
Manual Hook Test:
Test input: {"tool_name": "Write", "tool_input": {"file_path": "test.md"}}
Hook execution: SUCCESS
Output written to: .claude/cache/index.json
Timestamp: 2024-01-15T14:32:11Z
Silent Failure Diagnosis:
Found detached spawn with stdio: 'ignore' in hooks/handoff-index.ts
Recommendation: Add file logging to capture errors
Debug log enabled at: .claude/cache/debug.log
What's Included
- debug-hooks.md: complete diagnostic workflow with all check commands and testing procedures
- Bash command templates: ready-to-run commands for cache inspection, hook verification, and manual testing
- JSON test payloads: example inputs for SessionEnd, PostToolUse, and UserPromptSubmit hooks
- Silent failure checklist: patterns to identify hidden errors in detached spawns and stdio configuration
- Path reference guide: clarification of $CLAUDE_PROJECT_DIR and global ~/.claude/ directory structure
Who It's For
- Claude Code developers — debugging hook integrations in AI-powered development workflows
- DevOps engineers — troubleshooting hook failures in automated code generation pipelines
- Full-stack developers — resolving hook issues in TypeScript/JavaScript Claude Code projects
- Software architects — validating hook configurations across project and global settings
- Engineering leads — systematically diagnosing hook problems before escalating to vendor support
Best For
- Debugging hooks that fail silently without errors in output
- Verifying hook registration across project and global configuration files
- Testing hook behavior in isolation before integration testing
- Identifying common path errors and stdio configuration issues
- Systematically ruling out environment and configuration problems in hook chains







