systematic-debugging

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

1|1|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/williamthorsen/codeassembly --skill systematic-debugging-williamthorsen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: systematic-debugging
Source: https://github.com/williamthorsen/codeassembly/tree/main/packages/agents/content/skills/systematic-debugging
Command: npx skills add https://github.com/williamthorsen/codeassembly --skill systematic-debugging-williamthorsen

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 root cause before any fix is attempted, replacing guess-and-check thrashing with a repeatable process. ## Core Features & Use Cases - Four-Phase Debugging Process: Enforces root cause investigation, pattern analysis, hypothesis testing, and verified implementation in strict sequence. - 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. - Pollution Bisection Script: Ships a shell script that runs tests one-by-one to identify which test creates unwanted files or state. - Use Case: When a test fails intermittently or a production bug resists obvious fixes, apply the process to reproduce the issue, trace the bad value to its source, form a single hypothesis, and verify one minimal fix with a failing test. ## 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 debug a test failure systematically instead of guessing?

Follow the four phases: first investigate the root cause by reading errors fully and reproducing consistently, then compare against working examples, form one hypothesis and test it minimally, and finally implement a single fix verified by a failing test. Never propose fixes before completing root cause investigation.

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 arbitrary delays when testing actual timing behavior with a documented reason.

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, fix at the source, then add validation at each layer the data passes through.

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 the filesystem or state?

Use the find-polluter.sh bisection script with the file to check and a test pattern, such as ./find-polluter.sh '.git' 'src/**/*.test.ts'. It runs each test individually and stops at the first one that creates the unwanted file or directory.

Is it acceptable to skip root cause investigation for simple bugs or emergencies?

No. The skill explicitly states simple bugs have root causes too and systematic investigation is faster than guess-and-check thrashing even under time pressure. Skipping the process is treated as a red flag regardless of urgency.