From jc
Guides systematic root-cause investigation. Use any time something isn't working and you're about to change code — whether it looks like a bug, a test failure, or just something that needs a quick fix. Especially valuable under time pressure, when "just one quick fix" seems obvious, after multiple failed fixes, or when the issue isn't fully understood. Do NOT use when you can spawn subagents (use /jc:debug to spawn the team-debugger instead).
How this skill is triggered — by the user, by Claude, or both
Slash command
/jc:debug-methodologyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Random fixes waste time and create new bugs — always find root cause before attempting fixes. Quick patches mask underlying issues and create new ones.
Random fixes waste time and create new bugs — always find root cause before attempting fixes. Quick patches mask underlying issues and create new ones.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
| Phase | Key Activities | Output |
|---|---|---|
| 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 |
BEFORE attempting ANY fix:
Read Error Messages Carefully
Reproduce Consistently
Check Recent Changes
Gather Evidence in Multi-Component Systems
WHEN system has multiple components (CI → build → signing, API → service → database):
For EACH component boundary, add diagnostic logging:
Run once → analyse evidence showing WHERE it breaks → investigate that specific component.
Trace Data Flow
WHEN error is deep in call stack:
See ../../references/debugging/root-cause-tracing.md for the complete backward tracing technique.
Find the pattern before fixing:
Scientific method:
Fix the root cause, not the symptom:
Create Failing Test Case — Simplest reproduction, automated if possible. Use the test-driven-development skill.
Implement Single Fix — ONE change addressing root cause. No "while I'm here" improvements.
Verify Fix — Test passes? No other tests broken? Issue resolved?
If Fix Doesn't Work
After three targeted fixes each miss, the probability that the problem is architectural rather than single-cause rises sharply — continuing to fix symptoms wastes time on a design that's fighting you.
If 3+ Fixes Failed: Question Architecture
Pattern indicating architectural problem:
STOP and question fundamentals:
Discuss with the user before attempting more fixes. This is NOT a failed hypothesis — this is a wrong architecture.
If No Root Cause Found After Full Investigation
If systematic investigation reveals issue is truly environmental, timing-dependent, or external:
But: Most "no root cause" conclusions mean investigation was incomplete — resume from Step 1 before accepting an environmental cause.
If you catch yourself thinking any of these, STOP. Return to Root Cause Investigation.
If 3+ fixes failed: Question the architecture (see Step 4, item 5).
When you see these: STOP. Return to Root Cause Investigation.
| Excuse | Reality |
|---|---|
| "Issue is simple, don't need process" | Process is fast for simple bugs. |
| "Emergency, no time for process" | Systematic 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. You see the symptom, not all the callers, edge cases, or recent changes. |
| "User explicitly told me to skip investigation" | User is in pain, not debugging. Your job is to find root cause, not comply with panic. |
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
Located in ../../references/debugging/ (relative to this skill's directory):
root-cause-tracing.md — backward call-stack tracingdefense-in-depth.md — multi-layer validation after root cause fixcondition-based-waiting.md — condition polling instead of arbitrary timeoutstest-driven-development — TDD process discipline for creating failing tests before fixesnpx claudepluginhub jamesacarr/claude --plugin jcGuides developers through systematic root cause investigation of bugs and failures. Use when encountering test failures, errors, or unexpected behavior.
Enforces systematic root cause investigation for bugs, test failures, and unexpected behavior through four phases: investigation, pattern analysis, hypothesis testing, and implementation.
Enforces systematic root cause analysis before fixes for bugs, test failures, unexpected behavior, performance issues, and build failures.