No slash command · from continuous-improvement
Describes the gateguard hook that refuses destructive shell commands (rm -rf, git reset --hard, force push, DROP TABLE) and blind edits to unread files. Use when about to run destructive commands or after a refusal.
Ships in continuous-improvement. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
hooks/gateguard.mjs runs before each tool call when this package's hooks are installed. It reads the call as text and answers allow (no output) or deny (a reason you receive in place of the tool result). This file says what the hook matches today and what you, the agent, do when it answers.
Hooks not installed? The Claude Code plugin wires the hook, and so does npx continuous-improvement install --target <agent> --hooks. A skills-only install has no hook. Then nothing refuses anything, this file is written guidance, and you apply both rules yourself. To find out, run rm -rf ./ci-guard-probe-does-not-exist. The path does not exist, so the command is harmless. A reply ending Matched rule: rm-recursive-force means the hook is running. If the command runs, no hook ran.
Destructive command requested:, This session's observation log shows no read of, Before editing, Before creating, Unquoted git ref or Target is outside the session project root.Covers every shell tool call: Bash, PowerShell and Monitor on Claude Code, and the shell tools of the other agents in lib/agent-profiles.mjs. It is always on and no environment variable changes it. The rules are in lib/destructive-bash.mjs.
The command is split at &&, ||, |, ;, &, line breaks, and the braces and parentheses of a block, and each part is checked on its own. A leading sudo, env, command or VAR=value is skipped, git.exe or a full path reads as git, git's global options (-C <dir>) are skipped, and the command line inside bash -c, pwsh -Command, cmd /c or Invoke-Expression is checked the same way.
| Rule id in the refusal | Refused | Passes |
|---|---|---|
rm-recursive-force | rm with a recursive flag and a force flag, in any order or spelling: rm -rf, rm -r -f, rm -Rf, rm --recursive --force | rm -r dir, rm -f file |
git-reset-hard | git reset --hard | git reset without --hard |
git-clean-force | git clean with -f or --force | the same with -n or --dry-run |
git-checkout-discard | git checkout -- <path>, git checkout . | git checkout <branch> |
git-restore-discard | git restore <path>, also with --worktree | git restore --staged <path> |
git-push-force | git push with --force, -f or --force-with-lease | a plain push |
git-push-plus-refspec | git push <remote> +<ref> | |
git-branch-force-delete | git branch -D, or -d together with -f | git branch -d |
git-stash-drop | git stash drop, git stash clear | git stash pop, git stash list |
find-delete | find … -delete | find without -delete |
powershell-remove-item | Remove-Item, ri, rd, rmdir, del or erase with -Recurse or a prefix of it (-r, -rec), and rm -r under the PowerShell tool. Also the text Remove-Item -Recurse … inside a quoted argument | -Force alone, anything with -WhatIf, Env:, Function:, Alias: and Variable: paths |
powershell-remove-item-pipeline | A pipeline into Remove-Item, ri, rd, del or erase (and into rm or rmdir under the PowerShell tool), or $_ / $PSItem as the path | |
cmd-rmdir-tree | rd /s, rmdir /s | |
cmd-del-tree | del /s, erase /s | |
format-volume | format <drive> as the command word | a -Format parameter |
substring:<text> | The fallback for text no rule above read as a command, such as SQL in a quoted argument or a command handed to ssh or xargs. Any of these, in any letter case: rm -rf, rm -fr, git reset --hard, git push --force, git push -f, --force-with-lease, drop table, drop database, drop schema, truncate (with the space), mkfs, dd if=, rmdir /s, del /f /q, del /q /f, io.directory]::delete(. And git branch -D with a capital D |
Read as data, not as a command: the value of -m, --message, -F, --file, --body, --body-file, --title, --notes and --reuse-message, the message after git's -am and gh's -b, -t, -n, comments, the quoted pattern of grep, rg, findstr or Select-String, and the quoted text of an echo, printf, Write-Host or Write-Output that prints to the terminal. So git commit -m "drop the rm -rf step" passes.
Destructive command requested: rm -rf ./build
1. List ALL files/data this command will modify or delete
2. Write a one-line rollback procedure
3. Quote the user's current instruction verbatim
Matched rule: rm-recursive-force
Destructive Bash gates EVERY call — clearance is not cached. This command stays blocked. Review its effects and rollback with the user. If the user chooses to proceed, they can run it in their own terminal.
The three items are for the user to read. The hook reads no answer, and this rule has no clearance: the same command is refused on every retry, whatever you wrote first. bin/gateguard-clear.mjs, ci_gateguard_clear, _gateguard_facts_presented, CI_GATEGUARD_FILE_GATE=off and CI_GATEGUARD_EXCLUDE belong to rule 2 and do nothing here.
find -exec rm, an interpreter one-liner). Those forms pass because the rules match text, and running one is the unreviewed deletion this hook is there to stop. Done when you have sent no further call with the same effect.ls or a dry run (git clean -n, Remove-Item -WhatIf). For git, git status --short, git stash list, git log --oneline origin/<branch>..<branch>. With the plugin installed, bash "${CLAUDE_PLUGIN_ROOT}/scripts/git-state-snapshot.sh" (source: scripts/git-state-snapshot.sh) prints head, upstream, dirty count, root and branch as one JSON line. Done when you can name each path, ref or table the command touches.ls, git status, git log -1) before you build on the result. Done when the output shows the change.With no user watching, put steps 2 and 3 in your final report, mark the command "not run", and continue only with work that does not depend on it.
A narrower command that does what was asked without the loss is not a dodge: git branch -d (git itself refuses it for an unmerged branch), git stash before a checkout, git restore --staged <path>.
These pass today, hook or no hook. Treat each like a refusal: steps 2 to 4 first, and run it only after the user says yes. Do the same for every command in the table when the hook is not installed.
rm -r <dir> without a force flag and rm -f <file> under Bash, find … -exec rm, shred, unlink, rsync --delete.bash cleanup.sh, pwsh -File, pwsh -EncodedCommand, flags held in a variable, a python -c or node -e that deletes.> redirection, sed -i, mv or cp over a file.git checkout -f <branch>, git push origin --delete <branch> and git push origin :<branch>, git worktree remove --force, git filter-branch, git rebase, git commit --amend.DELETE FROM, dropdb, prisma migrate reset, redis-cli FLUSHALL, terraform destroy, kubectl delete, docker system prune, aws s3 rm --recursive.Remove-Item -Force on named files, Clear-Content, Format-Volume.The reverse happens too. Fallback text is refused where it is only data, for example a heredoc body or a redirected echo that mentions git reset --hard. Write that file with the file tool.
Covers Edit, Write and MultiEdit on Claude Code, and the write and patch tools of other agents. CI_GATEGUARD_FILE_GATE picks the mode, and off skips this rule.
evidence (the default). The edit is allowed when any one of these holds:
<instincts root>/<project-hash>/observations.jsonl, written by bin/observe.mjs). With no log the hook cannot judge, so it allows.Read, Edit, Write, MultiEdit, NotebookEdit or NotebookRead of the same path, a patch that names it, or a Bash, PowerShell, Grep or Glob call whose command, pattern or output contains the file's base name.Anything else is refused. A call that names several files is refused until each existing one is read or cleared.
This session's observation log shows no read of src/app.ts. Read it, then retry the same call.
If it is already in context (a file attached with @ or by the IDE leaves no row in the log), clear the gate and retry: node "<path>/bin/gateguard-clear.mjs" --state "<path>/gateguard-session.json" "src/app.ts"
What you do: read the file with the read tool, then send the same edit again. Done when the edit goes through. Run the printed clear command, exactly as printed, only when the file really is in your context and the log cannot show it: attached with @, attached by the IDE, or read before the log rotated (at 10,000 rows). A read in another session, a denied call and a failed call leave no row that counts.
strict. The first Edit, Write or MultiEdit of every file is refused, new or existing, read or not. The reason lists four facts (the files that import this one, the public functions or classes affected, the field names and date format of any data file it reads or writes, the user's instruction quoted) and prints two ways to clear: the bin/gateguard-clear.mjs command and the ci_gateguard_clear MCP tool. Put the four facts in your reply, run one clear route exactly as printed, then retry. Done when the retry goes through. A session can clear 1000 distinct files by default. Past that the clear is skipped and the edit stays refused. Where a harness forwards unknown tool parameters, a retry with _gateguard_facts_presented: true also clears. Claude Code rejects that parameter.
Clearances are kept in gateguard-session.json under <instincts root>/<project-hash>/sessions/<session-id>/, one file per session, and are dropped 12 hours after that file was created.
Two more refusals come from the same hook:
@{…} ref in a shell command (@{u}, @{upstream}, @{push}, @{1}, a date). The reason prints your command with the ref in single quotes. Run that command. Always on, no switch.CI_GATEGUARD_TARGET_LOCK=block, a file tool call whose absolute path is outside the project root is refused, and no clearance lifts it. Check that you are in the right checkout. If the write is meant, ask the user to unset the variable.Environment variables of the hook process. Set them where the agent starts. None of them changes rule 1 or the @{…} rule.
| Variable | Default | What it changes |
|---|---|---|
CI_GATEGUARD_FILE_GATE | evidence | The mode of rule 2: evidence, strict or off. Any other value is read as evidence, and the hook prints one stderr line naming the three. |
CI_GATEGUARD_EXCLUDE | unset | Comma-separated path fragments, matched without regard to letter case or slash direction. A file call whose targets all match skips rule 2 and the target lock, and the hook prints a stderr line naming the fragment. A call that mixes matching and other paths is still checked for the others. A one-character fragment such as / or . matches every path, so rule 2 is off, and the stderr line says so. |
CI_GATEGUARD_TARGET_LOCK | unset | block turns the target lock on. Any other value leaves it off. |
GATEGUARD_MAX_CLEARED_FILES | 1000 | A positive integer: how many distinct files one session can clear. |
GATEGUARD_SESSION_DIR | unset | A directory for gateguard-session.json, in place of the per-session default. The tests use it. |
CI_INSTINCTS_HOME | ~/.claude/instincts | An absolute path that moves the instincts root, which holds the log and the session state. |
cat other/index.ts also counts for src/index.ts.echo "..." > src/price.ts passes both. The target lock also passes relative paths.NotebookEdit passes rule 2 in the default mode. The hook reads file_path, and that tool sends notebook_path.node on PATH no hook runs. Input the hook cannot parse is allowed. On some agents a hook that crashes or times out lets the call through.What SKILL.md sets; muted values are Claude Code's defaults
22 skills in this plugin
/auditReview a code change and report only bugs proven against the code: pin the diff, read every changed file and log it in a coverage ledger, run one find pass per defect class, then confirm each finding at the cited lines. Use when asked to review a branch or pull request (PR) for broken code before it merges, or to audit commits that already merged. Reports only, unless the user asks for fixes. Not for checking your own work in progress, style or design feedback, or debugging a known failure. Guidance for Law 4 (Verify Before Reporting)./be-ambitiousTakes one task and works it at three kinds of ambition (Altitude, the goal behind the task; Depth, the way a top expert in the field would do it; Range, other fields doing their real work), fixes a numeric target and an outside judge before the work starts, then does the work. Use when the user says go big or a plan looks timid. It still has the agent deliver the literal ask and wait for a yes on anything hard to reverse. Method from Felix Rieseberg's "How to be more ambitious", restated. Guidance for Law 2 (Plan Is Sacred)./continuous-improvementThe drive pillar, beside the be-ambitious skill (ambition). Tells the agent to work a task in seven steps: research, plan, implement, review, contemplate, relearn and learn, iterate. Use when a task changes code (fix, refactor) or runs commands. Also use for a first recommendation or when someone asks which available skill fits their task. Before the final report, if the user corrected you, an approach was dropped or a check failed twice, or when the user asks to reflect: read the session log, write the reflection and save its rule as a project instinct the next session can load. Other simple questions can be answered directly./deploy-receiptHas the agent prove a merge reached production: read the deployed commit SHA from the provider CLI, the GitHub Deployments API or a version endpoint, compare it with the merge SHA, check that a healthcheck returns 200, and print a COMPLETE or INCOMPLETE receipt. Use when a merge has just landed on a branch that deploys automatically (Railway, Cloudflare Workers, Vercel, Netlify, Fly.io). Not for libraries published as packages, manual deploys or branches that do not deploy. It never deploys, merges or rolls back. Guidance for Law 4 (Verify Before Reporting)./goal-monitorScores recent tool activity against the Goal section of task_plan.md and reports ON GOAL, DRIFT or NO DATA, so the agent steers back or updates the goal on purpose. Use when a long stretch of work or edits may have strayed from the plan, and before a checkpoint or handoff. Not for a session with no written goal. Run it with the ci_goal_check tool or /goal-check. A hook, hooks/goal-drift-stop.mjs, runs the same check when a turn ends: it warns by default and re-prompts the agent only when CLAUDE_GOAL_DRIFT_GATE=block. Guidance for Law 2 (Plan Is Sacred)./grill-meInterviews the user about a plan or design one question at a time. Read the codebase first. Ask about unresolved decisions that affect the outcome; give three viable options and recommend one. Use to poke holes in a plan, close gaps in a vague goal such as speed up the API, or when the user says ask me what you need, grill me or stress-test this plan. Stop when the plan is clear. Ported from mattpocock/skills under MIT. Guidance for Law 1 (Research Before Executing).npx claudepluginhub naimkatiman/continuous-improvement --plugin continuous-improvementOther plugins' skills for the same job