
If you're building Claude Code plugins and need to control what happens before and after tool execution, this is your starting point. It covers the five main hook types: PreToolUse for validating operations before they run, PostToolUse for reacting to results, Stop and SubagentStop for enforcing completion standards, and SessionStart for loading project context. The guide emphasizes prompt-based hooks over function-based ones, which makes sense since you get LLM-driven decision making instead of hard-coded logic. Originally from ovachiever/droid-tings, now maintained by davila7. Worth checking out if you're tired of Claude doing things you'd rather it asked about first.
$ npx -y skills add davila7/claude-code-templates --skill "Hook Development" --agent claude-codeInstalls into .claude/skills of the current project.
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:
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:
Execute bash commands for deterministic checks:
{
"type": "command",
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh",
"timeout": 60
}
Sponsors