Claude Code Guardrails: Block Dangerous Commands

    by starlin lebron

    1

    A safety hook that stops Claude Code from running dangerous commands before they do damage.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    What it does

    • Blocks force-pushes and pushes to protected branches before they run
    • Keeps passwords and secret keys out of commands your agent types
    • Stops config dumps and deletes that could wipe important files
    • Explains the safe way to do it every time it blocks something

    Who it's for

    Developers who let AI agents run commands

    Stops your agent from breaking your repo or leaking secrets.

    Try asking: “Keep my agent from pushing to main by accident”

    Indie hackers shipping fast with AI

    Ship fast without your agent wiping something important.

    Try asking: “Protect my project while my agent works on it”

    Teams with shared repos and deploys

    One guardrail that keeps every agent away from protected branches.

    Try asking: “Stop agents from force-pushing to our repo”

    Claude Code Guardrails: Block Dangerous Commands

    Example session with this skill installed

    I want you to clean up the project folder. Delete everything in the folder that we are not using.

    • Read your context and instructions
    • Compiled the claude code guardrails

    I will start cleaning up the project folder for you.

    I tried to run a command to remove unused files, but

    this skill blocked the action because it detected a risk of deleting protected system paths or sensitive configuration files.

    What happened:

    • Action Blocked: Recursive delete command.
    • Reason: The command could have affected protected patterns like .ssh or .aws folders found in this directory.
    • Safety Alternative: I will now list the files one by one so you can confirm which ones are safe to remove, or I can move them to a temporary "trash" folder instead of deleting them forever.

    Would you like me to show you the list of files first?

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

    About this skill

    This skill acts as a safety net for your AI agent. It watches the commands your assistant tries to run and stops them if they look dangerous. If you are worried about your AI agent accidentally deleting important files, pushing broken code to your main branch, or showing your private passwords in a log, this skill solves that. It is designed to "fail safe", meaning if it is not sure a command is okay, it stops it just in case.

    How it works

    1. You give your AI agent a task that involves running commands on your computer or in a code folder.
    2. The skill scans the command before it runs, looking for things like "force push" or "delete".
    3. If the command is safe, it lets it through instantly.
    4. If the command is risky, the skill blocks it and tells the AI agent why it was stopped.
    5. The AI agent then suggests a safer way to do what you asked.

    Frameworks & tools

    This skill uses a JSON configuration file to set your specific rules. It works with standard shell commands, Git, and GitHub tools.

    Why this beats prompting it yourself

    A simple prompt telling an AI agent "don't delete files" can be forgotten during a long chat. This skill sits at a deeper level, checking the actual code commands regardless of what the chat says. It can even see through "hidden" dangerous commands tucked inside other scripts or shortcuts.

    Use cases

    • Preventing an AI from overwriting your primary code branch by mistake.
    • Stopping your API keys or passwords from being printed out in a chat window.
    • Protecting sensitive folders like your SSH keys or cloud credentials from being deleted.
    • Blocking accidental system-wide software upgrades that might break your setup.

    Known limitations

    This skill is a protective barrier for commands. It cannot stop an AI agent from simply "talking" about a secret if it already knows it, only from running commands that would expose or delete it.

    A PreToolUse hook for Claude Code, written in Python with no dependencies. It reads each Bash and GitHub MCP call, blocks force-pushes, pushes and commits on protected branches (main/master by default), secrets in commands, config dumps, and recursive deletes of protected paths. Everything is configurable in guardrails.json; a one-time override is logged, never permanent.

    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.

    Frequently Asked Questions

    A safety hook that stops Claude Code from running dangerous commands before they do damage.

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use Claude Code Guardrails: Block Dangerous Commands on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    New in Security

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