guard

Warn before destructive commands and restrict edits to a user-defined directory.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/binfen1/my-skills --skill guard-binfen1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/binfen1/my-skills/tree/main/claude-code/guard
Command: npx skills add https://github.com/binfen1/my-skills --skill guard-binfen1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforces strong safety controls to prevent destructive system changes by issuing warnings for dangerous commands and by restricting edits to a user-defined directory, reducing the risk of accidental damage during maintenance or debugging.

Core Features & Use Cases

  • Destructive command warnings: warns before executing commands like rm -rf, DROP TABLE, or force-push when within sensitive environments.
  • Edit boundary enforcement: blocks edits outside a specified directory, ensuring changes are contained within a safe scope.
  • Unified safety workflow: integrates with sibling safety tools (/careful and /freeze) to provide end-to-end protection during critical operations.
  • Configurable via interactive prompts: asks the user for the target directory to constrain edits to and stores the boundary for the session.

Quick Start

Ask the user which directory should edits be restricted to and then run guard mode to enable both protections.

Frequently Asked Questions about guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent accidental destructive bash commands during production maintenance?

You can warn on destructive commands like rm -rf or force-push by enabling a PreToolUse hook that checks bash inputs against sensitive patterns. It issues warnings before execution and enforces a directory-bound editing policy to restrict changes to a safe scope.

Can I restrict file edits to a specific directory boundary during live environment debugging?

Yes, restricting edits to a specific directory boundary is supported during live environment debugging. The tool uses interactive AskUserQuestion prompts to set the target directory, then blocks any modifications outside that defined path for the session.

What do I need to set up before using directory-bound editing protection?

Before using directory-bound editing protection, you need the optional sibling safety tools (/careful and /freeze) installed. You then specify the target directory through interactive prompts to activate the session boundary.

How does the guard mode integrate with careful and freeze scripts for system protection?

Guard mode integrates with careful and freeze scripts through a PreToolUse hook using bash-based checks. This unified safety workflow provides end-to-end protection by issuing destructive warnings and halting unsafe system changes during critical operations.

Are there limitations when relying on bash checks to block unsafe system changes?

A limitation of relying on bash checks to block unsafe system changes is that protections depend on the PreToolUse hook correctly identifying dangerous commands. Users must also manually define the edit boundary, as enforcement is scoped only to the specified directory.