# Guard: Full Safety Mode (guard)

> Turns on destructive-command warnings and a directory-scoped edit boundary together, combining /careful and /freeze in one command.

- Category: [Hardening](https://www.myskills.tools/en/categories/hardening/)
- Source: Community · Garry Tan
- Repository: https://github.com/garrytan/gstack/tree/main/guard (commit 6237994 · v0.1.0)
- SKILL.md: https://github.com/garrytan/gstack/blob/main/guard/SKILL.md
- Install command: `npx skills add garrytan/gstack --skill guard`
- License: MIT
- Compatible with: Claude Code, Codex, Cursor, Copilot
- Permissions: read-repo ✓, write-files ✗, shell ✓, network ✗
- Status: Scan passed
- A rule scan cannot catch every risk. Read this skill's SKILL.md and check its permissions before installing.
- ⚠ 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.

## 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

1. **Ask for a directory** — Ask the user, via an AskUserQuestion text input, which directory edits should be restricted to.
2. **Set the edit boundary** — Set the path with the shared freeze-state.sh set helper; on failure, preserve the state and report how to recover.
3. **Confirm 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)

```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..."
---
```

Home: https://www.myskills.tools/en/ · URL: https://www.myskills.tools/en/skills/guard/
