guard

guard is a skill for Claude Code from tonydzi/second-brain-starter-kit. It costs 19 tokens per session (852 once invoked), scanned C, a copy of guard, MIT.

A safety mode that combines warnings for destructive commands with a restriction on which directory may be edited. Destructive commands include actions such as deleting files, dropping a database table, or force-pushing Git history.

In plain words
What is it for?
Use it when you want command warnings and directory-limited edits during risky changes or live debugging.
Why use it?
It reduces the chance of damaging data or changing files outside the intended area while working on production or live systems. The user chooses the directory that edits are allowed to affect.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; names the AskUserQuestion tool; built for gstack.

Part of the second-brain-skills plugin — 258 skills, 3 agents, 1 plugin shipped together

Good fit Use it when you want command warnings and directory-limited edits during risky changes or live debugging.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tonydzi/second-brain-starter-kit/guard
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tonydzi/second-brain-starter-kit --skill guard
Clone the repo
git clone --depth 1 https://github.com/tonydzi/second-brain-starter-kit

Made for: Claude Code.

Or install second-brain-skills, the plugin that ships this one along with the rest of its 258 skills, 3 agents, 1 plugin.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for guard

README.md
[![agentmods](https://agentmods.dev/badge/skills/tonydzi/second-brain-starter-kit/guard/github.svg)](https://agentmods.dev/skills/tonydzi/second-brain-starter-kit/guard)
Your own site
<a href="https://agentmods.dev/skills/tonydzi/second-brain-starter-kit/guard"><img src="https://agentmods.dev/badge/skills/tonydzi/second-brain-starter-kit/guard/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for guard

Your own site · 80×15
<a href="https://agentmods.dev/skills/tonydzi/second-brain-starter-kit/guard"><img src="https://agentmods.dev/badge/skills/tonydzi/second-brain-starter-kit/guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 852 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.00852
Opus 5.5 $0.00008 $0.00341
Sonnet 5.5 $0.00004 $0.00170
Haiku 4.5 $0.00002 $0.00085

Measured 2mo ago against content hash ae1ec65c4256, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

guard scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

Combines /careful (warns before rm -rf, DROP TABLE, force-push, etc.) with
Origin

This is a copy

100% identical to guard — 50 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/gstack/guard/SKILL.md · 91 lines

How it starts

The opening of the file, as written. The whole thing — 91 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 guard — rm -rf, DROP TABLE, force-push, etc. warn before executing (overridable); catastrophic shapes (recursive delete of / or ~, force-push to the default branch) are hard-denied"
  • "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."

Read the full file on GitHub · 91 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 91 lines · 19 tokens per session scan C ae1ec65c4256

Subscribe to this mod's changes

guard is a skill published in the GitHub repository tonydzi/second-brain-starter-kit (16 stars, last pushed today), licensed MIT. It adds 19 tokens to every session and 852 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). It is 100% identical to guard, differing in 50 lines, and is treated as a copy.

Related

guard compared with skills from other repositories

guard next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
guardtonydzi/second-brain-starter-kitSkill16todayMITC19Claude Code
wiki-lintAgriciDaniel/claude-obsidianSkill17k1mo agoMITA79Claude Code
wiki-retrieveAgriciDaniel/claude-obsidianSkill17k1mo agoMITA81Claude Code
wiki-modeAgriciDaniel/claude-obsidianSkill17k1mo agoMITA83Claude Code
defuddleAgriciDaniel/claude-obsidianSkill17k1mo agoMITA61Claude Code
wiki-foldAgriciDaniel/claude-obsidianSkill17k1mo agoMITA76Claude Code
molio-doctorzhuzhaoyun/MolioSkill4522d agononeA0Claude Code, Codex