agentleFS
gufrancogufranco/claude-engineering-rules/skills/guard/SKILL.md

guard

Skill3 starsChanged 31 days agoMITView on GitHub

Safety mode for risky operations that freezes edits to one directory, warns on destructive commands, and enforces scope.

52 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use unfreeze, plan-tune and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ayudaySkill

    unfreeze

    Clear the freeze boundary set by /freeze, allowing edits to all directories again. Use when you want to widen edit scope without ending the session. Use when asked to "unfreeze", "unlock edits", "remove freeze", or "allow all edits".

    Also in 24 projects that use this

  • ShreyRaviSkill

    plan-tune

    Self-tuning question sensitivity + developer psychographic for gstack (v1: observational). Review which AskUserQuestion prompts fire across gstack skills, set per-question preferences (never-ask / always-ask / ask-only-for-one-way), inspect the dual-track profile (what you declared vs what your behavior suggests), and enable/disable question tuning. Conversational interface — no CLI syntax required.

    Also in 9 projects that use this

  • Saqlain-811Skill

    ios-clean

    Remove the DebugBridge SPM package and all #if DEBUG wiring from an iOS app. (gstack)

    Also in 5 projects that use this

  • Saqlain-811Skill

    ios-fix

    Autonomous iOS bug fixer. (gstack)

    Also in 5 projects that use this

  • seek888Skill

    open-gstack-browser

    Launch GStack Browser — AI-controlled Chromium with the sidebar extension baked in. Opens a visible browser window where you can watch every action in real time. The sidebar shows a live activity feed and chat. Anti-bot stealth built in. Use when asked to "open gstack browser", "launch browser", "connect chrome", "open chrome", "real browser", "launch chrome", "side panel", or "control my browser". Voice triggers (speech-to-text aliases): "show me the browser".

    Also in 9 projects that use this

  • ayudaySkill

    setup-deploy

    Configure deployment settings for /land-and-deploy. Detects your deploy platform (Fly.io, Render, Vercel, Netlify, Heroku, GitHub Actions, custom), production URL, health check endpoints, and deploy status commands. Writes the configuration to CLAUDE.md so all future deploys are automatic. Use when: "setup deploy", "configure deployment", "set up land-and-deploy", "how do I deploy with gstack", "add deploy config".

    Also in 17 projects that use this

  • +1 more from Saqlain-811

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. 0 are common, 11 are distinctive, and 13 are very specific to this project.

  • 0

    Common

    Most of the 41 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Resolve the directory: If a directory argument is given, resolve it to an absolute path.

    line 40
  2. Distinctive:

    Verify the directory exists: If it does not, abort with an error.

    line 42
  3. Very specific:

    Write the freeze scope: Create ~/.claude/.freeze-scope with the absolute path.

    line 44
  4. Very specific:

    Check for plan.md: Search for a spec folder with a plan.md:

    line 48
  5. Very specific:

    Check <root>/plans/*/plan.md in the project workspace, per rules/project-workspace.md, then the legacy specs/*/plan.md and …

    line 49
  6. Distinctive:

    If found, read the planned file list for scope comparison.

    line 50
  7. Distinctive:

    If not found, skip scope protection and note it.

    line 51
  8. Very specific:

    Remove the freeze scope: Delete ~/.claude/.freeze-scope if it exists.

    line 60
  9. Very specific:

    Check freeze scope: Read ~/.claude/.freeze-scope if it exists.

    line 66
  10. Distinctive:

    Check for plan.md: Search for an active plan.

    line 67
  11. Distinctive:

    When guard mode is active, every file edit and destructive command follows these checks:

    line 78
  12. Distinctive:

    Verify the file path is inside the frozen directory.

    line 81
  13. Very specific:

    If scope checking is active, verify the file is listed in plan.md.

    line 82
  14. Distinctive:

    Ask for explicit confirmation before executing.

    line 86
  15. Distinctive:

    Never run destructive commands silently while guard is active.

    line 87
  16. Very specific:

    All three protections are advisory.

    line 91
  17. Very specific:

    Never auto-deactivate guard mode.

    line 95
  18. Distinctive:

    All paths must be absolute, never relative.

    line 96
  19. Very specific:

    Stop and refuse when an edit target resolves outside the path in ~/.claude/.freeze-scope.

    line 108
  20. Very specific:

    Stop and ask for confirmation when a command matches rm, git reset, DROP, DELETE, or a dangerous-command-blocker pattern.

    line 109
  21. Distinctive:

    Stop and abort activation when the directory argument does not exist.

    line 110
  22. Very specific:

    Stop and warn when scope checking is active and the edit target is absent from plan.md.

    line 111
  23. Very specific:

    After activation, ~/.claude/.freeze-scope holds exactly one line, an absolute path that exists.

    line 115
  24. Very specific:

    After /guard off, ~/.claude/.freeze-scope is absent.

    line 118

