egm-drift-report
它能做什么
这个技能把设计文档与实际代码进行比较,并列出差异。适合文档可能已落后于软件的团队。
适用场景
- ✓当你怀疑代码已经与其设计文档不一致时。
- ✓当你想对某个文件夹中所有设计文档或 README 进行一致性检查的时候。
- ✓当你需要列出文档中描述但代码中缺失的功能的时候。
技能链接
https://github.com/google/elephant-goldfish-model/blob/main/distributions/claude/skills/egm-drift-report/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把文档文件夹中的所有设计文档与代码进行对照,告诉我哪些地方已经不一致。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会列出每份设计文档,找到对应的源文件,阅读当前代码并比较两者。它会在报告中记录缺失的功能、变化的行为以及其他差异。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Detect Drift In Designs and Code
When running in Codex or ChatGPT Work, first read Codex integration.
In Claude Code or Cowork, read ${CLAUDE_PLUGIN_ROOT}/docs/claude.md first.
When the user asks to detect drift across all designs or a set of READMEs, the goal is to identify all instances where the codebase has diverged or failed to implement the specifications described by those designs or READMEs.
Check Input: Verify a directory containing design documents or READMEs is provided. If not provided, ask the user to specify the target directory.
List Documents: List all files in the design directory.
Analyze: For EACH design document:
- Contextualize: Read the design document. Identify the intent, proposed changes, and specific filenames/symbols mentioned.
- Locate Source: Find the corresponding source code files in the source tree. If paths aren't explicit, use code search or grep to locate the relevant classes, functions, or API endpoints mentioned in the doc. Prompt the user to add missing links to the document to make future detection cheaper.
- Verify: Read the current state of those source files.
- Detect Drift: Compare the design vs. reality. Look specifically for:
- Missing Features: Logic described in the doc but absent in the code.
- Incomplete Models: Dataclasses/Classes/Structs/Protos missing fields specified in the design.
- Logic Shortcuts: Hardcoded values where dynamic logic was planned.
- Architectural Divergence: Implementation using different patterns/libraries than proposed.
- Filter: Report ONLY the differences. Do not describe what is working or what matches. If the code matches the design perfectly, output "No drift detected."
Report: Produce a single report listing all discrepancies found.
Append the analysis for each file to
{YYYY-MM-DD}_DRIFT_REPORT.mdusing your file-writing tool.Strict Format:
## <DESIGN_DOC_NAME> <Bulleted list of specific divergences found> <Or "No drift detected">
Guidance
- Be rigorous. If a design doc mentions a specific object, field or file name and the code doesn't have it, that is a reportable drift. Double check for coverage. If there is some part of the logic that is not referenced in a design or README, this is a reportable drift.
- Read files liberally to ensure you are looking at the current state of the code, not relying on memory.
- Process the files sequentially to ensure the tool output buffer doesn't overflow.
常见问题
什么算是“偏离”?
偏离指文档描述的内容与代码实际执行的内容之间的任何差距。
如果文档没有写明对应的代码怎么办?
AI 会搜索文档提到的类或函数,并可能请你添加链接。
这个技能会修复这些差异吗?
它的任务是生成差异报告。
详情
作者的原始描述
Runs drift detection on all design documents to check for document and code consistency. Produces an actionable report with differences. Use when the user asks to detect drift or check for consistency across all design documents or READMEs in a directory.
热度
- GitHub 星标
- 10k
- 排名
- #11880
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …