Claude Code Recursive Delete Guard — Development skill for Claude Code
Claude Code hook that blocks unquoted rm -rf $VAR and repo-root deletes, even in bypassPermissions mode.
How to install Claude Code Recursive Delete Guard
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open mishoko/claude-code-recursive-delete-guard and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code Recursive Delete Guard does
Claude Code hook that blocks unquoted rm -rf $VAR and repo-root deletes, even in bypassPermissions mode.
Alternatives in Development
- Om Tidy — Self-maintenance pass — acts on every hygiene flag: archives completed work, groups loose clusters, splits ove 4.6k ★
- Nonstop — Autonomous work mode for Claude Code 263 ★
- Solopreneur Başlangıç Rehberi — 989 skill var 248 ★
README
claude-code-recursive-delete-guard
A [Claude Code](https://docs.anthropic.com/en/docs/claude-code) `PreToolUse` hook that blocks unsafe recursive deletes before they run, **in every permission mode, `bypassPermissions` included**.
One Python file. Standard library only. About 0.25 ms per tool call.
Install
curl -fsSL https://raw.githubusercontent.com/mishoko/claude-code-recursive-delete-guard/main/recursive_delete_guard.py -o /tmp/rdg.py \
&& python3 /tmp/rdg.py --install
`--install` does four things:
- copies the hook to
~/.claude/hooks/recursive_delete_guard.py, - runs the self-test,
- backs up
~/.claude/settings.json, - adds one
PreToolUseentry.
Running it again changes nothing, and existing hooks are kept. Restart open Claude Code sessions afterwards.
To check that it's live, ask Claude to run `true || rm -rf /tmp/probe-$$`. The `rm` can never execute, and you should see `Blocked by recursive_delete_guard`.
What it blocks
tool call (Bash / Write / Edit / MultiEdit)
│
▼
┌───────────────────────────────────┐
│ rm -r with an unquoted $VAR/$(…)? │──► block
│ find $T … -delete / -exec rm? │──► block
│ target is / · ~ · cwd · a parent │
│ · a git work-tree root · .git ? │──► block
│ writes or runs a script that │
│ does any of the above? │──► block
└─────────────────┬─────────────────┘
│ otherwise
▼
runs
| Blocked | Allowed |
|---|---|
rm -rf $D |
rm -rf -- "${D:?}" |
rm -r -f $(dirname $R)/x |
rm -rf build dist |
find $T -type f -delete |
find . -name '*.pyc' -delete |
rm -rf . / .. / ~ / / / ./* / ~/* |
rm -rf *.diff |
rm -rf .git, or a git work-tree root |
rm -rf output/run |
| a script (heredoc or file) containing any of these | git rm -r --cached x, echo "rm -rf $x" |
Where it looks:
- the Bash command itself, including commands inside `$(...)
Related Skills
Blast Radius Guard
Judge the true blast radius of destructive commands BEFORE the agent runs them - Windows, Linux & macOS: volum
Destructive Guard
Claude Code plugin: detect destructive/deletion bash commands → y/n confirmation (works in bypassPermissions)
Adhd
Claude/agent skill that tames file chaos (Desktop, Downloads, Documents) safely: dry-run, never deletes, one-c
Guard Destructive Ops
A skill for claude,dsh(or other agents),aiming to solve the problem that agnets can use wrong powershell to de
Prune Tests
Prune tests that guard no behavior — classify, mutation-check, rewrite or delete.
Guard
Safety guardrails — blocks destructive commands (rm -rf, DROP TABLE, force-push) and optionally restricts edit
Related Agents
Claude Code Flow
by ruvnet - This mode serves as a code-first orchestration layer, enabling Claude to write, edit, test, and op
Plan Reader
Read-only summarizer for a Terraform or OpenTofu plan.json, a rendered Kubernetes diff, or Ansible check-mode
Auth Sentinel
Deep auth/registry security gate — verifies the SSO verified-domain gate and SSRF guard are present AND reacha