Hook Updater
Overview
Use this skill to refresh an existing hook safely: research current best practices, compare against current implementation, generate a TDD patch backlog, apply updates, and verify ecosystem integration including settings.json registration.
When to Use
- Reflection flags stale or malfunctioning hook behavior
- EVOLVE determines hook capability exists but quality is outdated
- User asks to audit/refresh an existing hook
- Hook exit code or stdin protocol issues detected
The Iron Law
Never update a hook blindly. Every refresh must be evidence-backed, TDD-gated, and integration-validated.
Workflow
Step 0: Evaluate Current State
- Read the hook file and understand its purpose
- Check settings.json registration (which events, which matchers)
- Run existing tests if they exist
- Identify issues: wrong API pattern, missing registration, broken requires
Step 1: Research Best Practices
- Read
.claude/hooks/CLAUDE.md for hook conventions
- Review similar hooks in the same category for patterns
- Check
.claude/rules/hooks.md for hook rules
- Use
Skill({ skill: 'research-synthesis' }) if external research needed
Step 2: Generate Patch Backlog
- List specific changes needed (TDD-style: test first, then implement)
- Prioritize by risk: registration fixes > exit code fixes > logic improvements
- Estimate scope: <30 lines = auto-apply, >30 lines = plan mode
Step 3: Apply Updates
- Write or update tests first (RED phase)
- Apply hook changes (GREEN phase)
- Refactor for clarity (REFACTOR phase)
- Use
Edit tool — never rewrite the entire file
Step 4: Verify Integration
- Confirm hook is registered in
.claude/settings.json for correct events
- Verify hook exit codes: 0=allow, 2=block, 1=error (SE-03)
- Verify stdin JSON parsing follows the standard protocol
- Run
pnpm lint:fix && pnpm format
- Run hook-specific tests
Step 5: Record
- Log changes via
MemoryRecord if significant
- Update CHANGELOG.md entry
Domain-Specific Validation
- Hook MUST be registered in settings.json under appropriate event
- Hook MUST use stdin JSON protocol (not programmatic function exports)
- Hook MUST exit 0 (allow) or 2 (block) — never exit 1 for blocking
- Hook MUST wrap body in try/catch, exit 0 on unexpected errors (SE-03)
- Hook require() paths MUST be file-relative (../../lib/...), not CWD-relative
Anti-Patterns
- Updating a hook without checking its settings.json registration
- Changing exit codes without understanding the 0/1/2 semantics
- Converting a stdin-protocol hook to programmatic API (or vice versa)
- Removing error handling to "simplify" the hook
1---2name: hook-updater3description: Research-backed hook refresh workflow for updating existing hooks with TDD checkpoints and settings.json registration validation.4version: 1.0.05model: sonnet6invoked_by: both7user_invocable: true8tools: [Read, Write, Edit, Glob, Grep, Bash, Skill, MemoryRecord]9args: '--hook <name-or-path> [--trigger reflection|evolve|manual|stale] [--mode plan|execute]'10error_handling: graceful11streaming: supported12verified: true13lastVerifiedAt: '2026-04-07'14dependencies: [research-synthesis]15category: framework-management16tags: [hooks, updater, maintenance, framework]17aliases: [update-hook, refresh-hook]18source: builtin19trust_score: 10020provenance_sha: 88c33a7109c1712221metadata:22 source: https://skillmd.com/skills/oimiragieo/hook-updater23---2425# Hook Updater2627## Overview2829Use this skill to refresh an existing hook safely: research current best practices, compare against current implementation, generate a TDD patch backlog, apply updates, and verify ecosystem integration including settings.json registration.3031## When to Use3233- Reflection flags stale or malfunctioning hook behavior34- EVOLVE determines hook capability exists but quality is outdated35- User asks to audit/refresh an existing hook36- Hook exit code or stdin protocol issues detected3738## The Iron Law3940Never update a hook blindly. Every refresh must be evidence-backed, TDD-gated, and integration-validated.4142## Workflow4344### Step 0: Evaluate Current State45461. Read the hook file and understand its purpose472. Check settings.json registration (which events, which matchers)483. Run existing tests if they exist494. Identify issues: wrong API pattern, missing registration, broken requires5051### Step 1: Research Best Practices52531. Read `.claude/hooks/CLAUDE.md` for hook conventions542. Review similar hooks in the same category for patterns553. Check `.claude/rules/hooks.md` for hook rules564. Use `Skill({ skill: 'research-synthesis' })` if external research needed5758### Step 2: Generate Patch Backlog59601. List specific changes needed (TDD-style: test first, then implement)612. Prioritize by risk: registration fixes > exit code fixes > logic improvements623. Estimate scope: <30 lines = auto-apply, >30 lines = plan mode6364### Step 3: Apply Updates65661. Write or update tests first (RED phase)672. Apply hook changes (GREEN phase)683. Refactor for clarity (REFACTOR phase)694. Use `Edit` tool — never rewrite the entire file7071### Step 4: Verify Integration72731. Confirm hook is registered in `.claude/settings.json` for correct events742. Verify hook exit codes: 0=allow, 2=block, 1=error (SE-03)753. Verify stdin JSON parsing follows the standard protocol764. Run `pnpm lint:fix && pnpm format`775. Run hook-specific tests7879### Step 5: Record80811. Log changes via `MemoryRecord` if significant822. Update CHANGELOG.md entry8384## Domain-Specific Validation8586- Hook MUST be registered in settings.json under appropriate event87- Hook MUST use stdin JSON protocol (not programmatic function exports)88- Hook MUST exit 0 (allow) or 2 (block) — never exit 1 for blocking89- Hook MUST wrap body in try/catch, exit 0 on unexpected errors (SE-03)90- Hook require() paths MUST be file-relative (../../lib/...), not CWD-relative9192## Anti-Patterns9394- Updating a hook without checking its settings.json registration95- Changing exit codes without understanding the 0/1/2 semantics96- Converting a stdin-protocol hook to programmatic API (or vice versa)97- Removing error handling to "simplify" the hook