guard

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

Updated May 15, 2026
One-click install
npx skills add https://github.com/tgmarinho/canetaco --skill guard-tgmarinho
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/tgmarinho/canetaco/tree/main/.claude/skills/guard
Command: npx skills add https://github.com/tgmarinho/canetaco --skill guard-tgmarinho

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 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) and warns before execution, with the option to override. - Directory-Scoped Edit Boundary: Blocks Edit and Write operations outside a user-specified directory, enforced via PreToolUse hooks. - Combined Activation: Merges the /careful and /freeze skills into a single command for maximum safety in one step. - Use Case: You are hotfixing a bug in a live repository and only want changes inside the app/api/ folder. Activate guard mode, set the boundary to app/api/, and any accidental edit elsewhere is blocked while dangerous shell commands trigger a warning. ## Quick Start Ask the AI to activate guard mode and restrict edits to a specific directory such as src/.

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 commands 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 it.

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, so both must be installed. They are installed together by the gstack setup script.

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

Run /unfreeze to remove the directory edit boundary while keeping the session active. To deactivate all protections entirely, end the session.

Can I override a destructive command warning in guard mode?

Yes. Destructive command warnings are advisory and can be overridden by the user. The edit boundary, however, is a hard block on files outside the frozen directory until /unfreeze is run.