hooks

Installation
SKILL.md

Hooks

Hooks are Claude Code's automation surface — deterministic bash (or any shell) scripts that fire on lifecycle events. Each hook receives JSON on stdin and returns JSON on stdout: {"decision": "approve"|"block", "reason"?: "..."}.

Events (matcher + input + output)

Event Fires Input Output shape
PreToolUse Before any tool {tool_name, tool_input} {decision, reason?} — block prevents the tool call
PostToolUse After tool succeeds {tool_name, tool_input, tool_output} {decision, reason?}
PostToolUseFailure After tool fails {tool_name, tool_input, error} {decision} — almost always approve
Notification Claude needs input {message} {decision}
Stop Agent finishes turn {stop_reason} {decision}
UserPromptSubmit Prompt submitted {prompt} {decision} + optional modified prompt
SessionStart New session {} {decision} — usually for context injection

Installing a hook pack

Use MCP cc_kb_hook_recipe(name) to fetch a security-hardened pack. Each pack returns:

Related skills
Installs
7
GitHub Stars
11
First Seen
Apr 19, 2026