cc-hooks

Featured

Configure Claude Code hooks and narrow enforcement guards. Use when: the caller requests hook installation, repair or policy changes; a hook is not required to use other skills.

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

Install

View on GitHub

Quality Score: 91/100

Stars 20%
88
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. ## Prompt ```text Add a PreToolUse hook to fleet-router/.claude/settings.json that blocks `git push --force` on the main branch. Keep it silent on exit 0, exit 2 with a message on block, and confirm it fires with a manual test invocation before committing the change. ``` ## It's working if - The hook script exits `2` with a stderr message when it blocks `git push --force`, and exit `0` with no stdout on the allowed path. - `.claude/settings.json` gains one matcher entry for the new hook, alongside the existing hooks list rather than replacing it. - A manual test invocation against the new matcher shows the block firing in the transcript, with exit `2` visible, before the change gets committed. - The hook inspects only the `PreToolUse` call it guards, keeping every other file untouched. ## 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-hoo...

Details

Author
boshu2
Repository
boshu2/agentops
Created
10 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