agentleFS
timurgaleevtimurgaleev/vibestack/skills/guard/SKILL.md

guard

Skill8 starsChanged 6 months agoMITView on GitHub

Full safety mode for prod work: warn before destructive commands and block edits outside one directory.

  • Deletes or force-pushes

52 other projects use a version of this, 25 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use ios-clean, ios-fix and 4 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.
  • 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

  • ShreyRaviSkill

    setup-gbrain

    Set up gbrain for this coding agent: install the CLI, initialize a local PGLite or Supabase brain, register MCP, capture per-remote trust policy. One command from zero to "gbrain is running, and this agent can call it." Use when: "setup gbrain", "connect gbrain", "start gbrain", "install gbrain", "configure gbrain for this machine". (gstack)

    Also in 6 projects that use this

  • ShreyRaviSkill

    sync-gbrain

    Keep gbrain current with this repo's code and refresh agent search guidance in CLAUDE.md. Wraps the gstack-gbrain-sync orchestrator with state probing, native code-surface registration, capability checks, and a verdict block. Re-runnable, idempotent. Use when: "sync gbrain", "refresh gbrain", "re-index this repo", "gbrain search isn't finding things". (gstack)

    Also in 6 projects that use this

  • +1 more from Saqlain-811

The file

We split this skill into the rules it gives an agent

4 rules. 1 is common, 1 is distinctive, and 2 are very specific to this project.

  • 1

    Common

    Most of the 41 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If this session was compacted, the copy of this skill in context may be cut off.

    line 50
  2. Very specific:

    Read ${CLAUDE_SKILL_DIR}/SKILL.md from disk and resume at the step you are on.

    line 51
  3. Distinctive:

    Use when asked to "guard mode", "full safety", "lock it down", or "maximum safety".

    line 55
  4. Common:

    Ask the user which directory to restrict edits to:

    line 80

“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

If this session was compacted, the copy of this skill in context may be cut off. Read ${CLAUDE_SKILL_DIR}/SKILL.md from disk and resume at the step you are on.

When to invoke

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 /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 vibestack install script).

Where this is enforced. Both protections run as Claude Code PreToolUse hooks. Cursor, Kiro and Codex install the same skill, but the hooks are not guaranteed to run there; outside Claude Code /guard is instruction-only. On those hosts, tell the user guard mode is advisory: you will confirm before a destructive command and keep your own edits inside the boundary, but nothing blocks a tool call you get wrong.

Copilot CLI is the exception. When the configuration payload is installed (./install --with-config or --only=config), the user hook file ~/.copilot/hooks/vibestack.json (under $COPILOT_HOME when set) enforces both halves: the destructive-command and gate-file check is always on, in every session, and the edit boundary blocks while a freeze directory is set. Without the configuration payload it is instruction-only there as well.

Setup

Ask the user which directory to restrict edits to:

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

Once the user provides a path, set it with the shared state writer (see /freeze):

bash "${CLAUDE_SKILL_DIR:-$HOME/.claude/skills/guard}/../freeze/bin/freeze-state.sh" set "<user-provided-path>"

Report guard mode active only if the command exits 0 and prints FREEZE_DIR=. On FREEZE_ERROR (a mistyped or missing path, or /), tell the user no edit boundary was set and ask for the path again. On FREEZE_BUSY, retry once the other writer finishes; never write or delete the state file directly.

Tell the user:

  • "Guard mode active. Two protections are now running:"
  • "1. Destructive command guard — Bash and PowerShell: rm -rf, Remove-Item -Recurse, DROP TABLE, force-push, etc. warn before executing (you can override); catastrophic shapes (recursive delete of / or ~, force-push to the default branch) are blocked outright; an Edit or Write to a gate file (lint, type-check, CI or migration config) also warns"
  • "2. Edit boundary — Edit, Write and NotebookEdit restricted to <FREEZE_DIR>/. Edits outside this directory are blocked."
  • "The edit boundary is saved in ~/.vibestack/freeze-dir.txt and outlives this session: any later session that loads the freeze hook (/freeze, /guard, /investigate) enforces it again. To remove it, run /unfreeze. Ending the session turns off the destructive command guard only."

What's protected

See /careful for the two decision tiers, the full pattern list, and the safe exceptions. See /freeze for how edit boundary enforcement works.

Both hooks fail safe when they cannot read a tool payload — /careful asks, /freeze denies. Guard mode runs both, so an unreadable Edit, Write or NotebookEdit payload is blocked, not waved through.

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.