# Claude Code Guardrails: Block Dangerous Commands

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

Claude Code Guardrails: Block Dangerous Commands is a paid AI agent skill on Agensi by starlin lebron, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [starlin lebron](https://www.agensi.io/creators/starlin-lebron)
- Category: [Security](https://www.agensi.io/skills/security)
- Version: 1.0
- Last updated: 2026-12-06
- Security: scan passed (2026-12-06); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/claude-code-guardrails-block-dangerous-commands
- Tags: claude-code, git-safety, security

## 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: "Keep my agent from pushing to main by accident"
- **Indie hackers shipping fast with AI:** Ship fast without your agent wiping something important. Try: "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: "Stop agents from force-pushing to our repo"

## 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.

## Requires

- Git

## Technical details

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 this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Claude Code Guardrails: Block Dangerous Commands skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What does Claude Code Guardrails: Block Dangerous Commands do?

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

### Which AI agents support Claude Code Guardrails: Block Dangerous Commands?

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.

### How do I use Claude Code Guardrails: Block Dangerous Commands?

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.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
