agentleFS
garrytangarrytan/gstack/careful/SKILL.md

careful

Skill143k starsChanged 54 days agoMITView on GitHub

Safety guardrails for destructive commands. Use for: be careful, warn before destructive, safety mode. (gstack)

  • Reads credentials
  • Deletes or force-pushes
  • Commits and pushes

26 other projects use a version of this, 14 of them edited; 1 of 2 edited versions we compared changed its rules.

How people change it

1 of 2 edited versions changed its rules.

Of the 2 edited versions we compared: 1 keep every rule, 1 made changes of their own.

Rules people drop

  1. Add warn rules — one POSIX ERE per line, # comments OK — in ~/.gstack/careful-patterns.txt (global) or ~/.gstack/projects/<slug>/careful-patterns.txt (per-project). …dropped by 1 of 1

We split this file and each edited version into the rules they give an agent and match them by wording. A version that adds no rule of its own and has not changed since this file last did reads as an older text, so what it lacks is not counted as dropped. We keep no past texts of a file, so that is inferred, and an edited version that started from an older text still counts its gaps as drops.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projectsWeek of Nov 22: 0 new projects
Oct 2026Nov 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Most recently taken up by

Who's talking about garrytan/gstack

The biggest 5 of 109 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 109

Talked about on GitHub, Bluesky and Hacker News (109 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 49

44 more on Bluesky

Used with

Projects with it also use cso.

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

    cso

    Chief Security Officer mode. Performs OWASP Top 10 audit, STRIDE threat modeling, attack surface analysis, auth flow verification, secret detection, dependency CVE scanning, supply chain risk assessment, and data classification review. Use when: "security audit", "threat model", "pentest review", "OWASP", "CSO review".

    Also in 7 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    Add warn rules — one POSIX ERE per line, # comments OK — in ~/.gstack/careful-patterns.txt (global) or …

    line 99

“Common” is measured: kept by at least 6 in 10 of the 7 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
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly --><!-- Regenerate: bun run gen:skill-docs -->

/careful — Destructive Command Guardrails

Safety mode is now active. Every Bash and PowerShell command will be checked for destructive patterns before running. If a destructive command is detected, you'll be warned and can choose to proceed or cancel.

GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
mkdir -p "$GSTACK_STATE_ROOT"/analytics
echo '{"skill":"careful","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_STATE_ROOT"/analytics/skill-usage.jsonl 2>/dev/null || true

What's protected

Each command in a chain is checked on its own (after &&, sudo, xargs, inside bash -c).

Asks beforeExample
rm -r of anything but scratch (see below)rm -rf /var/data
Deleting outside the session folder: rm, find's delete actions, rsync --delete, shred, unlinkrm -f ~/notes.txt
DROP TABLE/DATABASE through a SQL client; SQL TRUNCATEpsql -c "DROP TABLE users"
Force-push (-f, +ref, --force-with-lease); remote branch deletegit push -f origin feature
reset --hard, checkout -f/-- paths, restore, clean -f when there is work to lose; stash drop, worktree remove --forcegit clean -fdx
History rewrites (filter-branch, BFG, reflog expire --expire=now)
Database resets (prisma migrate reset, dropdb, FLUSHALL, DELETE FROM with no WHERE)
Cloud deletes (terraform destroy, aws/gcloud/az delete; not dry runs)
kubectl delete, docker rm -f, docker system prune

PowerShell and cmd (Windows)

The hook also checks the PowerShell tool (Claude Code's main Windows shell) and any pwsh/powershell/cmd launched from Bash. Matching ignores case, covers aliases in command position, accepts parameter prefixes (-r, -fo) and strips cmd ^ escapes. All rows above apply there too.

PatternExample
Remove-Item/rm/ri/del/erase/rd/rmdir + -Recurse or -Forcegci | ri -r -fo
cmd rd /s, rmdir /s, del /s, erase /scmd /c rd /s /q C:\proj
Format-Volume, Clear-Disk, Clear-Content, [IO.Directory]::Delete, [IO.File]::DeleteClear-Disk -Number 1
-EncodedCommand, iex, Start-Process of a shell, & $cmd (can't be inspected)irm $url | iex

Best-effort on PowerShell. String matching can't see a command built at runtime. For a hard stop, add Claude Code permission deny rules, which parse PowerShell and its aliases: "deny": ["PowerShell(Remove-Item *)"] in .claude/settings.json. The hook runs through bash, so Windows needs Git Bash.

Safe exceptions

A recursive delete never asks when every target is scratch: under /tmp/ or /var/tmp/, a $(mktemp) variable, a relative path after cd into scratch, a cache (~/.cache, ~/.npm and the like), or a build artifact (node_modules, dist, build, .next, .venv and the like). A path containing .. is never scratch.

How it works

The hook checks each command against the patterns above and returns permissionDecision: "ask" (nested under hookSpecificOutput) with a reason. You can always approve an ask and proceed.

HIGH tier (hard deny)

Denied, not asked: a recursive delete of /, ~, a system folder or ~/.ssh-style personal folder; a force-push to main, master or the default branch (--force-with-lease is never HIGH); a disk wipe (dd of=/dev/sda, mkfs). Best-effort, not a policy boundary: you can still run the command yourself.

Project patterns (additive only)

Add warn rules — one POSIX ERE per line, # comments OK — in ~/.gstack/careful-patterns.txt (global) or ~/.gstack/projects/<slug>/careful-patterns.txt (per-project). Consulted after the built-in families, so config can only ADD rules, never suppress a baseline warning. Invalid regex lines are skipped.

Always on

./setup registers this check for every session (destructive_guard), so it runs even when /careful is never loaded; /guard still adds the edit boundary. Turn it off with gstack-config set destructive_guard off; /careful's own hooks then last until the conversation ends.

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.