Systematic debugging

From sammcj/agentic-coding · View interactive version

Systematic debugging is an AI agent skill from the GitHub repository sammcj/agentic-coding. Applies a modified Fagan Inspection methodology to resolve persistent bugs and complex issues. Use when several fix or debugging attempts have already failed and a methodical root-cause analysis warranting a Fagan inspection is needed. Do not use for simple troubleshooting.

How to use this skill

Skill file

Systematic Debugging with Fagan Inspection

This skill applies a modified Fagan Inspection methodology for systematic problem resolution when facing complex problems or stubborn bugs that have resisted multiple fix attempts.

Process Overview

Create tasks for each of the four phases, then work them to completion, marking each done before starting the next.

Follow these four phases sequentially. Do not skip phases or attempt fixes before completing the inspection.

Phase 1: Initial Overview

Establish a clear understanding of the problem before analysis:

Output: A clear problem statement that anyone could understand.

Phase 2: Systematic Inspection

Perform a line-by-line walkthrough as the "Reader" role in Fagan Inspection. Identify defects without attempting to fix them yet - this is pure inspection.

Check against these defect categories:

  1. Logic Errors
  2. Boundary Conditions
  3. Error Handling
  4. Data Flow Issues
  5. Integration Points

Talk through the code step by step, as the Reader does in a Fagan inspection. For each section of code:

Output: A categorised list of identified defects with line numbers and specific descriptions.

Phase 3: Root Cause Analysis

After identifying issues, trace back to find the fundamental cause - not just symptoms.

Five Whys Technique:

Consider:

State assumptions explicitly:

Output: A clear statement of the root cause, the chain of reasoning that led to it, and any assumptions that need validation.

Phase 4: Solution & Verification

Now propose specific fixes for each identified issue.

For each proposed solution:

  1. Describe the fix - what code/configuration changes are needed
  2. Explain why it resolves the root cause - connect it back to Phase 3 analysis
  3. Consider side effects - what else might this change affect
  4. Define verification steps - how to confirm the fix works

Verification Planning:

Use a sub-agent as a sounding board to provide critical feedback on your proposed solutions and verification plan.

Output: A summary of findings (key defects and root cause), a prioritised list of proposed fixes with rationale, and a verification plan for confirming the fixes work.

Important Guidelines

Final Output

After completing all four phases, unless the user indicates otherwise, proceed to implement the proposed solutions.

When This Skill Should NOT Be Used

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.