--- name: principle-fix-root-causes description: "When you debug a failure or are about to apply a fix, trace the symptom back to the first place the system went wrong and fix it there. A guard is a fix only when the state it handles is legitimate." disable-model-invocation: true --- # Fix root causes Fix the fault, not the place where it surfaced. The root cause is the first place the system did something it must not do, or failed to handle a state it must handle. - Reproduce first. Ask "why" until the answer is a wrong decision in the code. When you are stuck, instrument and read the actual state. - Ask whether the state that triggered the symptom is legitimate. If it is, handle it where the code broke. If it must never exist, a check there hides the bug, so find what produced it. Guards, retries, swallowed errors, clamped values, and discarded state are the usual ways to hide a bug. - Fix the pattern, not the instance. Find every place with the same fault. Fix each one in scope, and handle the others per [ancillary-fixes](../principle-ancillary-fixes/SKILL.md). - If the deciding fact took a deep dig, propose the cheap, always-on signal that would have shown it at first look. When two fixes that share one premise fail the same check, switch to [attack-the-premise](../principle-attack-the-premise/SKILL.md).