debug

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
No fix before root cause. Symptoms are where the search starts, never where it ends.
Fast path: when the first cause is directly visible in the error output (the stack line points at it), skip the hypothesis loop but never the reproduction or the regression test. If the visible fix does not make the reproduction pass on the first try, the cause was not visible: run the full discipline. Deep mode (the
deep
skill is active): full discipline always.
  1. Reproduce first. Build the smallest deterministic reproduction. If it cannot be reproduced, gather evidence (logs, inputs, versions) until it can; do not guess.
  2. Read the actual error and trace it back to the first cause in the chain, not the nearest symptom.
  3. Form one hypothesis. State it. Verify it with evidence (a log line, a probe, an inspection) before touching any code.
  4. Fix the root cause. One fix at a time; if two hypotheses compete, test the cheaper one first.
  5. Add the regression test that would have caught this: red on the old code, green on the fix.
  6. Run the
    verify
    skill before claiming it is fixed.
Rules:
  • No shotgun fixes, no "try this and see if it helps".
  • If the fix does not make the reproduction pass, the hypothesis was wrong: return to step 3, do not stack a second fix on top.
  • If the root cause reveals a design problem, say so and offer the
    architecture
    skill instead of burying a workaround.
未找到根本原因前不修复。症状是排查的起点,而非终点。
快速路径:当首个原因在错误输出中直接可见(栈行指向它)时,可跳过假设循环,但绝不能跳过复现步骤或regression test。如果可见的修复方案无法让复现用例首次运行通过,说明真正的原因并未显现:需执行完整流程。深度模式(
deep
skill已激活):始终执行完整流程。
  1. 先复现问题。构建最小化的确定性复现用例。如果无法复现,收集证据(日志、输入、版本信息)直到可以复现;切勿猜测。
  2. 阅读实际错误信息,并追溯至因果链中的首个原因,而非最接近的症状。
  3. 提出一个假设。明确陈述该假设。在修改任何代码之前,用证据(日志行、探测工具、检查结果)验证假设。
  4. 修复根本原因。一次只修复一个问题;如果有两个假设相互竞争,先测试成本更低的那个。
  5. 添加能发现该问题的regression test:旧代码下测试失败,修复后测试通过。
  6. 在宣称问题已修复前,运行
    verify
    skill。
规则:
  • 禁止盲目试错式修复,禁止“试试这个看有没有用”的做法。
  • 如果修复方案无法让复现用例通过,说明假设错误:回到步骤3,不要在现有修复上叠加第二个修复。
  • 如果根本原因暴露出设计问题,需明确指出,并推荐使用
    architecture
    skill,而非采用临时解决方案掩盖问题。