systematic-debugging

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

Updated Nov 25, 2024
One-click install
npx skills add https://github.com/cbrostrom/dotfiles --skill systematic-debugging-cbrostrom
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: systematic-debugging
Source: https://github.com/cbrostrom/dotfiles/tree/main/stow/agents/.agents/skills/systematic-debugging
Command: npx skills add https://github.com/cbrostrom/dotfiles --skill systematic-debugging-cbrostrom

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Random fixes and quick patches mask underlying issues, waste hours on symptom-chasing, and introduce new bugs. This Skill enforces a disciplined debugging methodology that finds the actual root cause before any fix is attempted. ## 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. - Pressure Resistance: Explicit anti-patterns, red flags, and rationalization tables that prevent shortcut fixes under time pressure, authority pressure, or exhaustion. - Use Case: When a test fails intermittently in CI, follow Phase 1 to gather evidence at each component boundary, trace the bad value to its source, then fix at the origin with a failing test case instead of adding another sleep() call. ## Quick Start Ask the AI to debug a failing test or bug using the systematic-debugging skill and require root cause investigation before any fix is proposed.

Frequently Asked Questions about systematic-debugging

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

FAQPage Schema
How do I debug a test failure systematically instead of guessing?▼

Follow the four phases: investigate the root cause by reading errors and reproducing consistently, 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 find the root cause of a bug deep in the call stack?▼

Trace backward through the call chain from the immediate cause to the original trigger, asking what called each level and what value was passed. Add stack trace instrumentation with console.error before the failing operation if manual tracing is not possible.

How do I fix flaky tests caused by timing issues?▼

Replace arbitrary setTimeout or sleep delays 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 timeout, and only use fixed delays when testing actual timing behavior.

What should I do when my first fix does not work?▼

Stop and return to Phase 1 to re-analyze with the new information rather than stacking more fixes. If three or more fixes have failed, question the underlying architecture and discuss with your team before attempting another fix.

When is it acceptable to skip root cause investigation for a quick fix?▼

Never, according to this methodology. Even under production emergencies or time pressure, systematic investigation is faster than guess-and-check thrashing, and symptom fixes are treated as failures that mask the real problem.

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.