careful

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly --> <!-- Regenerate: bun run gen:skill-docs -->
<!-- AUTO-GENERATED from SKILL.md.tmpl — 请勿直接编辑 --> <!-- 重新生成:bun run gen:skill-docs -->

/careful — Destructive Command Guardrails

/careful — 破坏性命令防护机制

Safety mode is now active. Every bash 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.
bash
mkdir -p ~/.gstack/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/analytics/skill-usage.jsonl 2>/dev/null || true
安全模式现已激活。所有bash命令在执行前都会被检查是否包含破坏性模式。如果检测到破坏性命令,系统会发出警告,您可以选择继续执行或取消。
bash
mkdir -p ~/.gstack/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/analytics/skill-usage.jsonl 2>/dev/null || true

What's protected

受保护的操作

PatternExampleRisk
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
模式示例风险
rm -rf
/
rm -r
/
rm --recursive
rm -rf /var/data
递归删除
DROP TABLE
/
DROP DATABASE
DROP TABLE users;
数据丢失
TRUNCATE
TRUNCATE orders;
数据丢失
git push --force
/
-f
git push -f origin main
历史记录覆盖
git reset --hard
git reset --hard HEAD~3
未提交工作丢失
git checkout .
/
git restore .
git checkout .
未提交工作丢失
kubectl delete
kubectl delete pod
影响生产环境
docker rm -f
/
docker system prune
docker system prune -a
容器/镜像丢失

Safe exceptions

安全例外情况

These patterns are allowed without warning:
  • rm -rf node_modules
    /
    .next
    /
    dist
    /
    __pycache__
    /
    .cache
    /
    build
    /
    .turbo
    /
    coverage
以下模式无需警告即可执行:
  • rm -rf node_modules
    /
    .next
    /
    dist
    /
    __pycache__
    /
    .cache
    /
    build
    /
    .turbo
    /
    coverage

How it works

工作原理

The hook reads the command from the tool input JSON, checks it against the patterns above, and returns
permissionDecision: "ask"
with a warning message if a match is found. You can always override the warning and proceed.
To deactivate, end the conversation or start a new one. Hooks are session-scoped.
该钩子从工具输入JSON中读取命令,与上述模式进行匹配,如果检测到匹配项,则返回
permissionDecision: "ask"
并附带警告信息。您可以随时忽略警告继续执行。
要关闭该功能,只需结束当前对话或开启新对话。钩子是会话级别的,仅在当前会话生效。