systematic-debugging

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

Updated Sep 16, 2022
One-click install
npx skills add https://github.com/ryuya-matsunawa/dotfiles --skill systematic-debugging-ryuya-matsunawa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: systematic-debugging
Source: https://github.com/ryuya-matsunawa/dotfiles/tree/main/agents/.agents/skills/systematic-debugging
Command: npx skills add https://github.com/ryuya-matsunawa/dotfiles --skill systematic-debugging-ryuya-matsunawa

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 apply a quick patch. ## 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 fixes during emergencies, plus a rule to question the architecture after three failed fixes. - Use Case: A test fails intermittently in CI. Instead of adding longer sleep delays, follow Phase 1 to reproduce and gather evidence, trace the data flow to the source, then fix the root cause with a failing test that proves the fix. ## Quick Start Use the systematic-debugging skill to investigate this test failure 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 error messages fully, reproduce the issue consistently, check recent changes, and gather evidence at each component boundary. Then form a single hypothesis, test it minimally, and only implement a fix after the root cause is confirmed.

How to fix flaky tests caused by arbitrary timeouts?▼

Replace setTimeout or 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 a bug appears deep in the call stack?▼

Trace backward through the call chain to find where the bad value originated rather than fixing where the error appears. Add stack trace instrumentation with console.error before the failing operation, then fix at the source and add validation at each layer.

When should I stop trying fixes and question the architecture?▼

Stop after three failed fix attempts. If each fix reveals a new problem in a different place or requires massive refactoring, the pattern itself is likely wrong. Discuss the architecture with your team before attempting a fourth fix.

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

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