跳到主要内容
知仓学习社ZHICANG

bug-diagnosis

Diagnose a bug systematically instead of guessing — reproduce, isolate, form hypotheses, and test them to root cause. Use when debugging, chasing a …

不碰外部(只输出文字)无严重或高危命中mohitagw15856/pm-claude-skills

它会碰到什么

扫了多少1 个文本文件,3 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Bug Diagnosis Skill

The slowest way to fix a bug is to start changing code and hope. This skill runs a disciplined diagnostic

loop: **reproduce it reliably, isolate where it happens, hypothesize why, and test the cheapest hypothesis

first** — narrowing until the root cause is proven, not guessed. It produces a fix and an explanation of why

the bug existed.

Required Inputs

Ask for these only if they aren't already provided:

  • The symptom — what's wrong: expected vs. actual behavior, error/stack trace, when it started.
  • Repro steps — how to trigger it (or "can't reliably reproduce yet").
  • Context — recent changes, environment, frequency (always / intermittent / specific inputs).
  • What's been tried — so we don't repeat dead ends.

Output Format

Diagnosis: [bug]

1. Reproduce — the minimal, reliable steps to trigger it. If it's intermittent, the plan to make it deterministic (fixed input/seed, added logging, narrowed conditions). No fixing until it reproduces.

2. Isolate — narrow where it happens: bisect (git bisect / comment-out / binary search the input), check the boundaries (what's the last known-good point vs. first bad). State the smallest scope that still shows the bug.

3. Hypotheses (ranked) — likely causes, most-probable-and-cheapest-to-test first:

| Hypothesis | Why plausible | How to test it (the cheap check) | Verdict |

|---|---|---|---|

Test them in order; record what each rules in or out.

4. Root cause — the proven cause (not a symptom), with the evidence that confirms it.

5. Fix & guard — the fix, a test that fails before it and passes after (lock the bug out), and any nearby instances of the same mistake.

Quality Checks

  • [ ] A reliable reproduction exists before any fix is attempted
  • [ ] The location is isolated by bisection/narrowing, not guessed
  • [ ] Hypotheses are ranked by likelihood × cheapness and tested in order
  • [ ] The stated cause is the root cause with evidence — not just the surface symptom
  • [ ] A regression test is added that fails before the fix and passes after

Anti-Patterns

  • [ ] Do not start changing code before the bug reliably reproduces
  • [ ] Do not fix the symptom and stop — trace to the underlying cause
  • [ ] Do not change several things at once — you won't know what fixed it (or hid it)
  • [ ] Do not skip the regression test — an unguarded bug comes back
  • [ ] Do not ignore "what's been tried" — re-running dead ends wastes the loop

Based On

Systematic debugging method (reproduce → isolate → hypothesize → verify) — Zeller's Why Programs Fail / scientific-method debugging.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

同名技能的其他版本

有 3 个不同仓库或目录里都有叫 bug-diagnosis 的技能。它们内容并不相同,别混用: