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 || trueWhat's protected
受保护的操作
| Pattern | Example | Risk |
|---|---|---|
| | Recursive delete |
| | Data loss |
| | Data loss |
| | History rewrite |
| | Uncommitted work loss |
| | Uncommitted work loss |
| | Production impact |
| | Container/image loss |
| 模式 | 示例 | 风险 |
|---|---|---|
| | 递归删除 |
| | 数据丢失 |
| | 数据丢失 |
| | 历史记录覆盖 |
| | 未提交工作丢失 |
| | 未提交工作丢失 |
| | 影响生产环境 |
| | 容器/镜像丢失 |
Safe exceptions
安全例外情况
These patterns are allowed without warning:
- /
rm -rf node_modules/.next/dist/__pycache__/.cache/build/.turbocoverage
以下模式无需警告即可执行:
- /
rm -rf node_modules/.next/dist/__pycache__/.cache/build/.turbocoverage
How it works
工作原理
The hook reads the command from the tool input JSON, checks it against the
patterns above, and returns with a warning message
if a match is found. You can always override the warning and proceed.
permissionDecision: "ask"To deactivate, end the conversation or start a new one. Hooks are session-scoped.
该钩子从工具输入JSON中读取命令,与上述模式进行匹配,如果检测到匹配项,则返回并附带警告信息。您可以随时忽略警告继续执行。
permissionDecision: "ask"要关闭该功能,只需结束当前对话或开启新对话。钩子是会话级别的,仅在当前会话生效。