“Common” is measured: kept by at least 6 in 10 of the 41 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Overview

Activates multiple safety protections at once to reduce the risk of accidental damage during sensitive operations.

When to Use

Activate before a sensitive operation where an edit outside one directory or an unconfirmed destructive command would do damage, such as a migration, a production config change, or a bulk rename.

Arguments

InvocationAction
/guard <directory>Activate guard mode, freeze edits to the specified directory
/guardActivate guard mode for the current project root
/guard offDeactivate guard mode, remove all restrictions
/guard statusShow current guard state

Protections

Guard mode enables three protections simultaneously:

ProtectionWhat it does
FreezeRestricts file edits to the specified directory. Writes to ~/.claude/.freeze-scope with the frozen path. Enforcement relies on the agent respecting the freeze file.
CarefulWarns before any destructive command: rm, git reset, DROP, DELETE, and patterns covered by the dangerous-command-blocker hook.
ScopeIf a plan.md exists in the project's spec folder, compares every file edit against the planned file list. Warns when editing files not in the plan.

Process

Activate

  1. Resolve the directory. If a directory argument is given, resolve it to an absolute path. If no argument, use the project root from git rev-parse --show-toplevel.
  2. Verify the directory exists. If it does not, abort with an error.
  3. Write the freeze scope. Create ~/.claude/.freeze-scope with the absolute path.
  4. Confirm activation. State the frozen directory path and that edits outside it will be refused. No hook reads the freeze file, so the refusal comes from the agent checking it before every edit.
  5. Check for plan.md. Search for a spec folder with a plan.md:
    • Check <root>/plans/*/plan.md in the project workspace, per rules/project-workspace.md, then the legacy specs/*/plan.md and .claude/specs/*/plan.md.
    • If found, read the planned file list for scope comparison.
    • If not found, skip scope protection and note it.
  6. Confirm activation. State:
    • Frozen directory path.
    • Whether scope checking is active.
    • How to deactivate: /guard off.

Deactivate

  1. Remove the freeze scope. Delete ~/.claude/.freeze-scope if it exists.
  2. Confirm deactivation. State that all guard protections are removed.

Status

  1. Check freeze scope. Read ~/.claude/.freeze-scope if it exists.
  2. Check for plan.md. Search for an active plan.
  3. Report:

    ProtectionStatus
    FreezeActive: /path/to/directory or Inactive
    CarefulActive: always on when guard is active
    ScopeActive: using plan.md at <plan path> or Inactive: no plan found

Behavior While Active

When guard mode is active, every file edit and destructive command follows these checks:

  1. Before editing a file:
    • Verify the file path is inside the frozen directory. If not, refuse the edit and state why.
    • If scope checking is active, verify the file is listed in plan.md. If not, warn and ask for confirmation before proceeding.
  2. Before running a destructive command:
    • State the command and its potential impact.
    • Ask for explicit confirmation before executing.
    • Never run destructive commands silently while guard is active.

Rules

  • All three protections are advisory. No hook in hooks/ reads .freeze-scope, so freeze holds only because the agent reads the file before every edit and refuses one outside it.
  • The .freeze-scope file contains exactly one line: the absolute directory path.
  • Activating guard a second time with a different directory overwrites the previous freeze scope.
  • The freeze file stays on disk across sessions, and a new session does not read it on its own. Run /guard status at the start of a session that should honor it.
  • Never auto-deactivate guard mode. Only /guard off removes the freeze file.
  • All paths must be absolute, never relative.

Common Rationalizations

  • "This file sits just outside the frozen directory, and the fix needs it": refuse the edit, state why, and let the user widen the scope with a new /guard <directory>.
  • "rm on a build directory is harmless": guard mode confirms every destructive command. State the command and its impact, then ask.
  • "The plan missed this file, but it obviously belongs": an unplanned file gets a warning and a confirmation.
  • "Guard was on last session, so it still is": the file may remain, but nothing enforces it until this session reads it. Run /guard status first.
  • "A relative path is fine here": the freeze file holds one absolute path. Resolve it before writing.

Red Flags

  • Stop and refuse when an edit target resolves outside the path in ~/.claude/.freeze-scope.
  • Stop and ask for confirmation when a command matches rm, git reset, DROP, DELETE, or a dangerous-command-blocker pattern.
  • Stop and abort activation when the directory argument does not exist.
  • Stop and warn when scope checking is active and the edit target is absent from plan.md.

Verification

  • After activation, ~/.claude/.freeze-scope holds exactly one line, an absolute path that exists.
  • The activation message names the frozen path, the scope checking state, and /guard off.
  • /guard status prints the three-row protection table matching the freeze file and plan lookup.
  • After /guard off, ~/.claude/.freeze-scope is absent.

Related Skills

  • /investigate --freeze -- Debugging with freeze protection uses the same mechanism.
  • /plan -- Creates the plan.md that scope checking uses.
  • /ship commit -- Commit after completing guarded work.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.