garrytan/gstack/careful
Claude Code and agent skill by garrytan/gstack
- community
Checking that the SKILL.md file is still in the repository.
Safety guardrails for destructive commands. (gstack)
Install
npx vskill@latest install garrytan/gstack/carefulSKILL.md
/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.
What's protected
| Pattern | Example | Risk | |
|---|---|---|---|
rm -rf / rm -r / rm --recursive | rm -rf /var/data | Recursive delete | |
DROP TABLE / DROP DATABASE | DROP TABLE users; | Data loss | |
TRUNCATE | TRUNCATE orders; | Data loss | |
git push --force / -f | git push -f origin main | History rewrite | |
git reset --hard | git reset --hard HEAD~3 | Uncommitted work loss | |
git checkout . / git restore . | git checkout . | Uncommitted work loss | |
kubectl delete | kubectl delete pod | Production impact | |
docker rm -f / docker system prune | docker system prune -a | Container/image loss |
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
These patterns are allowed without warning:
rm -rf node_modules/.next/dist/__pycache__/.cache/build/.turbo/coverage
How it works
The hook reads tool_name and the command from the tool input JSON, checks it against the patterns above, and returns a hookSpecificOutput payload with permissionDecision: "ask" and a warning reason if a match is found (the decision must be nested under hookSpecificOutput — Claude Code ignores a top-level permissionDecision). You can always override a MEDIUM warning and proceed.
HIGH tier (hard deny)
Two catastrophic shapes are denied, not asked: rm -r/-R of exactly /, ~, or $HOME, and force-push to the repo's default branch. SIMPLE commands only (no ;, &&, ||, |, newline) — compound shapes fall through to the MEDIUM ask; --force-with-lease is never HIGH. A best-effort advisory hard-stop, not a policy boundary: the escape hatch is ending the opt-in, session-scoped /careful session.
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.
To deactivate, end the conversation or start a new one. Hooks are session-scoped.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcareful/SKILL.md
Popularity
- Repository stars
- 119,543
- Repository forks
- 17,833
- 7-day trend score
- 58
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/garrytan/gstack/careful)