systematic-debugging
Skill19 starsChanged 59 days agoMITView on GitHub
Superpower Skill:遇到缺陷、测试失败或异常行为时使用,要求先完成根因分析再提出修复,确保系统化调试。
191 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- NousResearch/hermes-agenttheir own version, first seen Nov 13, 2026
- andreymudri/fleetmatestheir own version, first seen Oct 5, 2026
- fmind/dottheir own version, first seen Oct 5, 2026
- Integralist/agent-skillstheir own version, first seen Oct 4, 2026
- asta-nguyen/kamehadbtheir own version, first seen Oct 4, 2026
- LayneChai/superpowers-dshtheir own version, first seen Oct 3, 2026
Used with
Projects with it also use building-chatgpt-apps, building-chat-interfaces and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
mjunaidcaSkillbuilding-chatgpt-apps
Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode configuration. NOT when building standard MCP servers without widgets (use building-mcp-servers skill instead).
Also in 4 projects that use this
mjunaidcaSkillbuilding-chat-interfaces
Build AI chat interfaces with custom backends, authentication, and context injection. Use when integrating chat UI with AI agents, adding auth to chat, injecting user/page context, or implementing httpOnly cookie proxies. Covers ChatKitServer, useChatKit, and MCP auth patterns. NOT when building simple chatbots without persistence or custom agent integration.
Also in 4 projects that use this
MorningStar0709Skillchinese-git-workflow
Configure Git for domestic platforms and manage branching strategies suitable for Chinese teams. Use when the user asks to configure remotes, set up SSH, or manage Git workflows for Gitee, Coding, Jihu GitLab, or CNB, including requests like "配置国内 Git", "设置 Gitee 远程仓库", "推荐适合小团队的 Git 流程".
Also in 4 projects that use this
- +8 more from mjunaidca
Other versions191 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- KalarisLabs/Skill-Doctor★ 1310% same
- jnlk-cn/superpowers-cn★ 911% same
Wrote their own version · 189
- obra/superpowers★ 314ksame name
- NousResearch/hermes-agent★ 267ksame name
- open-metadata/OpenMetadata★ 15ksame name
- jnMetaCode/superpowers-zh★ 8.3ksame name
- openai/plugins★ 7.3ksame name
- ChrisWiles/claude-code-showcase★ 6.1ksame name
- microsoft/FluidFramework★ 4.9ksame name
- compozy/compozy★ 2.8ksame name
- GanyuanRan/Aegis★ 1.3ksame name
- SethGammon/Citadel★ 922same name
179 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- brainstormingSkill
- diagnosing-superpowersSkill
- dispatching-parallel-agentsSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- subagent-driven-developmentSkill
- test-driven-developmentSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- writing-plansSkill
- writing-skillsSkill
The file
Files
系统化调试
概览
核心原则: 始终先找到根因,再尝试修复。只修表象即是失败。
违背该流程的字面要求,即是违背调试的精神。
铁律
未完成根因调查前,禁止提出任何修复方案若尚未完成阶段一,则不得提出修复建议。
适用场景
适用于任何技术问题:
- 测试失败
- 生产环境缺陷
- 异常行为
- 性能问题
- 构建失败
- 集成问题
尤其应在以下情况使用:
- 时间紧迫时(紧急情况下最容易产生侥幸猜测)
- 看似有“显而易见的快速修复”时
- 已尝试过多种修复方案时
- 此前修复未生效时
- 尚未完全理解问题时
以下情况也不要跳过:
- 问题看似简单时(简单缺陷同样有根因)
- 时间仓促时(仓促必定导致返工)
- 管理者要求立刻修复时(系统化比盲目试错更快)
四个阶段
必须按顺序完成每个阶段,方可进入下一阶段。
阶段一:根因调查
在尝试任何修复之前:
- 仔细阅读错误信息
- 不要跳过错误或警告
- 其中往往包含精确的解决线索
- 完整阅读堆栈跟踪
- 记录行号、文件路径、错误码
- 稳定复现
- 能否稳定触发?
- 精确的复现步骤是什么?
- 是否每次都会出现?
- 若无法复现 → 先补充数据,切勿猜测
- 检查近期变更
- 哪些变更可能引发该问题?
- 查看 git diff、近期提交
- 新增依赖、配置变更
- 环境差异
在多组件系统中收集证据
当系统包含多个组件时(CI → 构建 → 签名,API → 服务 → 数据库):
在提出修复前,先添加诊断探针:
对于每个组件边界: - 记录进入组件的数据 - 记录离开组件的数据 - 验证环境/配置是否正确传递 - 检查每一层的实际状态 运行一次以收集“在哪一层断裂”的证据 然后分析证据以定位故障组件 再针对该组件深入调查示例(多层系统):
# Layer 1: Workflow echo "=== Secrets available in workflow: ===" echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}" # Layer 2: Build script echo "=== Env vars in build script: ===" env | grep IDENTITY || echo "IDENTITY not in environment" # Layer 3: Signing script echo "=== Keychain state: ===" security list-keychains security find-identity -v # Layer 4: Actual signing codesign --sign "$IDENTITY" --verbose=4 "$APP"由此可得: 哪一层失败(secrets → workflow [OK],workflow → build [FAIL])
追踪数据流
当错误位于调用栈深处时:
完整的回溯追踪技巧见本目录下的
root-cause-tracing.md。精简版:
- 异常值从何而来?
- 是谁以错误值调用了此处?
- 持续向上回溯,直至找到源头
- 在源头修复,而非在表象处打补丁
阶段二:模式分析
先找到规律,再动手修复:
- 寻找可用的参照
- 在同一代码库中定位相似且正常工作的代码
- 有哪些与故障相似但能正常工作的用例?
- 对照参考实现
- 若要套用某种模式,请完整阅读参考实现
- 不要走马观花——逐行阅读
- 在套用前彻底理解该模式
- 识别差异
- 正常与异常之间有何不同?
- 列出每一个差异,哪怕再细微
- 不要想当然地认为“这点不可能有影响”
- 理解依赖
- 该功能还依赖哪些组件?
- 需要哪些设置、配置、环境?
- 它做了哪些隐含假设?
阶段三:假设与验证
用科学方法推进:
- 提出单一假设
- 清晰表述:“我认为根因是 X,理由是 Y”
- 落到纸面
- 要具体,避免含糊
- 最小化验证
- 为验证假设做最小幅度的改动
- 一次只改变一个变量
- 不要同时修复多个问题
- 验证后再继续
- 生效了吗?是 → 进入阶段四
- 未生效?提出新的假设
- 不要在原有改动之上继续叠加修复
- 当你不确定时
- 直言“我不理解 X”
- 不要不懂装懂
- 寻求帮助
- 进一步研究
阶段四:实现
修复根因,而非表象:
- 创建失败用例
- 用最简方式复现问题
- 如有测试框架则编写自动化测试
- 若无框架则编写一次性复现脚本
- 修复前必须具备该用例
- 编写规范的失败测试请使用
test-driven-development技能
- 实施单一修复
- 针对已确认的根因
- 一次只做一处改动
- 不要顺手“顺便优化”
- 不要打包重构
- 验证修复
- 用例现在通过了吗?
- 是否破坏了其他测试?
- 问题是否真正解决?
- 在宣称成功前,请使用
verification-before-completion技能进行校验
- 若修复未生效
- 停下来
- 计数:已尝试几次修复?
- 若 < 3 次:回到阶段一,结合新信息重新分析
- 若 ≥ 3 次:停下来,质疑架构(见下方第 5 步)
- 在未进行架构讨论前,不要尝试第 4 次修复
若 3 次以上修复均失败:质疑架构
指向架构问题的信号:
- 每次修复都在不同位置暴露出新的共享状态/耦合/问题
- 修复需要“大规模重构”才能落地
- 每次修复都在别处引发新症状
停下来,质疑根本:
- 该模式本身是否合理?
- 是否只是“靠惯性硬撑”?
- 应该重构架构,还是继续修补表象?
在尝试更多修复前,先与 human partner 讨论
这不是假设失败——这是架构错误。
危险信号——停下来并回归流程
若你发现自己出现以下想法:
- “先快速修一下,之后再调查”
- “先试着改一下 X 看看是否有效”
- “多改几处,一起跑测试”
- “跳过测试,我手动验证就行”
- “大概是 X,我直接修掉”
- “还没完全搞懂,但这个改法也许能行”
- “规范要求是 X,但我换种方式适配一下”
- “主要问题有这些:[未做调查就直接列出修复清单]”
- 在追踪数据流之前就提出解决方案
- “再试一次修复”(已尝试 2 次以上时)
- 每次修复都在不同位置暴露新问题
以上全部意味着:停下来,回到阶段一。
若已失败 3 次以上: 质疑架构(见阶段四第 5 步)
human partner 提示你做错了的信号
留意这些提醒:
- “这不是没生效吗?”——你在未验证的情况下做了假设
- “它会告诉我们……吗?”——你本应补充证据收集
- “别猜了”——你在未理解问题前就提出修复
- “深入思考一下”——需要质疑根本假设,而非只修表象
- “我们是不是卡住了?”(带有挫败感)——你的方法行不通
出现这些信号时: 停下来,回到阶段一。
常见借口
| 借口 | 实际情况 |
| “问题很简单,不需要走流程” | 简单问题同样有根因。走流程对简单缺陷反而更快。 |
| “紧急情况,没时间走流程” | 系统化调试比猜测试错更快。 |
| “先试一下,之后再调查” | 第一次修复就定下了基调。从一开始就做对。 |
| “确认修复有效后再补测试” | 未经测试的修复不可靠。先写测试才能证明有效。 |
| “一次多修几处更省时间” | 无法定位哪一处真正生效,还会引入新缺陷。 |
| “参考实现太长,我按自己的理解适配一下” | 一知半解必然导致缺陷。必须完整阅读。 |
| “我已经看到问题了,直接修就行” | 看到表象 ≠ 理解根因。 |
| “再试一次修复”(已失败 2 次以上) | 失败 3 次以上即为架构问题。应质疑模式本身,而非再次修补。 |
快速参考
| 阶段 | 关键活动 | 成功标准 |
| 1. 根因 | 阅读错误、复现、检查变更、收集证据 | 明确是什么、为什么 |
| 2. 模式 | 寻找可用参照、对照比较 | 识别差异 |
| 3. 假设 | 提出假设、最小化验证 | 假设被证实或被推翻并形成新假设 |
| 4. 实现 | 编写用例、修复、验证 | 缺陷已解决、测试通过 |
当流程揭示“无根因”时
若系统化调查表明问题确实源于环境、时序或外部因素:
- 流程已走完
- 记录已调查的内容
- 实施相应的容错处理(重试、超时、错误提示)
- 补充监控/日志以便后续调查
但是: 95% 所谓“无根因”的情况,都是调查不充分。
辅助技巧
本目录下提供以下系统化调试的配套技巧:
root-cause-tracing.md- 沿调用栈回溯追踪,直至找到最初触发点defense-in-depth.md- 找到根因后在多层添加校验condition-based-waiting.md- 用条件poll替代固定时延等待
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

