guardcommit 6237994 · v0.1.0SKILL.md · Hardening
Guard: Full Safety Mode
Turns on destructive-command warnings and a directory-scoped edit boundary together, combining /careful and /freeze in one command.
Registers hooks that block edits outside a directory; the boundary persists after the session until /unfreeze, and usage is logged to a local gstack analytics file.
npx skills add garrytan/gstack --skill guardCommand selected. Copy it manually.
- Permissions
- read-repo
- write-files
- shell
- network
- Compatible with
- Claude Code, Codex, Cursor, Copilot
- GitHub
- 138.5k
- Source
- Community · Garry Tan
- Status
- Scan passed
- License
- MIT
- Category
- Hardening
- Repository
- github.com/garrytan/gstack/guard
Core rule
If the boundary helper fails, never claim the boundary is active and never bypass the shared writer with a direct write or deletion.
Execution Phases
Phase 01Ask for a directory
Ask the user, via an AskUserQuestion text input, which directory edits should be restricted to.
Phase 02Set the edit boundary
Set the path with the shared freeze-state.sh set helper; on failure, preserve the state and report how to recover.
Phase 03Confirm both protections
Tell the user that commands like rm -rf or force-push warn first (catastrophic ones are denied) and edits outside the path are blocked until /unfreeze.
Permissions (summarised from SKILL.md)
| Capability | Needed | Details |
|---|---|---|
| File writes | Not required | allowed-tools has no Write or Edit; the skill instead uses hooks to block file edits outside the boundary. |
| Command execution | Limited | Only runs gstack helpers such as freeze-state.sh, with hooks checking commands for destructive patterns. |
| Network outbound | Not required | No network access is needed. |
SKILL.md frontmatter (YAML)
---
name: guard
version: 0.1.0
description: "Full safety mode: destructive command warnings + directory-scoped edits. (gstack)"
triggers:
- full safety mode
- guard against mistakes
- maximum safety
allowed-tools:
- Bash
- Read
- AskUserQuestion
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: 'bash -c "exec bash \"$HOME/.claude/skills/gstack/careful/bin/check-careful.sh\""'
statusMessage: "Checking for destructive commands..."
- matcher: "PowerShell"
hooks:
- type: command
command: 'bash -c "exec bash \"$HOME/.claude/skills/gstack/careful/bin/check-careful.sh\""'
statusMessage: "Checking for destructive commands..."
- matcher: "Edit"
hooks:
- type: command
command: 'bash -c "exec bash \"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\""'
statusMessage: "Checking freeze boundary..."
- matcher: "Write"
hooks:
- type: command
command: 'bash -c "exec bash \"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\""'
statusMessage: "Checking freeze boundary..."
- matcher: "NotebookEdit"
hooks:
- type: command
command: 'bash -c "exec bash \"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\""'
statusMessage: "Checking freeze boundary..."
---