guard

Combines destructive command warnings with directory-scoped edit restrictions for maximum safety.

2|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/westkite1201/garden-engine --skill guard-westkite1201
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/westkite1201/garden-engine/tree/main/.claude/skills/gstack/guard
Command: npx skills add https://github.com/westkite1201/garden-engine --skill guard-westkite1201

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When working on production systems or debugging live environments, a single destructive command (like rm -rf or DROP TABLE) or an accidental edit outside the intended directory can cause serious damage. Guard mode activates two layers of protection simultaneously so risky operations are caught before they execute. ## Core Features & Use Cases - Destructive Command Warnings: Intercepts dangerous Bash commands such as rm -rf, DROP TABLE, and force-push, warning you before execution with the option to override. - Directory-Scoped Edit Boundary: Blocks Edit and Write operations on files outside a directory you specify, enforced via PreToolUse hooks. - Combined Safety Mode: Merges the /careful and /freeze skills into a single activation, ideal for touching production configs or debugging live systems. - Use Case: You are hotfixing a config file in a deployed service. Activate guard mode, restrict edits to the service's config directory, and any accidental force-push or edit outside that path is blocked or flagged. ## Quick Start Ask the AI to activate guard mode and restrict edits to your target directory, for example: turn on guard mode and lock edits to the src/config folder.

Frequently Asked Questions about guard

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

FAQPage Schema
How do I block edits outside a specific directory in Claude Code?

Activate guard mode and provide a target directory path when prompted. The skill resolves it to an absolute path, saves it to a freeze state file, and PreToolUse hooks then block any Edit or Write operation targeting files outside that boundary.

How do I get warnings before running destructive commands like rm -rf?

Guard mode registers a PreToolUse hook on Bash that checks commands against destructive patterns such as rm -rf, DROP TABLE, and force-push. You receive a warning before execution and can choose to override it.

What is the difference between guard, careful, and freeze modes?

Guard is the combination of careful and freeze in a single command. Careful only warns about destructive Bash commands, freeze only restricts edits to a directory, and guard runs both protections simultaneously.

Does guard mode require other skills to be installed?

Yes, guard references hook scripts from the sibling careful and freeze skill directories. Both must be installed, which happens automatically through the gstack setup script.

How do I turn off the edit boundary after activating guard mode?

Run the /unfreeze command to remove the directory edit boundary. To deactivate all protections entirely, end the current session, since the destructive command warnings are session-scoped.