Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By yurukusav30.0.0MIT
Blocks destructive shell commands, risky file writes and force-pushes before Claude runs them during autonomous sessions. Example hooks need jq installed, otherwise they read an empty command and silently do nothing.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
2 cautions to review before installing
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
日本語の README はこちら / Japanese README
One command to add safety hooks to Claude Code. It installs a set of PreToolUse, PostToolUse, SessionStart, Stop, and SubagentStop hooks that stop destructive or irreversible operations before they run, and that surface silent failures.
npx github:yurukusa/cc-safe-setup
The command is interactive: it shows what each hook does and lets you choose which to install into your ~/.claude/settings.json (or a project-local .claude/settings.json). Nothing is installed without your confirmation. MIT licensed.
npx cc-safe-setupis current again. The npm release sat at 29.8.0 (2026-04-20) for five months because publishing was blocked on a credential; 30.0.5 was published on 2026-09-24 andlatestpoints at it. Either install command now gives you the same guards. If you installed from npm before that date you have 29.8.0, which lets twenty-five command shapes through that the current code blocks — the measurement, and how to check what you have, are in The npm release was behind this repository below.
Reading this in order, rather than by section: The Claude Code Safety Field Manual is this repository's documentation laid out as a path — the pre-flight checklist, what each guard actually refuses, how to make one fire on purpose so you can watch it work, and what to read in the log afterwards. The minimum price is zero.
If you arrived from a search with something already broken, start here: the symptom on the left, and the section that answers it on the right. Every section it points to is a measurement on a real machine, not a guess. (A third of the visitors here do arrive from a search engine — 51 of 152 unique visitors in the 14 days to 2026-09-19. The rest come from links such as a gist or GitHub itself, or with no referrer recorded at all.)
| What you are seeing | Start here | Where |
|---|---|---|
| The hook refuses, and the tool call runs anyway | The refusal is in a shape or a word the event does not read — or the hook exited 1, crashed, or could not find jq | A refusal the tool never reads, then Proving a hook fires |
| The hook never seems to run at all | The session was started in a way that skips your hooks entirely | Four ways your guards stop running at all |
| The hook runs, but never on the commands you care about | Your pattern is anchored where your commands are not | A hook can be installed, current, registered — and still never see you |
| You are not sure the hook does anything | You have not fired it on purpose yet | Proving a hook fires |
| The hooks are installed but feel out of date | Installed copies are snapshots and do not update themselves | Your installed hooks do not update themselves |
npx cc-safe-setup behaves unlike this page | You installed before 2026-09-24, when npm was still serving 29.8.0 | The npm release was behind this repository |
The core guard sets are also published as Claude Code plugins from this repository. They install from inside Claude Code and track the default branch, so they do not depend on the npm release at all.
/plugin marketplace add yurukusa/cc-safe-setup
/plugin install safety-essentials@cc-safe-setup
| Plugin | What it blocks |
|---|---|
safety-essentials | rm -rf, force-push, git reset --hard, writes to .env, package publish |
git-protection | force-push, direct pushes to main/master, hard reset, interactive rebase, git clean -fd |
credential-guard | Write/Edit to paths matching .env, .env.*, credentials, secret, serviceaccount*.json, key.json. API keys in Bash commands are warned about, not blocked — see the limits below |
token-guard | reads over 100KB, a per-session read budget, subagent fan-out, a token budget that asks for /compact |
These are the guards only. The example-hook library, --doctor, --audit, and the rest of the CLI come from the npm package or from this repository directly.
credential-guard (2026-09-04, against npm 29.8.0)These are the exit codes, not the intent. Read them before trusting the row above.
7-day copy clicks
Generated from the plugin's indexed repository (yurukusa/cc-safe-setup) — no native marketplace selected
npx claudepluginhub p/yurukusa-cc-safe-setupBuilt from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground