agentleFS
Casper-MarsCasper-Mars/dsh-agent-dev/skills/dev-systematic-debugging/SKILL.md

dev-systematic-debugging

Skill0 starsChanged 5 days agoApache-2.0View on GitHub

系统化排查缺陷:稳定复现、缩小范围、定位根因、修复并补回归测试。只要用户提到调试、排查 bug、定位问题、复现失败,就使用本技能。不用于需求变更、代码评审或性能优化。

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

系统化调试

调试不是猜,是逐步缩小不确定区间。

Iron Law

没有稳定复现,不改代码。

什么时候用 / 不用

  • 用:测试失败、线上异常、行为与预期不符、偶发问题。
  • 不用:需求变更、代码评审、性能调优(另有方法)。

流程

  1. 描述现象:预期 vs 实际,错误信息、日志、时间点。
  2. 稳定复现:最小输入、最短路径;偶发问题记录频率与环境。
  3. 缩小范围:二分(提交、模块、输入、配置),一次只改一个变量。
  4. 形成假设:写出「如果 X,则 Y」;用日志 / 断点 / 单测验证。
  5. 定位根因:区分直接原因与触发条件;不要停在「加个判空」。
  6. 修复:最小改动,先写失败测试,再修到通过。
  7. 回归:原症状测试 + 相邻路径测试;确认没有掩盖问题。
  8. 记录:根因、修复、预防。

门禁

#门禁通过线不过怎么办
1可复现有最小复现步骤继续缩小
2有假设每个实验对应一个假设停止盲试
3根因分层直接原因 + 触发条件补
4先红后绿失败测试先出现重做
5回归覆盖原症状 + 相邻路径补
6有记录根因与预防补

输出契约

现象:<预期 vs 实际>
复现:<最小步骤 / 输入 / 环境>
假设与实验:
1. <假设> → <实验> → <结果>
根因:<直接原因 + 触发条件>
修复:<文件 + 改动>
回归:<测试名 + 结果>
预防:<测试 / 监控 / 约束>

反合理化

借口现实
先加个 try/catch吞异常会制造更大的问题
重启就好了恢复不等于根因
本地复现不了记录环境差异,继续缩小
肯定是缓存「肯定」不是证据
时间紧,先绕过绕过会留下同类风险

红旗

  • 一次改多个变量。
  • 没有复现就改代码。
  • 用随机日志大海捞针。
  • 修复后不补回归测试。
  • 把根因写成「偶发」。

交接

  • 架构级问题:CTO。
  • 需求歧义:Leader / PM。
  • 修复执行:Developer。

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.