본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)139k · #690

careful

하는 일

이 스킬은 위험한 명령이 실행되기 전에 경고하는 안전 점검을 추가합니다. 재귀 삭제, 데이터베이스 삭제, 강제 git 푸시가 대상입니다. 에이전트가 컴퓨터에서 일하는 동안 안전망을 원하는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓에이전트가 파일이나 폴더를 삭제하기 전에 경고받고 싶을 때.
  • ✓데이터베이스 테이블 삭제나 강제 git 푸시로부터 보호받고 싶을 때.
  • ✓실제 운영 시스템에서 작업하며 명령에 더 신중해야 할 때.

스킬 링크

https://github.com/garrytan/gstack/blob/main/careful/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/garrytan/gstack/blob/main/careful/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“안전 모드를 켜 주세요. 데이터를 삭제하거나 git 기록을 다시 쓸 수 있는 명령 전에는 경고해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬이 켜지면 모든 셸 명령이 실행 전에 위험한 패턴을 검사합니다. 위험한 명령이 발견되면 에이전트가 경고하고, 계속할지 취소할지 사용자가 결정하게 합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

<!-- 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

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.

자주 묻는 질문

어떤 명령을 확인하나요?

재귀 삭제, DROP TABLE, TRUNCATE, 강제 푸시, 강제 reset, kubectl delete 등이 예입니다.

명령을 완전히 막나요?

경고하고 진행하거나 취소할지 사용자가 선택하게 합니다.

PowerShell도 다루나요?

네. 설명에 따르면 모든 Bash와 PowerShell 명령이 검사됩니다.

상세 정보

작성자의 원본 설명

Safety guardrails for destructive commands. (gstack)

repo: garrytan/gstack

인기도

GitHub 스타
139k
순위
#690
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