
Hook Development
Guide for writing Claude Code plugin hooks, covering prompt-based and command hook types across lifecycle events.
- skills.sh installs
- 7.8K
- GitHub stars
- 47.9K
- last updated
- Aug 21, 2026
What it does
- Covers prompt-based and command hook types for PreToolUse, PostToolUse, Stop, SubagentStop, UserPromptSubmit, SessionStart, SessionEnd, PreCompact, and Notification events
- Includes JSON configuration formats for both plugin
hooks/hooks.jsonfiles and.claude/settings.json, plus input fields, output schemas, and exit codes - Recommends
${CLAUDE_PLUGIN_ROOT}for portable command paths and$CLAUDE_ENV_FILEfor persisting environment variables at session start - Designed for plugin authors who need to validate tool calls, block dangerous commands, or enforce completion standards
Install
$ npx -y skills add anthropics/claude-plugins-official --skill hook-development -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Hook Development for Claude Code Plugins
Overview
Hooks are event-driven automation scripts that execute in response to Claude Code events. Use hooks to validate operations, enforce policies, add context, and integrate external tools into workflows.
Key capabilities:
- Validate tool calls before execution (PreToolUse)
- React to tool results (PostToolUse)
- Enforce completion standards (Stop, SubagentStop)
- Load project context (SessionStart)
- Automate workflows across the development lifecycle
Hook Types
Prompt-Based Hooks (Recommended)
Use LLM-driven decision making for context-aware validation:
{
"type": "prompt",
"prompt": "Evaluate if this tool use is appropriate: $TOOL_INPUT",
"timeout": 30
}
Supported events: Stop, SubagentStop, UserPromptSubmit, PreToolUse
Benefits:
- Context-aware decisions based on natural language reasoning
- Flexible evaluation logic without bash scripting
- Better edge case handling
- Easier to maintain and extend
Command Hooks
Execute bash commands for deterministic checks:
{
"type": "command",
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh",
"timeout": 60
}
Details
- Repository
- github.com/anthropics/claude-plugins-official
- Category
- Skill & Plugin Building
- First seen
- May 16, 2026
More from anthropics/claude-plugins-official
All 23- Mcp Integration7.7K
- Command Development7.7K
- Build Mcp Server7.6K
- Writing Hookify Rules7.6K
- Plugin Structure7.6K
- Plugin Settings7.5K
- Build Mcp App7.4K
- Build Mcpb7.1K
- Math Olympiad4.9K
- Configure4.7K
- Access4.7K
- Session Report4.6K
- M5 Onboard3.8K
- Cardputer Buddy3.8K
- Example Skill213
- Frontend Design19.1K
- Claude Md Improver15K
- Claude Automation Recommender11.5K
- Playground8.9K
- Skill Creator8.6K
- Agent Development8.1K
- Skill Development8K
Similar to Hook Development
More Skill & Plugin Building
hooksparcadei/continuous-claude-v3509 installsShell-to-TypeScript hook pattern with templates, six lifecycle events, and settings registration for Claude Code.
hook-developerparcadei/continuous-claude-v3506 installsComplete Claude Code hook reference covering input and output schemas for every event, plus registration and testing.
plugin-structureanthropics/claude-plugins-official7.6K installsReference for building a Claude Code plugin's directory layout, manifest, and component files.
agent-developmentanthropics/claude-plugins-official8.1K installsGuided authoring of Claude Code plugin agents, covering frontmatter fields, triggering descriptions, and system prompt structure.
creating-claude-hooksagentworkforce/relay1.1K starsGuide for building executable Claude Code hooks, covering event types, I/O format, and PRPM packaging.
groove-admin-claude-hooksandreadellacorte/groove531 installsInstalls groove's Claude Code shell hooks into settings.json for deterministic lifecycle actions without model involvement.