systematic-debugging

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

3|Updated Sep 18, 2025
One-click install
npx skills add https://github.com/KingMichaelPark/dotfiles --skill systematic-debugging-kingmichaelpark
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: systematic-debugging
Source: https://github.com/KingMichaelPark/dotfiles/tree/main/ai/.agents/skills/systematic-debugging
Command: npx skills add https://github.com/KingMichaelPark/dotfiles --skill systematic-debugging-kingmichaelpark

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Random fixes and quick patches waste time, mask underlying issues, and introduce new bugs. This Skill enforces a disciplined debugging methodology that finds the actual root cause before any fix is attempted, even under time pressure or social pressure to take shortcuts. ## Core Features & Use Cases - Four-Phase Process: Root cause investigation, pattern analysis, hypothesis testing, and implementation, with mandatory completion of each phase before proceeding. - Supporting Techniques: Includes root-cause tracing through call stacks, defense-in-depth validation at multiple layers, and condition-based waiting to replace flaky arbitrary timeouts in tests. - Pressure Resistance: Explicit anti-patterns, red flags, and rationalization tables that stop shortcut behavior during emergencies, exhaustion, or authority pressure. - Use Case: When a production test fails intermittently, use this Skill to trace the failure back through the call chain, form a single hypothesis, create a failing test case, and fix the source rather than adding another sleep timeout. ## 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 a four-phase process: investigate the root cause by reading errors and reproducing the issue, analyze patterns against working examples, form and test a single hypothesis, then implement one fix with a failing test case. Never propose fixes before completing the investigation phase.

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, which eliminates race conditions and typically speeds up test execution.

What should I do when my first fix doesn't work?

Stop and return to root cause investigation with the new information rather than stacking more fixes. If three or more fixes have failed, question the underlying architecture with your team instead of attempting a fourth fix.

How do I trace a bug that appears deep in the call stack?

Trace backward through the call chain by asking what called each function and what values were passed, until you find the original trigger. Add stack trace instrumentation with console.error before the failing operation if manual tracing is not possible.

When is it acceptable to skip systematic debugging for a quick fix?

Never, according to this methodology. Simple bugs have root causes too, and systematic investigation is faster than guess-and-check thrashing even during emergencies, since random fixes create new bugs and guarantee rework.

How do I find which test is polluting shared state or the filesystem?

Use the included find-polluter.sh bisection script, which runs test files one by one and checks whether the unwanted file or directory appears after each run. It stops at the first polluting test and reports the file responsible.