Principle Fix Root Causes

作者 cursorccb5507cec15无许可证10K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

Apply when debugging. Trace each symptom to its root cause and fix it there; reproduce first, ask why until you reach it, resist nil-check guards that silence crashes.

AI 生成的概览

一套调试原则:把症状追溯到根本原因并在那里修复,而不是打补丁。

功能
该技能提供一组调试原则:先复现问题,不断追问“为什么”直到找到根本原因,并在那里修复代码,而不是添加防护。它建议不要用空值检查来掩盖崩溃,不要写需要长篇注释才能解释的变通方案,并建议搜索同一模式的其他实例,以及通过加日志等方式探查而不是猜测。它还指出,重启后出现的故障应首先怀疑陈旧的持久化状态,例如配置文件、缓存、锁文件或序列化状态。
适用场景
在调试缺陷并判断修复应放在何处时使用。适用于用防护掩盖了崩溃、变通方案不断累积,或某功能在重启后失败的情形。
运行要求
无需工具、软件包或凭据;仅为说明性指令,不附带脚本。

Fix Root Causes

When debugging, do not fix symptoms. Trace every problem to its root cause and fix it there.

Why: Symptom fixes accumulate. Each workaround makes the system harder to reason about, and the real bug remains. Root-cause fixes are slower upfront but reduce total debugging time.

Pattern:

  • Reproduce first
  • Ask "why" until you hit the root cause
  • Do not add guards (adding a nil check to silence a crash is a symptom fix)
  • If a workaround needs a paragraph-long comment to justify it, the code is wrong (fix the code, not the comment)
  • Check for the pattern, not just the instance (grep for the same pattern, fix all instances)
  • When stuck, instrument. Don't guess (add logging, read the actual error)

Restart bugs: suspect state before code

When something "fails after restart," suspect stale persistent state first: config files, caches, lock files, serialized state. If clearing a state file restores behavior, prioritize state validation as the fix.

来源与署名

来源:cursor/plugins位于pstack/skills/principle-fix-root-causes提交ccb5507

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架