claude-code-hooks

Solid

Claude Code hook system for pre/post tool execution. Triggers on: hooks, PreToolUse, PostToolUse, hook script, tool validation, audit logging.

AI & Automation 335 stars 29 forks Updated today

Install

View on GitHub

Quality Score: 85/100

Stars 20%
84
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
0
Description 5%
100

Skill Content

# Claude Code Hooks Execute custom scripts before/after Claude Code tool invocations. ## Quick Reference | Event | When | Has Matcher | |-------|------|-------------| | `PreToolUse` | Before tool execution | Yes | | `PostToolUse` | After tool completes | Yes | | `PermissionRequest` | Permission dialog shown | Yes | | `Notification` | Notifications sent | Yes | | `UserPromptSubmit` | User submits prompt | No | | `Stop` | Agent finishes | No | | `SubagentStop` | Subagent finishes | No | | `PreCompact` | Before context compaction | No | | `SessionStart` | Session begins/resumes | No | | `SessionEnd` | Session ends | No | ## Basic Configuration Add to `~/.claude/settings.json` or `.claude/settings.local.json`: ```json { "hooks": { "PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "$CLAUDE_PROJECT_DIR/hooks/validate.sh", "timeout": 5000 }] }] } } ``` ## Matcher Patterns | Pattern | Matches | |---------|---------| | `"Write"` | Only Write tool | | `"*"` or `""` | All tools | | `"mcp__*"` | All MCP tools | | `"Bash"` | Bash commands | ## Hook Script Requirements ```bash #!/bin/bash # Receives JSON via stdin: { "tool_name": "...", "tool_input": {...} } INPUT=$(cat) TOOL=$(echo "$INPUT" | jq -r '.tool_name') # Exit codes: # 0 = Success (continue) # 2 = Block with error (stderr shown to Claude) # Other = Non-blocking error ``` ## Common Use Cases | Use Case | Event | Example | |----------|---...

Details

Author
aiskillstore
Repository
aiskillstore/marketplace
Created
5 months ago
Last Updated
today
Language
Python
License
None

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Listed

claude-hooks

Claude Code hooks configuration specialist. Use when creating hooks for tool validation, logging, notifications, or custom automation in Claude Code.

335 Updated today
aiskillstore
AI & Automation Solid

hook-development

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.

339 Updated 1 weeks ago
tzachbon
AI & Automation Solid

hook-development

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.

29,021 Updated today
anthropics
AI & Automation Solid

hook-development

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.

27,705 Updated today
davila7
AI & Automation Solid

hook-development

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.

4,135 Updated today
Galaxy-Dawn