Catalog
garrytan/guard

garrytan

guard

Full safety mode: destructive command warnings + directory-scoped edits. (gstack)

global
Allowed Tools
BashReadAskUserQuestion
New~627
v1.0Saved Jul 12, 2026

When to invoke this skill

Combines /careful (warns before rm -rf, DROP TABLE, force-push, etc.) with /freeze (blocks edits outside a specified directory). Use for maximum safety when touching prod or debugging live systems. Use when asked to "guard mode", "full safety", "lock it down", or "maximum safety".

/guard — Full Safety Mode

Activates both destructive command warnings and directory-scoped edit restrictions. This is the combination of /careful + /freeze in a single command.

Dependency note: This skill references hook scripts from the sibling /careful and /freeze skill directories. Both must be installed (they are installed together by the gstack setup script).

mkdir -p ~/.gstack/analytics
echo '{"skill":"guard","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}'  >> ~/.gstack/analytics/skill-usage.jsonl 2>/dev/null || true

Setup

Ask the user which directory to restrict edits to. Use AskUserQuestion:

  • Question: "Guard mode: which directory should edits be restricted to? Destructive command warnings are always on. Files outside the chosen path will be blocked from editing."
  • Text input (not multiple choice) — the user types a path.

Once the user provides a directory path:

  1. Resolve it to an absolute path:
FREEZE_DIR=$(cd "<user-provided-path>" 2>/dev/null && pwd)
echo "$FREEZE_DIR"
  1. Ensure trailing slash and save to the freeze state file:
FREEZE_DIR="${FREEZE_DIR%/}/"
eval "$(~/.claude/skills/gstack/bin/gstack-paths)"
STATE_DIR="$GSTACK_STATE_ROOT"
mkdir -p "$STATE_DIR"
echo "$FREEZE_DIR" > "$STATE_DIR/freeze-dir.txt"
echo "Freeze boundary set: $FREEZE_DIR"

Tell the user:

  • "Guard mode active. Two protections are now running:"
  • "1. Destructive command warnings — rm -rf, DROP TABLE, force-push, etc. will warn before executing (you can override)"
  • "2. Edit boundary — file edits restricted to <path>/. Edits outside this directory are blocked."
  • "To remove the edit boundary, run /unfreeze. To deactivate everything, end the session."

What's protected

See /careful for the full list of destructive command patterns and safe exceptions. See /freeze for how edit boundary enforcement works.

Files1
1 files · 1.0 KB

Select a file to preview

Overall Score

72/100

Grade

B

Good

Safety

75

Quality

68

Clarity

80

Completeness

65

Summary

The `/guard` skill activates a combined safety mode that warns before destructive shell commands (like `rm -rf`) and restricts file edits to a user-specified directory boundary. It integrates hook scripts from sibling `/careful` and `/freeze` skills to implement these protections, working as an intentional safety guardrail for high-risk operations on production or live systems.

Static Analysis Findings

2 findings

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Destructive Operation
SEC-001Recursive Deletion2x in 1 fileMax: B

Recursive deletion pattern (rm -rf)

SKILL.mdrm -rf2x
Command Injection
SEC-011Dynamic Shell Eval

Shell eval/exec of dynamic content

SKILL.mdeval "

Detected Capabilities

shell executionhook command executionfile readuser interactionbash script executionstate file management

Trigger Keywords

Phrases that MCP clients use to match this skill to user intent.

guard modefull safety modelock it downdestructive command warningsedit boundaryproduction safety

Risk Signals

INFO

rm -rf usage in documentation and hook context

SKILL.md | lines mentioning destructive commands
WARNING

Shell eval of dynamic content with user-provided path

SKILL.md | 'eval "$(~/.claude/skills/gstack/bin/gstack-paths)"'
INFO

Hook commands invoke external bash scripts at fixed paths

SKILL.md | PreToolUse hooks reference ~/.claude/skills/gstack/*/bin/check-*.sh

Use Cases

  • Protect against accidental destructive commands in production environments
  • Restrict edits to a safe working directory during sensitive operations
  • Combine destructive command warnings with edit scope boundaries in one activation
  • Debug live systems safely with warnings before dangerous operations
  • Lock down an agent session to maximum safety constraints

Quality Notes

  • Skill has clear purpose and well-documented security intent — it is intentionally restrictive, not permissive
  • Dependency on sibling skills (/careful, /freeze) is documented but those scripts are not included — completeness risk
  • Setup section is clear and asks user for input before restricting scope — good UX boundary
  • Hook system is well-structured with status messages for transparency
  • No error handling documented for cases where hook scripts are missing or fail
  • Edge case not addressed: behavior when user provides invalid or inaccessible directory path
  • State file persistence documented but no cleanup instructions for /unfreeze or session exit
Model: claude-haiku-4-5-20251001Analyzed: Jul 12, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Use garrytan/guard in your dev environment

Command Palette

Search for a command to run...