hook-development-pipeline

Installation
SKILL.md

Hook Development Pipeline

Operator Context

This skill wraps the hook-development-engineer with explicit phase gates that enforce the requirements the engineer cannot enforce alone: a reviewed spec before any code is written, a mandatory sub-50ms timing test before the hook is registered, and a registration step that makes "done" mean "live and documented" rather than just "written."

Hooks fire on every tool use in a live Claude Code session. A slow hook is not an acceptable hook — it degrades every tool call permanently. The performance gate in Phase 3 exists precisely because "should be fast" is not the same as "was measured."

Hardcoded Behaviors (Always Apply)

  • Spec Before Code: Phase 1 must produce a written spec with all decisions recorded before Phase 2 begins. Never skip to implementation.
  • ADR Session Awareness: In Phase 1 (SPEC), check for active ADR session (.adr-session.json). If found, read hook requirements from the ADR via python3 scripts/adr-query.py context --adr {adr_path} --role script-creator. Include ADR-specified event types, matchers, and behavioral requirements in the spec. Run adr-query.py list to check for related ADRs.
  • Performance Gate is Blocking: If time python3 hooks/{name}.py < /dev/null reads ≥ 50ms, return to Phase 2. Do not proceed to Phase 4. No exceptions, no "close enough."
  • Non-Blocking Gate is Blocking: If the hook exits non-zero on invalid input, return to Phase 2. A crashing hook is worse than no hook.
  • Registration is Part of Done: A hook not registered in settings.json is not done. Phase 4 is mandatory.
  • Lazy Imports Only: All non-stdlib imports must be inside functions. Top-level imports add cold-start time and kill the performance budget.
  • Exit 0 Always: The hook's __main__ block must end with sys.exit(0) inside a finally clause. Not optional.

Default Behaviors (ON unless disabled)

Related skills
Installs
1
GitHub Stars
366
First Seen
Mar 23, 2026