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 從公開儲存庫中收錄這些內容。

檢舉或申請下架