affaan-m/ECC/docs/zh-CN/skills/gateguard/SKILL.md
gateguard
Review gateguard'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
一个 PreToolUse 钩子,强制 Claude 在编辑前进行调查。不同于自我评估("你确定吗?"),它要求具体的事实。调查行为本身创造了自我评估永远无法带来的认知。
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/gateguard"Inspect the Agent Skill "gateguard" from https://github.com/affaan-m/ECC/blob/4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38/docs/zh-CN/skills/gateguard/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
何时激活
处理任何文件编辑会影响多个模块的代码库时 项目包含具有特定模式或日期格式的数据文件时 团队要求 AI 生成的代码必须匹配现有模式时 任何 Claude 倾向于猜测而非调查的工作流程中
处理任何文件编辑会影响多个模块的代码库时项目包含具有特定模式或日期格式的数据文件时团队要求 AI 生成的代码必须匹配现有模式时 - 02
核心概念
LLM 的自我评估不起作用。问"你是否违反了任何策略?"答案永远是"没有"。这已通过实验验证。
LLM 的自我评估不起作用。问"你是否违反了任何策略?"答案永远是"没有"。这已通过实验验证。但问"列出所有导入此模块的文件"会迫使 LLM 运行 Grep 和 Read。调查本身创造了改变输出的上下文。没有竞争对手能同时做到这三步。大多数止步于拒绝。 - 03
证据
两个独立的 A/B 测试,相同的代理,相同的任务:
两个独立的 A/B 测试,相同的代理,相同的任务:两个代理生成的代码都能运行并通过测试。区别在于设计深度。
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 | 72/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/gateguard/SKILL.md
- Commit
- 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38
- License
- MIT
- Collected
- 2026-07-28
- Default branch
- main
View the original SKILL.md
GateGuard — 事实驱动的前置操作门控
一个 PreToolUse 钩子,强制 Claude 在编辑前进行调查。不同于自我评估("你确定吗?"),它要求具体的事实。调查行为本身创造了自我评估永远无法带来的认知。
何时激活
- 处理任何文件编辑会影响多个模块的代码库时
- 项目包含具有特定模式或日期格式的数据文件时
- 团队要求 AI 生成的代码必须匹配现有模式时
- 任何 Claude 倾向于猜测而非调查的工作流程中
核心概念
LLM 的自我评估不起作用。问"你是否违反了任何策略?"答案永远是"没有"。这已通过实验验证。
但问"列出所有导入此模块的文件"会迫使 LLM 运行 Grep 和 Read。调查本身创造了改变输出的上下文。
三阶段门控:
1. DENY — 阻止首次编辑/写入/Bash 尝试
2. FORCE — 明确告知模型需要收集哪些事实
3. ALLOW — 在事实呈现后允许重试
没有竞争对手能同时做到这三步。大多数止步于拒绝。
证据
两个独立的 A/B 测试,相同的代理,相同的任务:
| 任务 | 有门控 | 无门控 | 差距 |
|---|---|---|---|
| 分析模块 | 8.0/10 | 6.5/10 | +1.5 |
| Webhook 验证器 | 10.0/10 | 7.0/10 | +3.0 |
| 平均 | 9.0 | 6.75 | +2.25 |
两个代理生成的代码都能运行并通过测试。区别在于设计深度。
门控类型
编辑/多编辑门控(每个文件的首次编辑)
多编辑的处理方式相同——批次中的每个文件都单独进行门控。
在编辑 {file_path} 之前,请先呈现以下事实:
1. 列出所有导入/引用此文件的文件(在代码树中搜索——Glob/Grep,或通过 Bash 用 find/grep)
2. 列出受此更改影响的公共函数/类
3. 如果此文件读取/写入数据文件,请显示字段名称、结构以及日期格式(使用脱敏或合成值,而非原始生产数据)
4. 逐字引用用户当前的指令
写入门控(首次创建新文件)
在创建 {file_path} 之前,请先说明以下事实:
1. 命名将调用此新文件的文件及行号
2. 确认没有现有文件具有相同功能(在代码树中搜索——Glob/Grep,或通过 Bash 用 find/grep)
3. 如果此文件读取/写入数据文件,请展示字段名称、结构及日期格式(使用脱敏或合成值,而非原始生产数据)
4. 逐字引用用户当前的指令
破坏性 Bash 门控(每个破坏性命令)
触发条件:rm -rf、git reset --hard、git push --force、drop table 等。
1. 列出此命令将修改或删除的所有文件/数据
2. 编写一行回滚步骤
3. 逐字引用用户当前的指令
常规 Bash 门控(每个会话一次)
1. 当前用户请求的一句话概括
2. 此特定命令验证或生成的内容
快速开始
选项 A:使用 ECC 钩子(零安装)
scripts/hooks/gateguard-fact-force.js 处的钩子已包含在此插件中。通过 hooks.json 启用它。
如果 GateGuard 阻止了设置或修复工作,请使用
ECC_GATEGUARD=off 启动会话。如需钩子级别的控制,请继续使用
ECC_DISABLED_HOOKS 配合 GateGuard 钩子 ID。
选项 B:带配置的完整包
pip install gateguard-ai
gateguard init
这会添加 .gateguard.yml 用于按项目配置(自定义消息、忽略路径、门控开关)。
反模式
- 不要使用自我评估替代。 "你确定吗?"总是得到"确定。"这已通过实验验证。
- 不要跳过数据模式检查。 两个 A/B 测试代理都假设了 ISO-8601 日期,而实际数据使用的是
%Y/%m/%d %H:%M。检查数据结构(使用脱敏值)可以防止这类错误。 - 不要对每个 Bash 命令都进行门控。 常规 bash 门控每个会话一次。破坏性 bash 门控每次执行。这种平衡避免了速度下降,同时捕获了真正的风险。
最佳实践
- 让门控自然触发。不要试图预先回答门控问题——调查本身才是提高质量的关键。
- 为你的领域自定义门控消息。如果你的项目有特定约定,请将其添加到门控提示中。
- 使用
.gateguard.yml忽略.venv/、node_modules/、.git/等路径。
相关技能
safety-guard— 运行时安全检查(互补,不重叠)code-reviewer— 编辑后审查(GateGuard 是编辑前调查)
Alternatives
Compare before choosing
affaan-m/ECC
gateguard
Fact-forcing gate that blocks Edit/Write/Bash (including MultiEdit) and demands concrete investigation (importers, data schemas, user instruction) before allowing the action. Measurably improves output quality by +2.25 points vs ungated agents.
affaan-m/ECC
gateguard
Use it for engineering tasks; the detail page covers purpose, installation, and practical steps.