Systematic debugging
Skill pgoell/pgoell-claude-tools/plugins/workbench/skills/systematic-debugging
Collection of my personal claude skills
npx -y skills add pgoell/pgoell-claude-tools --skill systematic-debuggingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
SKILL.md
9.3 KB, ~2.0k tokens by cl100k_base, as published. Nobody here has run it
Systematic Debugging
Overview
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
Core principle: ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
Violating the letter of this process is violating the spirit of debugging.
The Iron Law
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1, you cannot propose fixes.
When to Use
Use for ANY technical issue:
- Test failures
- Bugs in production
- Unexpected behavior
- Performance problems
- Build failures
- Integration issues
Use this ESPECIALLY when:
- Under time pressure (emergencies make guessing tempting)
- "Just one quick fix" seems obvious
- You've already tried multiple fixes
- Previous fix didn't work
- You don't fully understand the issue
Don't skip when:
- Issue seems simple (simple bugs have root causes too)
- You're in a hurry (rushing guarantees rework)
- Manager wants it fixed NOW (systematic is faster than thrashing)
The Four Phases
You MUST complete each phase before proceeding to the next. Each phase below is the orchestrator-level summary; the full step-by-step walk-through, including multi-component evidence-gathering, the architecture-questioning escape hatch, and the "no root cause" edge case, lives in four-phases.md in this directory.
Phase 1: Root Cause Investigation
Read errors carefully, reproduce consistently, check recent changes, and gather evidence at every component boundary in multi-layer systems before forming any theory. If the error is deep in a call stack, trace data flow backward to the source.
See four-phases.md for the full Phase 1 procedure and root-cause-tracing.md for the backward tracing technique.
Phase 2: Pattern Analysis
Find similar working code, read reference implementations completely (no skimming), enumerate every difference between working and broken, and understand all dependencies before fixing.
See four-phases.md for the full Phase 2 procedure.
Phase 3: Hypothesis and Testing
Form one specific hypothesis ("I think X is the root cause because Y"), make the smallest possible change to test it, change one variable at a time, and form a new hypothesis on failure rather than stacking fixes.
See four-phases.md for the full Phase 3 procedure.
Phase 4: Implementation
Create a failing test case before fixing anything, implement one targeted fix at the root cause (no bundled refactoring), and verify. If 3+ fixes have failed: stop and question the architecture. That pattern means the design is wrong, not the hypothesis.
See four-phases.md for the full Phase 4 procedure including the architecture-questioning protocol.
Quick Reference
| Phase | Key Activities | Success Criteria |
|---|---|---|
| 1. Root Cause | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
| 2. Pattern | Find working examples, compare | Identify differences |
| 3. Hypothesis | Form theory, test minimally | Confirmed or new hypothesis |
| 4. Implementation | Create test, fix, verify | Bug resolved, tests pass |
Red Flags - STOP and Follow Process
If you catch yourself thinking:
- "Quick fix for now, investigate later"
- "Just try changing X and see if it works"
- "Add multiple changes, run tests"
- "Skip the test, I'll manually verify"
- "It's probably X, let me fix that"
- "I don't fully understand but this might work"
- "Pattern says X but I'll adapt it differently"
- "Here are the main problems: [lists fixes without investigation]"
- Proposing solutions before tracing data flow
- "One more fix attempt" (when already tried 2+)
- Each fix reveals new problem in different place
ALL of these mean: STOP. Return to Phase 1.
If 3+ fixes failed: Question the architecture (see Phase 4 in four-phases.md).
Your Human Partner's Signals You're Doing It Wrong
Watch for these redirections:
- "Is that not happening?" - You assumed without verifying
- "Will it show us...?" - You should have added evidence gathering
- "Stop guessing" - You're proposing fixes without understanding
- "Ultrathink this" - Question fundamentals, not just symptoms
- "We're stuck?" (frustrated) - Your approach isn't working
When you see these: STOP. Return to Phase 1.
Common Rationalizations
| Excuse | Reality |
|---|---|
| "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
Supporting Techniques
These references in this directory deepen specific phases:
four-phases.md- Full step-by-step walk-through of Phases 1 to 4, the architecture-questioning protocol, the "no root cause" edge case, and real-world impact data.root-cause-tracing.md- Trace bugs backward through the call stack to find the original trigger (Phase 1, step 5).defense-in-depth.md- Add validation at multiple layers once root cause is fixed (Phase 4 follow-up).condition-based-waiting.md- Replace arbitrary timeouts with condition polling when debugging flaky timing (Phase 1 evidence gathering).
Related Skills
- workbench:test-driven-development - For creating the failing test case in Phase 4, Step 1.
- workbench:verification-before-completion - Verify the fix worked before claiming success.
Output Format
Default for this artifact: html.
Override resolution order, highest precedence first:
- Per-invocation override in the user prompt. Recognize phrases like
"a markdown debug report","in HTML","as a markdown report", and equivalents. .workbench/config.md## Output formatsentry forDebug reports:. Schema documented inplugins/workbench/skills/autopilot/references/config-schema.md.- Per-skill hard-coded default (html).
Path: .workbench/debug-reports/YYYY-MM-DD-<topic>-debug.<ext> by default. Override path via .workbench/config.md ## Output paths Debug reports:.
When emitting HTML, follow references/debug-report-template.html in this skill's directory. Read the template lazily.
Report File Behavior
At the end of the four-phase loop, after the fix is verified, write a debug report file to the resolved path. The report captures:
- Hypothesis tree from Phase 1.
- "What I tried" timeline from Phase 2.
- Root cause from Phase 3.
- Fix description and validation from Phase 4.
Announce the file path in the conversation when emitting (for example: "Debug report written to .workbench/debug-reports/2026-05-08-cache-stale-debug.html") before the final summary message.
For other HTML artifact types not covered by a workbench or research skill, see workbench:crafting-html.
Applying a design system
Before emitting HTML, check for an active design system and inline its overrides into the artifact's <style> block:
- Resolve the design-system name: per-prompt override (e.g., "render with the
brand-2026design system"), then.workbench/config.md## Design systemName:, then no override. - Locate the directory:
.workbench/design-systems/<name>/(project scope), then~/.claude/workbench/design-systems/<name>/(user scope). If a name resolves but no directory is found at either scope, report the missing path to the user and emit with template defaults; do not fabricate a substitute. - Inline
colors.css(andtypography.cssif present) after the template's own:rootdeclarations, so the design system's values win the cascade. - For any referenced component, paste
components/<n>.htmlmarkup and scoped style into the artifact body. - For any referenced image, base64-encode (
base64 -w 0 <file>) and inline asdata:image/<type>;base64,<payload>. SVG is text and can be inlined directly. Use relative paths only when the artifact and the design system co-exist in the same git tree and the artifact will not travel.
To create or edit a design system, see workbench:crafting-design-systems.
What ships with it: 7 files
46.0 KB alongside SKILL.md, 2 of them executable
references/
- debug-report-template.html21.6 KB
- condition-based-waiting-example.tsruns4.9 KB
- condition-based-waiting.md3.6 KB
- defense-in-depth.md3.6 KB
- find-polluter.shruns1.5 KB
- four-phases.md5.6 KB
- root-cause-tracing.md5.2 KB