guard

Blocks destructive bash commands and restricts file edits to a specified directory.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/bobbo01/B2BPlatform --skill guard-bobbo01
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/bobbo01/B2BPlatform/tree/main/.agents/skills/gstack-guard
Command: npx skills add https://github.com/bobbo01/B2BPlatform --skill guard-bobbo01

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When working on production systems or live environments, a single destructive command (rm -rf, DROP TABLE, force-push) or an edit outside the intended scope can cause serious damage. This Skill combines two safety layers so risky operations are intercepted before they execute. ## Core Features & Use Cases - Destructive Command Warnings: PreToolUse hooks scan every Bash command for dangerous patterns like rm -rf, DROP TABLE, force-push, and git reset --hard, warning before execution. - Directory-Scoped Edit Boundary: Edit and Write operations are blocked outside a user-specified directory, enforced via a freeze state file. - Use Case: While debugging a live production checkout flow, activate guard mode with the boundary set to the payment module directory so no command can wipe data and no edit can touch unrelated services. ## Quick Start Ask the assistant to activate guard mode and restrict edits to your target directory, for example: enable guard mode and lock edits to the src/payments folder.

Frequently Asked Questions about guard

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

FAQPage Schema
How do I block destructive commands like rm -rf in Claude Code?

Activate guard mode, which registers a PreToolUse hook on Bash that scans every command for destructive patterns such as rm -rf, DROP TABLE, force-push, and git reset --hard. You receive a warning before execution and can override if needed.

How do I restrict file edits to a specific directory?

Guard mode asks which directory to restrict edits to, resolves it to an absolute path, and saves it to a freeze state file. PreToolUse hooks on Edit and Write then block any change outside that boundary until you run /unfreeze.

Does guard mode require other skills to be installed?

Yes. Guard references hook scripts from the sibling /careful and /freeze skill directories, so both must be installed. They are installed together by the gstack setup script.

Can I override a destructive command warning?

Yes. Destructive command checks produce a warning rather than a hard block, so you can confirm and proceed. The edit boundary, however, blocks edits outside the frozen directory until you run /unfreeze or end the session.

How do I turn off guard mode?

Run /unfreeze to remove the edit boundary restriction. To deactivate everything, end the session, since the destructive command warnings are tied to the active session hooks.