claude-code-hooks-pack
Skill1 starsChanged 5 months agoMITView on GitHub
Provide a declarative pattern for authoring .claude/settings.json hooks (PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart, SessionEnd) with matchers, guard rails, and short-circuit semantics. Fill the operational gap between our 136 planning-discipline skills and the day-to-day safety/observability needs of a Claude Code session. Use when adding safety guard rails (block Bash commands matching destructive patterns), observability (log every Edit to a structured audit file), or session lifecycle automation (load project context on SessionStart). Choose this skill when you need a documented hook recipe…
In this repository117 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- advanced-orchestrationSkill
- architect-agentSkill
- implementer-agentSkill
- quality-councilSkill
- reviewer-agentSkill
- tester-agentSkill
- writer-critic-pairSkill
- authoring-skillsSkill
- api-endpoint-qualitySkill
- async-job-qualitySkill
- auth-qualitySkill
- db-migration-qualitySkill
- frontend-state-qualitySkill
- acceptance-criteriaSkill
- adaptive-flowSkill
- adaptive-prompt-selectionSkill
- adversarial-code-reviewSkill
- architecture-decision-recordsSkill
- brainstormingSkill
- brownfield-spec-enhancementSkill
- bug-fix-lifecycleSkill
- checkpoint-validationSkill
- cicd-integrationSkill
- clarify-before-codeSkill
- code-context-packSkill
- code-intelligence-reviewSkill
- context-policySkill
- context-rich-implementationSkill
- crash-proof-planningSkill
- critique-pass-protocolSkill
- dependency-aware-task-orderingSkill
- deprecation-migrationSkill
- disciplined-diagnosisSkill
- docs-authorSkill
- executing-plansSkill
- external-skillSkill
- finishing-a-development-branchSkill
- git-guardrailsSkill
- goal-driven-executionSkill
- grill-user-before-buildingSkill
- guard-bypass-protocolSkill
- improve-codebase-architectureSkill
- incremental-reviewSkill
- issue-slicingSkill
- lessons-learned-dbSkill
- loop-engineeringSkill
- model-aware-configSkill
- model-weakness-memorySkill
- multi-repo-learningSkill
- orchestration-workflowsSkill
- plan-driven-executionSkill
- plan-from-specSkill
- prd-from-contextSkill
- project-constitutionSkill
- prompt-architectureSkill
- prototype-before-commitmentSkill
- quality-engineSkill
- quality-execution-contractSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
Test the hook in a sandbox session: trigger the matcher once, verify exit code, capture the structured output.
- Very specific: line 38
Document the hook in templates/hooks-pack-template.md with intent, matcher, command, exit code, and example trigger.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: Claude Code Hooks Pack
Purpose
Provide a declarative pattern for authoring .claude/settings.json hooks (PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart, SessionEnd) with matchers, guard rails, and short-circuit semantics. Fill the operational gap between our 136 planning-discipline skills and the day-to-day safety/observability needs of a Claude Code session.
When to use
Use when adding safety guard rails (block Bash commands matching destructive patterns), observability (log every Edit to a structured audit file), or session lifecycle automation (load project context on SessionStart). Choose this skill when you need a documented hook recipe with explicit matcher syntax and a JSON template — not a hand-rolled shell script.
Inputs
- Event type (one of
PreToolUse,PostToolUse,UserPromptSubmit,Stop,SessionStart,SessionEnd). - Matcher pattern (tool name regex or
*). - Hook type (
command,prompt, oragent). - Hook command or prompt body.
- Exit-code semantics (0 = allow, 2 = block, other = warn).
- Optional async flag and timeout in milliseconds.
Workflow
- Identify the trigger event and matcher pattern. Use the smallest matcher that still catches the target surface.
- Author the hook command as a single shell line or script path. Keep it under 50 lines.
- Declare exit-code semantics explicitly in a comment (
exit 0= allow,exit 2= block). - Wire the hook into
.claude/settings.jsonunder the correct event key. - Test the hook in a sandbox session: trigger the matcher once, verify exit code, capture the structured output.
- Document the hook in
templates/hooks-pack-template.mdwith intent, matcher, command, exit code, and example trigger.
Outputs
- One entry in
.claude/settings.jsonunderhooks.<event>[].hooks[]. - One entry in
templates/hooks-pack-template.mdwith intent, matcher, command, exit code, and example trigger. - A short rationale comment in the JSON explaining why the hook exists.
Failure modes
- Over-broad matcher (
*) blocks legitimate work and trains users to disable the hook. - Hook command exits 0 on error because the shell command's own exit was swallowed by
|| true. - Long-running hook (>5s) blocks the Claude Code UI without a timeout.
- Hook reads a file that does not exist (no fallback) and silently fails to apply the guard.
- Mistaking
PostToolUseforPreToolUse— the tool already ran by the time the hook fires.
Verification checklist
- Hook entry appears in
.claude/settings.jsonunder the correct event key. - Matcher regex matches at least one real tool invocation per session (verified by trigger test).
exit 0= allow path verified: hook runs, command succeeds, no block.exit 2= block path verified: hook runs, command is blocked, stderr captures reason.- Hook runtime is < 5s in p95 (measured with
timein a sandbox). - Hook is documented in
templates/hooks-pack-template.mdwith matcher, command, and exit code.
Related skills
skills/core/threat-model-driven-security/SKILL.md— STRIDE-driven hook placement (boundary → asset → adversary)skills/core/verification-before-done/SKILL.md— 5-axis verification for hook runtimecommands/vibe-hooks-pack.md— companion command that scaffolds a hook pack interactively.
Attribution
Inspired by RohitG00/awesome-claude-code-toolkit (Apache-2.0). Adapted in original wording.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

