Index of every page on this site: llms.txt
All skills
garrytan avatar

/careful

@8586794 official
by Garry Tangarrytan/gstack142k stars
20,987
Run it yourself

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

Requires /guard
Use this Skill: https://skilld.dev/gh/garrytan/gstack/careful

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈30 tokens for metadata: the name and description. ≈1.1k when used: this file.

Description uses 1.5% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈121 characters, or 1.5%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

<!-- 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 before Example
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, unlink rm -f ~/notes.txt
DROP TABLE/DATABASE through a SQL client; SQL TRUNCATE psql -c "DROP TABLE users"
Force-push (-f, +ref, --force-with-lease); remote branch delete git push -f origin feature
reset --hard, checkout -f/-- paths, restore, clean -f when there is work to lose; stash drop, worktree remove --force git 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.

Pattern Example
Remove-Item/rm/ri/del/erase/rd/rmdir + -Recurse or -Force gci | ri -r -fo
cmd rd /s, rmdir /s, del /s, erase /s cmd /c rd /s /q C:\proj
Format-Volume, Clear-Disk, Clear-Content, [IO.Directory]::Delete, [IO.File]::Delete Clear-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.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alertstoday3 checks · Risk SAFE
  • Gen Agent Trust Hub1d

    This skill provides a safety layer for terminal use by intercepting Bash and PowerShell commands to warn users before they execute potentially destructive operations like 'rm -rf', 'git reset --hard', or SQL 'DROP TABLE'.

  • Sockettoday

    No alerts

  • Snyk1d

    Risk: LOW · No issues

Signed by skilld at 8586794. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 days ago
What it can do
Runs commands Reads files
version
0.1.0
triggers
[
  "be careful",
  "warn before destructive",
  "safety mode"
]
All 2 allowed tools
BashRead
Other metadata
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..."
        }
      ]
    }
  ]
}
  • Git/VCS
  • Database
  • bash
  • safety
  • guardrails
  • destructive-commands
  • kubernetes
  • docker
  • production

README badge

README badge for garrytan/gstack/careful

Intercepts bash commands to warn before rm -rf, DROP TABLE, git push -f, kubectl delete, and similar destructive operations. Allows override on each warning and exempts safe deletions like node_modules and dist directories.

Generated from the current SKILL.md.

What commands does this skill warn about?
It warns before rm -rf, DROP TABLE, TRUNCATE, git push --force, git reset --hard, git checkout ., kubectl delete, and docker rm -f / docker system prune. Safe build directories like node_modules and dist are excluded.
Can I override the warnings?
Yes. When a destructive command is detected, you're prompted to confirm or cancel. You can always choose to proceed.
How long does this skill stay active?
The skill is session-scoped. It remains active for the current conversation and deactivates when you end the session or start a new one.
Does this work with SQL databases other than the examples shown?
The skill checks for the SQL patterns DROP TABLE, DROP DATABASE, and TRUNCATE. It will catch these in any SQL dialect but is not customizable per database type.

Generated from the current SKILL.md. These answers refresh after source changes.