cc-hooks

Featured

Configure default Claude Code enforcement hooks and opt-in injection recipes. Triggers: "cc-hooks", "configure Claude Code hooks", "install hooks".

AI & Automation 414 stars 40 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 96/100

Stars 20%
87
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Claude Code Hooks Shell commands that fire at specific points in Claude Code's lifecycle. Hooks enforce mechanically what prose cannot: a model can reason its way past an instruction, but it cannot reason its way past an exit 2 — which is exactly why every hook must be narrow, silent, and reversible. Named failure mode — **chatty happy path**: a hook that emits stdout on exit 0 corrupts the tool call it was guarding; silence on success is part of the contract, not a style preference. ## Constraints - Enforcement hooks (the PreToolUse policy dispatcher) ship by DEFAULT: plugin installs auto-wire `hooks/hooks.json`; skill copies and checkouts wire with one command (`scripts/install-hooks.sh`). Operators can disable per host (`/plugin disable`, or remove the settings matchers). - Injection hooks (SessionStart/UserPromptSubmit context stuffing) stay dead — the #511 teardown proved delta=0 at 10.35M resident tokens. Never ship one; the hookless-cold-start gate still enforces this. - Keep the happy path silent and block only with the event's documented exit/JSON contract because stray stdout can corrupt a tool call. - Bound Stop hooks with `stop_hook_active` and scope matchers narrowly to prevent recursion and unrelated-command interception. <!-- TOC: Quick Start | Events | Blocking | Writing Hooks | Anti-Patterns | References --> ## Quick Start Add to `~/.claude/settings.json` (user) or `.claude/settings.json` (project): ```json {"hooks":{"PreToolUse":[{"matcher":"Bash"...

Details

Author
boshu2
Repository
boshu2/agentops
Created
8 months ago
Last Updated
today
Language
Go
License
Apache-2.0

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category