guard

Combines destructive command warnings with directory-scoped edit restrictions for safer sessions.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/LGJ-Jonathan/Jonathan_Global_Claude_Skills --skill guard-lgj-jonathan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/LGJ-Jonathan/Jonathan_Global_Claude_Skills/tree/main/gstack/guard
Command: npx skills add https://github.com/LGJ-Jonathan/Jonathan_Global_Claude_Skills --skill guard-lgj-jonathan

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 Bash commands matching dangerous patterns (rm -rf, DROP TABLE, force-push, etc.) and warns before execution, with the option to override. - Directory-Scoped Edit Boundary: Blocks Edit and Write operations on files outside a user-specified directory, enforced via PreToolUse hooks. - Combined Activation: Merges the /careful and /freeze skills into a single command for maximum safety. - Use Case: You are hotfixing a bug directly on a production server. Activate guard mode, restrict edits to the application directory, and get warned before any destructive shell command runs. ## Quick Start Ask the AI to activate guard mode and restrict edits to your project directory, for example: "Enable guard mode and lock edits to /srv/myapp."

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?▼

Guard mode restricts edits by saving an absolute directory path to a freeze state file, then a PreToolUse hook checks every Edit and Write call against that boundary. Files outside the chosen path are blocked from modification.

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

Guard mode registers a PreToolUse hook on Bash that runs a check script against each command. Commands matching destructive patterns such as rm -rf, DROP TABLE, or force-push trigger a warning before execution, and you can choose to override.

Does guard mode require other skills to be installed?▼

Yes, guard depends on the sibling careful and freeze skill directories for its hook scripts. Both are installed together by the gstack setup script, so a standard gstack installation satisfies the dependency.

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 destructive command warnings are session-scoped.

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

Yes, destructive command warnings are advisory rather than hard blocks. When a dangerous command is detected you are prompted and can choose to proceed, while the edit boundary remains a hard block for files outside the frozen directory.