affaan-m/ECC/docs/zh-CN/skills/safety-guard/SKILL.md
safety-guard
Review safety-guard's use cases, installation, workflow, and original source instructions.
- Source repository stars
- 234,327
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-07-27
- Source checked
- 2026-07-28
Decision brief
What it does—and where it fits
使用此技能可防止在生产系统上工作或自主运行代理时进行破坏性操作。
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/safety-guard"Inspect the Agent Skill "safety-guard" from https://github.com/affaan-m/ECC/blob/4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38/docs/zh-CN/skills/safety-guard/SKILL.md at commit 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
使用场景
在生产系统上工作时 代理以全自动模式运行时 希望将编辑限制在特定目录时 敏感操作期间(迁移、部署、数据变更)
在生产系统上工作时代理以全自动模式运行时希望将编辑限制在特定目录时 - 02
工作原理
检测到时:显示命令功能、请求确认、建议更安全的替代方案。
检测到时:显示命令功能、请求确认、建议更安全的替代方案。任何在 src/components/ 之外的写入/编辑操作都会被阻止并附带说明。适用于希望代理专注于某个区域而不触及无关代码的场景。代理可读取任何内容,但仅能写入 src/api/。破坏性命令在所有位置均被阻止。 - 03
模式 1:谨慎模式
检测到时:显示命令功能、请求确认、建议更安全的替代方案。
检测到时:显示命令功能、请求确认、建议更安全的替代方案。
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 59/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 234,327 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | catalog record | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- affaan-m/ECC
- Skill path
- docs/zh-CN/skills/safety-guard/SKILL.md
- Commit
- 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38
- License
- MIT
- Collected
- 2026-07-28
- Default branch
- main
View the original SKILL.md
安全防护 — 防止破坏性操作
使用场景
- 在生产系统上工作时
- 代理以全自动模式运行时
- 希望将编辑限制在特定目录时
- 敏感操作期间(迁移、部署、数据变更)
工作原理
三种保护模式:
模式 1:谨慎模式
在执行破坏性命令前进行拦截并发出警告:
已监控的模式:
- rm -rf(特别是 /、~ 或项目根目录)
- git push --force
- git reset --hard
- git checkout .(丢弃所有更改)
- DROP TABLE / DROP DATABASE
- docker system prune
- kubectl delete
- chmod 777
- sudo rm
- npm publish(意外发布)
- 任何带有 --no-verify 的命令
检测到时:显示命令功能、请求确认、建议更安全的替代方案。
模式 2:冻结模式
将文件编辑锁定到特定目录树:
/safety-guard freeze src/components/
任何在 src/components/ 之外的写入/编辑操作都会被阻止并附带说明。适用于希望代理专注于某个区域而不触及无关代码的场景。
模式 3:守护模式(谨慎+冻结组合)
双重保护同时生效。为自主代理提供最高安全性。
/safety-guard guard --dir src/api/ --allow-read-all
代理可读取任何内容,但仅能写入 src/api/。破坏性命令在所有位置均被阻止。
解锁
/safety-guard off
实现方式
通过 PreToolUse 钩子拦截 Bash、Write、Edit 和 MultiEdit 工具调用。在执行前根据活动规则检查命令/路径。
集成方案
- 默认在
codex -a never会话中启用 - 配合 ECC 2.0 的可观测性风险评分
- 所有被阻止的操作记录至
~/.claude/safety-guard.log
Alternatives