Skip to main content
skill CX Codex

systematic-debugging · bobmatnyc — Claude Code skill for debugging

This skill guides an agent from reproducing a bug to checking the fix. Use it when an error or unexpected behavior has no clear cause.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add bobmatnyc/claude-mpm-skills --skill systematic-debugging -a claude-code
Open on GitHub

What systematic-debugging does

The workflow has five phases: reproduce the bug, isolate the failing component, trace the root cause, fix it, then verify the result. The agent first records the exact error, logs, inputs, and steps needed to trigger the issue. It then narrows down the failure and follows the data path to its source.

For isolation, the skill suggests binary search, checking changes with git log --oneline -20 and git diff, and using targeted logging or a debugger. After a fix, rerun the reproduction case, run the full test suite, and check related edge cases. Fixing before tracing the cause goes against the workflow’s stated order.

The skill includes reference material on the workflow, worked examples, troubleshooting, and anti-patterns. Install it in Claude Code with npx skills add bobmatnyc/claude-mpm-skills --skill systematic-debugging -a claude-code.

What it helps with

  • reproduce a bug from its exact steps and inputs
  • narrow a failure down to a component or data flow
  • trace an error from its symptom to its cause
  • fix the cause instead of masking an exception
  • check a fix with tests and related edge cases

Example prompts for the agent

  • Investigate this error: find a reliable reproduction first, then trace its cause.
  • Find which commit introduced this failure and follow the data path to the bad value.
  • Fix the root cause of this crash, then rerun the reproduction case and tests.

How to install systematic-debugging

1Skills CLI (Vercel)

npx skills add bobmatnyc/claude-mpm-skills --skill systematic-debugging -a claude-code

2Manually: put the files in place

~/.claude/skills/systematic-debugging/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/systematic-debugging/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about systematic-debugging

How do I install systematic-debugging in Claude Code?

Run npx skills add bobmatnyc/claude-mpm-skills --skill systematic-debugging -a claude-code. The skill file is at ~/.claude/skills/systematic-debugging/SKILL.md.

What does systematic-debugging do?

It guides an agent through reproducing a bug, isolating its cause, making a targeted fix, and checking for regressions.

Should the agent fix a bug before tracing its cause?

No. The workflow calls for reproducing and isolating the failure, then tracing the cause before changing code.

Source text

SKILL.md · Apache-2.0
---
name: systematic-debugging
description: "Step-by-step debugging workflow: reproduce the bug, isolate the failing component, trace to root cause, apply a targeted fix, and verify the fix resolves the issue without regressions. Use when you encounter a bug, error, exception, crash, or unexpected behavior that needs troubleshooting."
user-invocable: false
disable-model-invocation: true
license: Apache-2.0
compatibility: claude-code
progressive_disclosure:
  entry_point:
    summary: "Systematic debugging methodology emphasizing root cause analysis over quick fixes"
    when_to_use: "When debugging issues, tracing errors, fixing bugs, troubleshooting crashes, investigating exceptions, or diagnosing 'not working' reports."
    quick_start: "1. Reproduce the bug reliably. 2. Isolate the failing component. 3. Trace to root cause. 4. Fix at root cause. 5. Verify fix + no regressions."
  references:
    - workflow.md
    - anti-patterns.md
    - examples.md
    - troubleshooting.md
---
# Systematic Debugging

## When to Use

- A bug, error, exception, or crash needs investigation
- Something is "not working" and the cause is unclear
- A test is failing and the reason isn't obvious
- Unexpected behavior needs troubleshooting in any language or framework

## Core Workflow

Follow these five phases sequentially. Do not skip ahead to fixing before completing isolation and tracing.

### Phase 1: Reproduce

Establish a reliable way to trigger the bug before doing anything else.

1. Read the full error message, stack trace, and logs — note exact text, line numbers, and error codes
2. Create a minimal reproduction case that triggers the issue consistently
3. Record the exact steps, inputs, and environment that cause the failure

**Checkpoint:** Can you trigger the bug on demand? If intermittent, gather more data before proceeding.

### Phase 2: Isolate

Narrow down where the failure originates.

1. Use binary search to find the failing component — disable or stub out halves of the system
2. Check recent changes with `git log --oneline -20` and `git diff` against the last known good state
3. Add targeted logging or use a debugger to observe state at key boundaries

```bash
# Find which commit introduced the bug
git bisect start
git bisect bad HEAD
git bisect good <last-known-good-commit>
# Git will checkout midpoints — test each one and mark good/bad
```

**Checkpoint:** The bug is traced to a specific function, module, or data flow.

### Phase 3: Trace to Root Cause

Understand *why* the failure happens — not just *where*.

1. Read the code path completely from entry point through the failure site
2. Check assumptions: what does each function expect vs. what it actually receives?
3. Trace data flow backward — where does the bad value originate?
4. Verify with evidence: add assertions or print statements to confirm your hypothesis

```python
# Example: verify assumptions about incoming data
def process_order(order):
    assert order.status == "pending", f"Expected pending, got {order.status}"
    assert order.items, "Order has no items"
    # ... rest of processing
```

**Checkpoint:** The chain of causation from trigger to symptom is explained, with supporting evidence (logs, assertions, debugger output).

