guard

Blocks destructive shell commands and restricts file edits to a chosen directory.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/VertaKhan/cs_gstack --skill guard-vertakhan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/VertaKhan/cs_gstack/tree/main/.claude/skills/gstack/guard
Command: npx skills add https://github.com/VertaKhan/cs_gstack --skill guard-vertakhan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When working on production systems or debugging live environments, a single destructive command (rm -rf, DROP TABLE, force-push) or an edit to the wrong file can cause serious damage. Guard mode 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, and force-push, warning before execution with an option to override. - Directory-Scoped Edit Boundary: Edit and Write operations are blocked outside a user-specified directory, enforced via a freeze state file. - Use Case: While hotfixing a production repository, activate guard mode and restrict edits to the src/hotfix/ directory. Any accidental edit outside that path is blocked, and any destructive shell command triggers a confirmation warning. ## Quick Start Ask the AI to activate guard mode and restrict edits to your target directory, for example: enable guard mode and lock edits to the src 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 that scans every Bash command for destructive patterns such as rm -rf, DROP TABLE, and force-push. Matching commands trigger a warning before execution, and you can choose to override.

How to restrict file edits to a specific directory in a coding session?▼

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 file modification outside that boundary.

Does guard mode work without the careful and freeze skills installed?▼

No. Guard mode references hook scripts from the sibling careful and freeze skill directories via check-careful.sh and check-freeze.sh. Both must be installed, which the gstack setup script handles automatically.

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

Run the /unfreeze command to remove the directory edit boundary. Destructive command warnings remain active for the session; ending the session deactivates everything.

Can I override a destructive command warning in guard mode?▼

Yes. Destructive command checks produce a warning rather than a hard block, so you can confirm and proceed. Edit boundary violations outside the frozen directory are blocked outright until you run /unfreeze.