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 rishubilMITIn 1 marketplace
PreToolUse hook that blocks or asks before Bash commands that delete data (rm -rf, find -delete, rsync --delete, git clean/reset, interpreter one-liners and scripts) unless every target is proven safe, plus a non-blocking write-time reminder.
Run automatically on Claude Code events. Claude doesn't decide.
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.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
A Claude Code plugin that stops Bash commands which delete data unless every target is proven safe, tells the agent exactly how to fix the command, and reminds the model to re-check deletion code it writes into files.
A hook only sees the command text, never the values it will run with. That is
how real agent deletion incidents happen: rsync --delete into a variable that
expanded empty deleted /; rm -rf "$(cygpath -u 'C:\')" 2>/dev/null computed
a non-empty path that was the drive root, with the errors hidden;
find ... | xargs -n1 dirname | xargs rm -rf split Application Support on
the space and removed ~/Library; git clean -fdX -- config/sub wiped the
whole ignored config/; rm -rf hit .git.
So this is not a blacklist of "bad" commands. The policy is do not pass unless the target is verified, and the answer is a deny with an actionable reason the agent can fix on its own, not a prompt for the user:
HOME, the project root, nested git repositories, temp dirs);${NAME:?}, anything else is denied with the exact rewrite;xargs rm are denied;Linux only. Which words are real command invocations is decided by
tree-sitter-bash (with a
shlex fallback), so echo 'rm -rf /', commit messages and heredoc data are
not flagged, while cd x && rm -rf y, if ...; then rm -rf ..., $(...),
bash -c '...', eval, sudo/env/timeout prefixes are all analysed.
| Shape | Judged as |
|---|---|
rm, shred, unlink (with or without -r) with a target containing a variable other than ~/$HOME/$PWD/${NAME:?}, or $(...), backticks, arithmetic | deny, with the ${NAME:?} rewrite |
rm -r/-R/-rf/--recursive TARGET... | whole-path semantics: catastrophic is deny; nested .git within 3 levels is deny |
rm, shred, unlink without -r and a literal path | only "outside the project and not temp" is ask (it cannot remove a directory, so no catastrophic test); a glob is judged by its directory |
find START ... -delete / -exec rm|shred|unlink | start path; with filters (-name, -type, -mtime, ...) the contents of START (a project or temp root passes), otherwise like rm -r START |
xargs rm|shred|unlink (also find ... | xargs) | deny without -0/--null/-d (whitespace splitting); with one of them it passes with a caution |
rsync --delete*, --del, --remove-source-files | the destination's contents / the sources, like rm -r; a remote destination is ask; -n/--dry-run passes |
git clean -f, reset --hard/--merge, checkout -f, switch -f/--discard-changes, checkout/restore of ., a directory, a glob/pathspec or the whole tree (restore without paths), stash drop/clear, branch -D, push --force/+ref/:ref/--delete/--mirror/--prune, worktree remove --force, rm -f, gc --prune=now, reflog expire/delete, filter-branch, filter-repo (not --version/--help/--analyze), update-ref -d | deny, each with the safe alternative (git stash, git diff, --force-with-lease, git clean -n, ask the user) |
python/python3/uv run python -c, node -e, perl -e, ruby -e, and the same code from a heredoc or here-string | delete APIs are scanned, see below |
bash FILE, source FILE, . FILE, ./FILE (shebang), python FILE.py, uv run FILE.py, node FILE.js | the script file is read; only catastrophic literal targets inside it count |
${NAME:?} or denyVariable values are never read (not from the environment, not from an
assignment earlier in the same command: R=/x; rm -rf "$R" is denied too, which
also covers the nested-shell trap where bash -c "R=x; rm -rf $R/" is expanded
by the outer shell). Every expansion in a deletion target must be of the form
${NAME:?} / ${NAME:?message}:
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub rishubil/skills --plugin prevent-unsafe-deletePlugins from other owners that cover similar ground