writing-hooks

Installation
SKILL.md

Writing Hooks

Scope: covers hooks.json authoring and hook script design. For plugin architecture, see [[writing-plugins]]. For rules (which are simpler but static), see [[writing-rules]].

1. Three Hook Types

Type What it does When to use Complexity
command Runs a shell script, reads JSON from stdin Deterministic checks: file existence, JSON validation, regex matching Medium
prompt Injects text into Claude's context Advisory: reminders, context injection, style guidance Low
agent Spawns a verification agent Complex verification: code quality, semantic analysis, multi-file checks High

Type Selection Flowchart

Is the check deterministic (regex, file exists, JSON schema)?
  YES --> command hook (shell script)
  NO  --> Does it need AI judgment?
    YES --> agent hook
Related skills
Installs
1
GitHub Stars
44
First Seen
6 days ago