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 Adonis0123MITIn 1 marketplace
Stops an agent's shell commands from permanently deleting files, denying recursive rm and git reset --hard outside temp directories. A PreToolUse hook on every Bash call denies such commands and points the agent to the trash; it is an accident guard, not a sandbox.
Trending plugins
7-day copy clicks
Run automatically on Claude Code events. Claude doesn't decide.
1 caution to review before installing
A hook runs when Claude uses the Bash tool
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.
English | 中文
A hook plugin for Claude Code and Codex that denies shell commands which delete files an agent cannot get back, and points the agent to the trash instead.
You run the agent with full permissions so it does not stop to ask. If it then deletes the wrong directory with rm -rf, the files are gone for good. A file moved to the trash can still be restored.
It guards against accidents only. It is not a sandbox: eval of a variable, a Python or Node one-liner that deletes files, and anything else it cannot read statically still run.
cc-safety-net covers similar ground, but two gaps mattered here:
find . -name "*.bak" -exec rm {} \;. delete-guard denies it.trash, trash-put or gio trash depending on the system.A PreToolUse hook on the Bash tool runs scripts/delete-guard.py before every shell command. The script parses the command the way a shell would and checks each part:
; && || | & and newlines split commands; $(...), backticks, unquoted heredoc bodies and the string given to bash -c / sh -c / zsh -c / eval are checked too.cd X && …, env -C, sudo -D)./tmp, /private/tmp, /var/folders, /private/var/folders or $TMPDIR. A target it cannot resolve (a variable, brace expansion, xargs input) counts as outside.Every error, missing field or non-shell tool allows the call (exit 0, no output). Standard library only, no network, no model call.
| Command | Result |
|---|---|
rm -rf src/old | Denied: suggests the trash command |
find . -name "*.bak" -exec rm {} \; | Denied: suggests the trash command |
git reset --hard, git clean -fd | Denied: suggests git stash first |
rm -rf /tmp/build | Allowed: inside a temp directory |
trash src/old, rm a.txt | Allowed: recoverable or not recursive |
Also denied: every spelling of recursive rm (-R, --recursive, /bin/rm, sudo rm, xargs rm -r), find -delete, git checkout -- <path>, git checkout ., git restore without --staged, git stash drop and git stash clear.
Every reason opens with [delete-guard] and is written in Chinese. On macOS, for rm -rf src/old (it says the command recursively deletes a path outside the temp directories, which cannot be recovered, and to use trash <路径> instead):
[delete-guard] 这条命令会递归删除临时目录以外的路径(src/old),删了找不回。改用 `trash <路径>`,删进废纸篓可找回。(目前只为 macOS 和 Linux(含 WSL)给出替代命令,其他系统欢迎提 PR:https://github.com/Adonis0123/adonis-skills)
The suggested command depends on the system:
| System | Suggestion |
|---|---|
| macOS | trash <path> (built into recent macOS) |
| Linux, including WSL | trash-put <path> (trash-cli) when it exists, else gio trash <path> |
| No trash command found | mv <path> /tmp/ to move it into a temp directory, or ask the user to delete it |
For git commands the reason says to save changes with git stash first, or ask the user to confirm.
Claude Code (2.1.292 or later), one command:
claude plugin install delete-guard --marketplace Adonis0123/adonis-skills
Codex:
codex plugin marketplace add Adonis0123/adonis-skills
codex plugin add delete-guard@adonis-skills
Codex skips plugin hooks until you trust them: open Codex, run /hooks and trust delete-guard's hook. Codex asks again after the script changes.
Requires python3 on PATH. Supports macOS, Linux and WSL; native Windows is not supported.
| Variable | Meaning |
|---|---|
DELETE_GUARD=0 | Turn the guard off entirely. |
claude plugin disable delete-guard@adonis-skills
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 adonis0123/adonis-skills --plugin delete-guardPlugins from other owners that cover similar ground