guard

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

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/Simon-YHKim/eject-button --skill guard-simon-yhkim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/Simon-YHKim/eject-button/tree/main/.claude/skills/guard
Command: npx skills add https://github.com/Simon-YHKim/eject-button --skill guard-simon-yhkim

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 accidental edit outside the intended directory can cause serious damage. Guard mode activates two layers of protection at once so risky operations are caught before they execute. ## Core Features & Use Cases - Destructive Command Warnings: Intercepts dangerous Bash commands like rm -rf, DROP TABLE, and force-push, warning you before execution with the option to override. - Directory-Scoped Edit Lock: Blocks Edit and Write operations on any file outside a directory you specify, enforced via PreToolUse hooks. - Combined Activation: Merges the /careful and /freeze skills into a single command for full safety coverage. - Use Case: You are hotfixing a bug in a live repository. Activate guard mode, restrict edits to the src/ directory, and any attempt to modify config files elsewhere or run a destructive cleanup command will be flagged or blocked. ## Quick Start Ask the AI to activate guard mode and restrict edits to your working directory, for example: turn on 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 edits outside a specific directory in Claude Code?

Activate guard mode and provide a 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 every command against destructive patterns such as rm -rf, DROP TABLE, and force-push. Matching commands trigger a warning before execution, and you can choose to override.

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 activating guard mode?

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

Can I override a destructive command warning in guard mode?

Yes. Destructive command checks produce warnings rather than hard blocks, so you can confirm and proceed. The edit boundary, by contrast, is a hard block on files outside the frozen directory.