systematic-debugging

Diagnose bugs through a four-phase root-cause investigation process before proposing fixes.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/leonardoacosta/skills --skill systematic-debugging-leonardoacosta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: systematic-debugging
Source: https://github.com/leonardoacosta/skills/tree/main/leo-core/skills/systematic-debugging
Command: npx skills add https://github.com/leonardoacosta/skills --skill systematic-debugging-leonardoacosta

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Developers under time pressure often apply quick symptom fixes that mask the real bug, leading to recurring failures, shotgun patches, and wasted hours. This Skill enforces a disciplined root-cause investigation workflow so fixes address the actual source of the problem. ## Core Features & Use Cases - Four-Phase Debugging Protocol: Root cause investigation, pattern comparison against working code, single-hypothesis testing, and test-verified implementation. - Escalation Rule: After 3+ failed fix attempts, stop and question the underlying architecture instead of stacking more patches. - Supporting Techniques: Includes root-cause tracing through call stacks, defense-in-depth validation at multiple layers, condition-based waiting to replace flaky timeouts, and a bisection script to find polluting tests. - Use Case: A test suite fails intermittently in CI. Instead of adding arbitrary sleep delays, follow the protocol to trace the failure back through the call chain, identify the race condition, and replace timeouts with condition-based polling. ## Quick Start Use the systematic-debugging skill to investigate this failing test and find its root cause before suggesting any fix.

Frequently Asked Questions about systematic-debugging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find the root cause of a bug instead of fixing symptoms?

Follow the four-phase process: read the full error and reproduce reliably, compare against a working example of the same pattern, form one hypothesis and test the smallest change, then implement with a failing test first. Never stack multiple fixes on an unconfirmed hypothesis.

How to fix flaky tests caused by arbitrary timeouts?

Replace setTimeout and sleep calls with condition-based waiting that polls for the actual condition you care about, such as an event appearing or state changing. Poll every 10ms with a clear timeout error, and only use fixed delays when testing documented timing behavior.

When should I stop debugging and question the architecture?

Stop after 3 or more failed fix attempts on the same bug, especially when each fix reveals new shared state in a different place or requires massive refactoring. That pattern indicates a wrong architecture, not a failed hypothesis, so discuss with the team before attempting more fixes.

How do I find which test is polluting shared state?

Use the find-polluter.sh bisection script with the polluted file path and a test pattern. It runs each test file individually and stops at the first one that creates the unwanted file or state, identifying the exact polluting test.

What is defense-in-depth validation and when should I use it?

Defense-in-depth adds validation at every layer data passes through: entry point, business logic, environment guards, and debug instrumentation. Apply it after finding a root cause caused by invalid data, since a single check can be bypassed by other code paths, refactoring, or mocks.