guard

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

107|7|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/no-session/pstack --skill guard-no-session
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/no-session/pstack/tree/main/guard
Command: npx skills add https://github.com/no-session/pstack --skill guard-no-session

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 you can work with reduced risk. ## Core Features & Use Cases - Destructive Command Warnings: Intercepts dangerous Bash commands like rm -rf, DROP TABLE, and force-push before execution, warning you first (with override option). - Directory-Scoped Edit Boundary: Blocks Edit and Write operations outside a directory you specify, 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 in a live production repo. Activate guard mode scoped to the service directory so accidental edits elsewhere are blocked and any destructive shell command triggers a warning first. ## Quick Start Ask the AI to activate guard mode and restrict edits to your project 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 file edits outside a specific directory?

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 Edit and Write operations targeting files outside that boundary.

How do I get warnings before running destructive shell commands?

Guard mode hooks into Bash tool calls and checks commands against destructive patterns like rm -rf, DROP TABLE, and force-push before execution. You receive a warning and can choose to override it.

Does guard mode require other skills to be installed?

Yes. Guard depends on hook scripts from the sibling careful and freeze skill directories. Both must be installed, which the pstack 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.

Can I override a destructive command warning in guard mode?

Yes. Destructive command warnings are advisory and can be overridden by the user. However, edits outside the freeze boundary are hard-blocked until you run /unfreeze or end the session.