hooks

Solid

Hook Development Rules

AI & Automation 496 stars 41 forks Updated 1 months ago MIT

Install

View on GitHub

Quality Score: 85/100

Stars 20%
90
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
68
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Hook Development Rules When working with files in `.claude/hooks/`: ## Pattern Shell wrapper (.sh) → TypeScript (.ts) via `npx tsx` ## Shell Wrapper Template ```bash #!/bin/bash set -e cd "$CLAUDE_PROJECT_DIR/.claude/hooks" cat | npx tsx <handler>.ts ``` ## TypeScript Handler Pattern ```typescript interface HookInput { // Event-specific fields } async function main() { const input: HookInput = JSON.parse(await readStdin()); // Process input const output = { result: 'continue', // or 'block' message: 'Optional system reminder' }; console.log(JSON.stringify(output)); } ``` ## Hook Events - **PreToolUse** - Before tool execution (can block) - **PostToolUse** - After tool execution - **UserPromptSubmit** - Before processing user prompt - **PreCompact** - Before context compaction - **SessionStart** - On session start/resume/compact - **Stop** - When agent finishes ## Testing Test hooks manually: ```bash echo '{"type": "resume"}' | .claude/hooks/session-start-continuity.sh ``` ## Registration Add hooks to `.claude/settings.json`: ```json { "hooks": { "EventName": [{ "matcher": ["pattern"], // Optional "hooks": [{ "type": "command", "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/hook.sh" }] }] } } ```

Details

Author
vibeeval
Repository
vibeeval/vibecosystem
Created
2 months ago
Last Updated
1 months ago
Language
C#
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Listed

hooks

Hook Development Rules

3,795 Updated 4 months ago
parcadei
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