Debug mastery

From xenitV1/claude-code-maestro · View interactive version

Debug mastery is an AI agent skill from the GitHub repository xenitV1/claude-code-maestro. Systematic debugging methodology with 4-phase process, root cause tracing, and elite observability standards. No fixes without investigation.

How to use this skill

Skill file

<domain_overview>

🐛 DEBUG MASTERY: SYSTEMATIC DEBUGGING

Philosophy: Random fixes waste time and create new bugs. Quick patches mask underlying issues. ALWAYS find root cause before attempting fixes.

FORENSIC ANALYSIS MANDATE (CRITICAL): Never apply a fix without a confirmed root cause. AI-generated fixes often address symptoms rather than underlying architectural logic. You MUST perform a 'Forensic Investigation' that identifies the specific assumption or boundary condition that failed. For every fix, you must provide a brief analysis note explaining WHY the original architecture allowed the bug to exist, transforming every error into a systemic engineering lesson.


🚨 THE IRON LAW

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

If you haven't completed Phase 1, you cannot propose fixes.

Violating the letter of this process is violating the spirit of debugging.


📋 WHEN TO USE

Use for ANY technical issue:

Use ESPECIALLY when:

Don't skip when:

</domain_overview>

<debugging_phases>

🔄 THE FOUR PHASES

You MUST complete each phase before proceeding to the next.

Phase 1: Root Cause Investigation

BEFORE attempting ANY fix:

  1. Read Error Messages Carefully
  1. Reproduce Consistently
  1. Check Recent Changes
  1. Gather Evidence in Multi-Component Systems

WHEN system has multiple components (CI → build → signing, API → service → database):

BEFORE proposing fixes, add diagnostic instrumentation:

```

For EACH component boundary:

Run once to gather evidence showing WHERE it breaks

THEN analyze evidence to identify failing component

THEN investigate that specific component

```

  1. Trace Data Flow

WHEN error is deep in call stack:

See @root-cause-tracing.md for the complete backward tracing technique.

Quick version:

Phase 2: Pattern Analysis

Find the pattern before fixing:

  1. Find Working Examples
  1. Compare Against References
  1. Identify Differences
  1. Understand Dependencies

Phase 3: Hypothesis and Testing

Scientific method:

  1. Form Single Hypothesis
  1. Test Minimally
  1. Verify Before Continuing
  1. When You Don't Know

Phase 4: Implementation

Fix the root cause, not the symptom:

  1. Create Failing Test Case
  1. Implement Single Fix
  1. Verify Fix
  1. If Fix Doesn't Work
  1. If 3+ Fixes Failed: Question Architecture

Pattern indicating architectural problem:

STOP and question fundamentals:

Discuss with user before attempting more fixes

This is NOT a failed hypothesis - this is a wrong architecture.

</debugging_phases>

<red_flags_and_rationalizations>

🚨 RED FLAGS - STOP AND FOLLOW PROCESS

If you catch yourself thinking:

ALL of these mean: STOP. Return to Phase 1.

If 3+ fixes failed: Question the architecture (see Phase 4.5)


🚫 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. |

</red_flags_and_rationalizations>

<observability_and_references>

📊 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 |


🛠️ SUPPORTING TECHNIQUES

These techniques are part of systematic debugging:


🛰️ OBSERVABILITY TOOLING

Precision Logging (JSON-First)

Mandatory Fields: timestamp, level, traceId, component, message, context

Log Levels:

Distributed Tracing

  1. Propagation: Every request/action carries TraceID
  2. Span Definition: Wrap tool calls and complex logic to measure latency

Domain-Specific Troubleshooting

Frontend:

Backend:

Extensions (MV3):


📈 REAL-WORLD IMPACT

From debugging sessions:


🔗 RELATED SKILLS

</observability_and_references>

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.