guard

Block destructive shell commands and restrict file edits to a specified directory.

9|1|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/CarbeneAI/Forge --skill guard-carbeneai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/CarbeneAI/Forge/tree/main/.claude/skills/guard
Command: npx skills add https://github.com/CarbeneAI/Forge --skill guard-carbeneai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guard mode prevents accidental destructive operations and unauthorized edits by combining destructive-command warnings with directory-scoped edit restrictions to protect production and live systems from harmful changes.

Core Features & Use Cases

  • Destructive command warnings: Preflight checks intercept dangerous shell commands such as rm -rf, DROP TABLE, and force-push to prompt for confirmation before execution.
  • Directory-scoped edit boundary: Enforces an edit freeze so file writes and edits are limited to a user-specified directory, blocking modifications outside the boundary.
  • Hook-based enforcement: Runs PreToolUse hooks for Bash, Edit, and Write actions and delegates checks to sibling scripts like check-careful.sh and check-freeze.sh.
  • Use Case: Enable guard mode when debugging or performing maintenance on production servers so agents can run diagnostics without risking widespread data loss or accidental deployments.

Quick Start

Activate guard mode and restrict edits to the desired directory by asking the assistant to activate guard and providing the absolute path to freeze.

Frequently Asked Questions about guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent accidental destructive shell commands during production maintenance?

Preventing destructive shell commands during production maintenance requires preflight checks that intercept dangerous operations like rm -rf or force-push and prompt for confirmation before execution. This mechanism blocks harmful changes before they happen.

How do I restrict file edits to a specific directory boundary?

To restrict file edits to a specific directory boundary, enforce an edit freeze that limits file writes and modifications to a user-specified absolute path. This blocks any unauthorized modifications outside the defined boundary.

What is a PreToolUse hook for Bash and file write operations?

A PreToolUse hook for Bash and file write operations is a script that runs before tool execution to validate actions. It delegates checks to sibling scripts to enforce policies like directory-scoped edit restrictions and destructive command warnings.

How do I activate guard mode for debugging on live servers?

Activating guard mode for debugging on live servers requires instructing the assistant to activate guard and providing the absolute path of the directory to freeze. This restricts edits and warns against destructive commands in that environment.

Does this destructive command protection work with force-push and database drops?

Yes, destructive command protection works with force-push and database drops by intercepting dangerous shell commands like DROP TABLE and git force-push. It performs preflight checks to prompt for confirmation before execution.

What are the limitations of using hook scripts for edit boundary enforcement?

Limitations of using hook scripts for edit boundary enforcement include the requirement to manually specify a freeze directory via user input. Protection is limited to Bash, edit, and write operations within that defined boundary.