Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Destructive Command Guard — Block rm -rf and Force Push

    1

    "Please don't run destructive commands" in CLAUDE.md is a request.

    $18

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Destructive Command Guard — Block rm -rf and Force Push

    Destructive Command Guard — Block rm -rf and Force Push

    Example session with this skill installed

    Check whether these commands would be blocked by the guard before I let the agent run them: git push --force origin main, git push --force-with-lease, rm -rf node_modules, rm -rf /projects, git reset --hard HEAD3

    • Read your context and instructions
    • Compiled the destructive command guard

    Summary

    3 of the 5 commands would be blocked, 2 would run normally.

    Result

    $ python3 scripts/destructive_command_guard.py --check "git push --force origin main"
    BLOCK git-push-force: force push rewrites remote history (--force-with-lease is allowed)
    $ python3 scripts/destructive_command_guard.py --check "git push --force-with-lease"
    ALLOW
    $ python3 scripts/destructive_command_guard.py --check "rm -rf node_modules"
    ALLOW
    $ python3 scripts/destructive_command_guard.py --check "rm -rf ~/projects"
    BLOCK rm-recursive: recursive delete (rm -r / -rf) outside a short list of build folders
    $ python3 scripts/destructive_command_guard.py --check "git reset --hard HEAD~3"
    BLOCK git-reset-hard: git reset --hard throws away uncommitted work and moves the branch
    
    CommandVerdictRule
    git push --force origin mainBLOCKgit-push-force
    git push --force-with-leaseALLOW—
    rm -rf node_modulesALLOWbuild folder on the safe list
    rm -rf ~/projectsBLOCKrm-recursive
    git reset --hard HEAD~3BLOCKgit-reset-hard

    Next steps

    1. Add the hook to .claude/settings.json using examples/settings.json as the template.
    2. Use --list to read every rule, and the optional JSON config to allow a rule id or an exact command.
    3. Start in warn-only mode if you want to see what it would block before it blocks anything.

    Note: it judges the text of the command, not the script the command runs.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    "Please don't run destructive commands" in CLAUDE.md is a request. The agent follows it when it remembers.

    Destructive Command Guard turns it into a wall. It is a single-file PreToolUse hook: before the Bash tool runs anything, the hook reads the command, and if it would destroy data you cannot easily get back, the command never starts and Claude is told which rule stopped it.

    $ python3 scripts/destructive_command_guard.py --check "git push --force origin main"
    BLOCK git-push-force: force push rewrites remote history (--force-with-lease is allowed)
    $ python3 scripts/destructive_command_guard.py --check "git push --force-with-lease"
    ALLOW
    $ python3 scripts/destructive_command_guard.py --check "rm -rf node_modules"
    ALLOW
    $ python3 scripts/destructive_command_guard.py --check "rm -rf ~/projects"
    BLOCK rm-recursive: recursive delete (rm -r / -rf) outside a short list of build folders
    

    What it does

    • Blocks 21 kinds of command: recursive deletes, force push, hard reset, git clean, discarding local edits, force-deleting branches, dropping stashes, rewriting history, DROP TABLE/DATABASE, DELETE without WHERE, docker prune and volume deletes, bulk kubectl deletes, writes to disks, curl piped into a shell, shutdown, fork bombs
    • Parses the command instead of grepping it: &&, ;, pipes, sudo, VAR=1 prefixes, xargs, bash -c "...", eval and $(...) are all looked into, and text inside quotes is not mistaken for a command
    • Stays out of your way: rm -rf node_modules, rm -rf /tmp/work, git push --force-with-lease, git clean -n and DELETE ... WHERE pass
    • Optional JSON config: allow rule ids, allow exact command patterns, add safe rm -r folders, warn-only mode, a decision log that never stores the command text
    • --check lets you try any command without running it; --list prints every rule

    Honest limits, stated in the README: it judges the text of the command. It does not open a script that the command runs, and it only sees the Bash tool. It is a safety net, not a sandbox.

    What is inside

    • SKILL.md, README.md, LICENSE
    • scripts/destructive_command_guard.py
    • tests/test_guard.py (26 tests)
    • examples/settings.json and examples/destructive-guard.json

    Requirements and safety

    Python 3.8+, macOS or Linux, standard library only. The hook never runs the command it inspects, makes no network calls, and needs no credentials.

    License

    Personal, non-transferable license for your own projects, including commercial work. No resale or redistribution.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.

    Only inspects command text, not the contents of scripts being called. Only monitors the Bash tool. Requires Python 3.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 5 days ago

    Software
    Python 3.8+Git

    Permissions

    Terminal / Shell
    Network Access
    Read Files
    Environment Variables
    Listed5 days ago

    What's inside

    Frequently Asked Questions

    A line in CLAUDE.md is a request the agent follows when it remembers. This is a PreToolUse hook that reads each Bash command before it runs. A blocked command never starts, and Claude is told which rule stopped it.

    It is a Claude Code hook for the Bash tool, registered with a hook entry in .claude/settings.json. The package follows the SKILL.md format, but the hook itself is built for Claude Code.

    Yes. An optional JSON config lets you allow rule ids, allow exact command patterns, add safe rm -r folders, switch to warn-only mode, and keep a decision log that never stores the command text.

    Copy the script into your project and add the hook entry from examples/settings.json to .claude/settings.json. You can test any command first with --check "<command>", and --list prints every rule. It needs Python 3.8+.

    SKILL.md, README.md, LICENSE, scripts/destructive_command_guard.py, 26 tests, and examples/settings.json and examples/destructive-guard.json. Personal, non-transferable license for your own projects, including commercial work; no resale or redistribution.

    It judges the text of the command. It does not open a script that the command runs, and it only sees the Bash tool. It is a safety net, not a sandbox.

    New in Testing & Debugging