在执行修改或命令前强制事实核查,先调查上下文再放行操作以提升质量。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "gateguard" 技能: 1. 下载 https://raw.githubusercontent.com/affaan-m/ECC/main/skills/gateguard/SKILL.md 2. 保存为 ~/.claude/skills/gateguard/SKILL.md 3. 装好后重载技能,告诉我可以用了
启用 gateguard,在修改这个仓库前先调查相关导入链、数据结构、配置来源和我的真实需求;只有在你给出明确发现与风险后,才允许执行 Edit 或 MultiEdit。
先输出调查结论、影响范围与潜在风险,再在条件满足后进入具体修改步骤。
使用 gateguard,在运行任何 Bash 命令前先确认项目类型、依赖管理方式、环境变量、数据库模式以及用户目标;如果信息不足,先提问或继续调查,不要直接执行。
得到一份执行前核查清单与缺失信息说明,避免基于错误假设运行命令。
让 gateguard 审核这项写作任务:在生成文档前,先检查现有资料、术语定义、目标读者和格式要求;如果缺少事实依据或用户指令不完整,就暂停 Write 并说明原因。
先获得信息缺口和澄清建议,确认依据充分后再输出文档草稿。
A PreToolUse hook that forces Claude to investigate before editing. Instead of self-evaluation ("are you sure?"), it demands concrete facts. The act of investigation creates awareness that self-evaluation never did.
LLM self-evaluation doesn't work. Ask "did you violate any policies?" and the answer is always "no." This is verified experimentally.
But asking "list every file that imports this module" forces the LLM to run Grep and Read. The investigation itself creates context that changes the output.
Three-stage gate:
1. DENY — block the first Edit/Write/Bash attempt
2. FORCE — tell the model exactly which facts to gather
3. ALLOW — permit retry after facts are presented
No competitor does all three. Most stop at deny.
Two independent A/B tests, identical agents, same task:
| Task | Gated | Ungated | Gap |
|---|
| Analytics module | 8.0/10 | 6.5/10 | +1.5 |
| Webhook validator | 10.0/10 | 7.0/10 | +3.0 |
| Average | 9.0 | 6.75 | +2.25 |
Both agents produce code that runs and passes tests. The difference is design depth.
MultiEdit is handled identically — each file in the batch is gated individually.
Before editing {file_path}, present these facts:
1. List ALL files that import/require this file (use Grep)
2. List the public functions/classes affected by this change
3. If this file reads/writes data files, show field names, structure,
and date format (use redacted or synthetic values, not raw production data)
4. Quote the user's current instruction verbatim
Before creating {file_path}, present these facts:
1. Name the file(s) and line(s) that will call this new file
2. Confirm no existing file serves the same purpose (use Glob)
3. If this file reads/writes data files, show field names, structure,
and date format (use redacted or synthetic values, not raw production data)
4. Quote the user's current instruction verbatim
Triggers on: rm -rf, git reset --hard, git push --force, drop table, etc.
1. List all files/data this command will modify or delete
2. Write a one-line rollback procedure
3. Quote the user's current instruction verbatim
1. The current user request in one sentence
2. What this specific command verifies or produces
The hook at scripts/hooks/gateguard-fact-force.js is included in this plugin. Enable it via hooks.json.
If GateGuard blocks setup or repair work, start the session with
ECC_GATEGUARD=off. For hook-level control, keep using
ECC_DISABLED_HOOKS with the GateGuard hook ID.
pip install gateguard-ai
gateguard init
This adds .gateguard.yml for per-project configuration (custom messages, ignore paths, gate toggles).
%Y/%m/%d %H:%M. Checking data structure (with redacted values) prevents this entire class of bugs.…
帮助用户在回答前选择简短、标准或详细版本,控制回复深度与 token 用量。
为 AI 代理加入人工审批关卡,在执行前可批准、修改或拒绝操作。