### Phase 4: Fix at Root Cause

Apply a targeted fix that addresses the actual cause, not just the symptom.

1. Fix the root cause, not a downstream effect
2. Keep the fix minimal — change only what's necessary
3. Avoid "band-aid" fixes that mask the underlying problem (e.g., adding a try/except around a crash without fixing why it crashes)

### Phase 5: Verify

Confirm the fix works and doesn't introduce regressions.

1. Run the reproduction case from Phase 1 — confirm the bug is gone
2. Run the full test suite to check for regressions
3. Test edge cases related to the fix
4. If the bug was missing a test, add one that would have caught it

**Checkpoint:** Reproduction case passes, test suite is green, and you have a new test covering this bug.

## Key Anti-Patterns to Avoid

- **Shotgun debugging**: making random changes hoping something works
- **Fix-and-pray**: applying a fix without understanding the cause
- **Skipping reproduction**: jumping to code changes without confirming you can trigger the bug
- **Fixing symptoms**: wrapping errors in try/catch instead of fixing what produces them

See **[anti-patterns.md](references/anti-patterns.md)** for the full catalog.

## Related Skills

- **[root-cause-tracing](../root-cause-tracing/SKILL.md)**: Deep call-stack tracing techniques — use after Phase 2 when the bug is deep in execution chains
- **[verification-before-completion](../verification-before-completion/SKILL.md)**: Mandatory verification gates — reinforces Phase 5 before claiming a fix is complete

## Deep-Dive References

- **[workflow.md](references/workflow.md)**: Detailed phase-by-phase instructions with decision trees
- **[examples.md](references/examples.md)**: Worked debugging examples across languages
- **[troubleshooting.md](references/troubleshooting.md)**: Common debugging scenarios and solutions
- **[anti-patterns.md](references/anti-patterns.md)**: Patterns to avoid and how to recognize them

© bobmatnyc · Apache-2.0 · bobmatnyc/claude-mpm-skills

Similar skills

All skills for Testing and QA →

systematic-debugging by other authors comes first.

systematic-debugging Jesse Vincent Makes the agent investigate the cause of a failure before it suggests a patch. Use it for failing tests, build errors, and behaviour that does not match expectations. CX Codex 306,118installs systematic-debugging Hermes Agent (adapted from obra/superpowers) A four-phase skill that moves from a reproducible symptom to its root cause. Use it for test failures, build errors, integration issues, and unexpected behavior. CX Codex +1 471installs systematic-debugging spencerpauly Enforces a structured debugging workflow on your AI assistant instead of random edits. It helps isolate elusive bugs and verify root causes with evidence. CX Codex +1 545installs debugging-and-error-recovery addyosmani This skill guides an agent from reproducing a failure to checking the fix. Use it when tests fail, a build breaks, or runtime behavior differs from expectations. CX Codex +1 62,800installs gitnexus-debugging abhigyanpatwari This skill helps trace bugs through symbols, calls, and process flows. Use it when an error needs a source, a caller, or a likely root cause. CX Codex +1 1,700installs debugging mrgoonie Enforces a disciplined debugging methodology that stops guesswork and requires fresh test proof before marking tasks done. CX Codex +1 569installs debugging-wizard https://github.com/Jeffallan Investigates errors, stack traces, and logs to locate failure points. Use it for crashes, exceptions, regressions, or code that behaves unexpectedly. CX Codex +1 5,100installs fix-sentry-issues brianlovin Triages production Sentry errors through Sentry MCP and resolves underlying software defects. Fits investigations of error spikes and Sentry noise cleanup. CX Codex +1 2,700installs fix parcadei A meta-skill that picks a chain of skills for a bug and walks it from diagnosis to commit. Handy when you don't know where to start. CX Codex +1 484installs

From the same set66

openrouter A skill for wiring OpenRouter into your project: one OpenAI-compatible API to 200+ models, with streaming, routing and fallbacks. Useful when you juggle several LLMs. CX Codex +1 403installs better-auth-authentication A skill for TypeScript apps: sets up email and password sign-in, social providers and email verification with Better Auth. CX Codex +1 389installs kysely A skill that teaches your agent Kysely: types from schema to query result, migrations, transactions. Useful when an ORM gets in the way but untyped raw SQL is worse. CX Codex +1 389installs kubernetes A Kubernetes operations playbook for your agent: safe rollouts, health probes, resource sizing and fast kubectl triage. CX Codex +1 383installs vue A Vue 3 skill for your coding agent: Composition API, reactivity, single-file components, Vue Router, Pinia, TypeScript and Vite. Useful when the agent writes Vue frontend code. CX Codex +1 381installs api-documentation A set of rules that tells the agent how to write docstrings, JSDoc, Godoc and endpoint descriptions. Useful when several agents each carry their own copy of the same guidance. CX Codex +1 379installs software-patterns Compares tradeoffs between architectural patterns and points to the one that fits your problem: coupling, resilience, service boundaries. Useful when code resists testing. CX Codex +1 373installs nextjs-v16 A skill that walks a project through the Next.js 16 migration: async request APIs, opt-in caching with "use cache", Turbopack. Useful when upgrading an existing app. CX Codex +1 371installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor