‹ 首页

debugging-methodology

@developersglobal · 收录于 1 周前

Systematic root cause analysis for production and development bugs. Hypothesis-driven debugging — never guess-and-check.

适合你,如果经常面对复杂bug不知从何下手

/ 下载安装
debugging-methodology.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add developersglobal/ai-agent-skills/debugging-methodology
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- developersglobal/ai-agent-skills/debugging-methodology
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify developersglobal/ai-agent-skills/debugging-methodology
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
64GitHub stars
~938上下文体积 · 单文件
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · f47f948
Overview

Random code changes in response to errors are not debugging — they're noise generation. This skill enforces a systematic, hypothesis-driven approach: understand the problem, form a hypothesis, test it, confirm the root cause, then fix.

AI agents often cycle through random fixes until something "works." This skill prevents that.

When to Use
  • Any time a test fails unexpectedly
  • Any time you encounter an error or exception
  • When behavior differs between environments
  • When performance degrades unexpectedly
Process
Step 1: Reproduce Reliably
  1. Before doing anything else: reproduce the bug reliably. If you can't reproduce it, you can't fix it.
  2. Write a failing test that captures the bug — this becomes your regression test.
  3. Note the exact conditions that trigger the bug: inputs, environment, sequence of actions.

Verify: You can trigger the bug on demand.

Step 2: Understand Before Diagnosing
  1. Read the full error message — not just the first line.
  2. Read the stack trace from bottom to top — the root cause is usually near the bottom.
  3. Identify: What was the program trying to do? What happened instead?

Verify: You can explain the bug in one sentence without using the word "error."

Step 3: Form a Hypothesis
  1. Based on what you know, form a specific hypothesis: "I think the bug is X because Y."
  2. The hypothesis must be falsifiable — you can design a test that proves or disproves it.
  3. Do not start making code changes until you have a hypothesis.

Verify: Your hypothesis is specific enough to design a test for.

Step 4: Test the Hypothesis
  1. Add targeted logging or a targeted test that confirms or refutes the hypothesis.
  2. Run it. Read the output carefully.
  3. If the hypothesis is wrong: update your understanding, form a new hypothesis, repeat.
  4. If the hypothesis is right: you've found the root cause.

Verify: Root cause is confirmed by evidence, not assumed.

Step 5: Fix the Root Cause (Not the Symptom)
  1. Fix the root cause — not the symptom. Suppressing an error message is not a fix.
  2. Make the minimum change that fixes the root cause.
  3. Run the failing test you wrote in Step 1 — it should now pass.
  4. Run the full test suite — no regressions.

Verify: The specific failing test now passes. Full suite still passes.

Step 6: Prevent Recurrence
  1. If the bug wasn't caught by existing tests: add a test that would have caught it.
  2. If the bug was caused by a bad assumption: document the assumption or add a guard.
  3. Consider: does this class of bug exist elsewhere in the codebase?
Common Rationalizations (and Rebuttals)

| Excuse | Rebuttal | |--------|----------| | "Let me just try this and see" | Random changes produce random results. Form a hypothesis first. | | "It must be a framework bug" | It's almost never the framework. Prove it before blaming it. | | "Works on my machine" | Environment differences are root causes. Find them. Don't dismiss them. | | "I'll add a try/catch" | That hides the bug. Find and fix the root cause. |

Red Flags
  • Making code changes before understanding the bug
  • Adding try/catch to silence errors without investigating root cause
  • "I'll try this and see if it helps"
  • Assuming the bug is in a dependency before proving it
  • Fixing the symptom (error message) rather than the cause
Verification
  • [ ] Bug reproducible on demand
  • [ ] Root cause identified (not just symptom)
  • [ ] Fix targets root cause, not symptom
  • [ ] Reproduction test written and now passes
  • [ ] Full test suite passes with no regressions
  • [ ] Regression test added to prevent future occurrence
References
  • [test-driven-development skill](../test-driven-development/SKILL.md)
  • [observability skill](../observability/SKILL.md)
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。