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

systematic-debugging

Finds the root cause of a bug, test failure, or unexpected behavior before proposing any fix. Use this whenever something is broken and the cause is…

不碰外部(只输出文字)无严重或高危命中cbrock84/headcount

它会碰到什么

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

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

技能内容

Systematic debugging

The rule

No fix before the cause is proven. A change that makes a symptom disappear without an

explanation has not fixed anything — it has moved the failure somewhere you are not looking.

Method

  1. Reproduce it deterministically. If you cannot make it happen on demand, you cannot know when

it is fixed. Intermittent means you have not found the variable yet — order, timing, state,

environment, data.

  1. Narrow the blast radius. Bisect: which commit, which input, which branch, which layer. Halve

the search space with each step rather than reading everything.

  1. State a hypothesis that can be wrong. "The cache returns stale rows after a write" is a

hypothesis. "Something is wrong with caching" is not.

  1. Test the hypothesis directly — a log line, a breakpoint, a probe. Prove it, do not infer it.
  2. Explain the whole symptom. If your cause explains the error but not why it started Tuesday,

you have found a bug, not the bug.

  1. Fix, then verify by reverting. Put the bug back and confirm the test fails again. This is the

step people skip, and it is the one that proves causation rather than coincidence.

Anti-patterns

  • Shotgun changes — altering several things at once. Now you cannot attribute the fix.
  • "Probably a flake." Not a diagnosis. A test that fails intermittently is reporting a real

race, ordering dependency, or shared-state leak.

  • Fixing the symptom — catching the exception, adding a retry, widening a timeout — without

knowing what threw it.

  • Trusting the error message's location. Where it surfaced is rarely where it originated.

Never

  • Close a bug without a reproduction that failed before the fix and passes after it.
  • Deploy a change to production to find out whether it works. Reproduce somewhere you can observe first.
  • Change the environment and the code in the same step.
  • Leave a debugging aid in the code as the fix — a widened timeout, a disabled check, a swallowed exception.

Return contract

State the reproduction, the proven cause, the fix, and the verification that the fix addresses that

cause specifically. Name anything you ruled out and how.

想直接用这个技能?

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