JavaScript is disabled. Some features may not work.
systematic-debugging — ★ 236.9K GitHub Stars — Install Guide | SkillsNav
🇺🇸 English🇨🇳 中文
SkillsNav
Home

systematic-debugging

★ 236K repouiSafeIntermediateClaude
🤖 AI Summary

This agent systematically isolates root causes by generating and testing hypotheses against observed failures, then validates fixes with regression checks to prevent new bugs.

How to Install

Claude Code:
git clone --depth 1 https://github.com/obra/superpowers.git && cp superpowers/skills/systematic-debugging ~/.claude/skills/systematic-debugging -r

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.

Phase 1: Root Cause Investigation

BEFORE attempting ANY fix:

  1. Read Error Messages Carefully
  2. Don't skip past errors or warnings
  3. They often contain the exact solution
  4. Read stack traces completely
  5. Note line numbers, file paths, error codes

  6. Reproduce Consistently

  7. Can you trigger it reliably?
  8. What are the exact steps?
  9. Does it happen every time?
  10. If not reproducible → gather more data, don't guess

  11. Check Recent Changes

  12. What changed that could cause this?
  13. Git diff, recent commits
  14. New dependencies, config changes
  15. Environmental differences

  16. 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: - Log what data enters component - Log what data exits component - Verify environment/config propagation - Check state at each layer

Run once to gather evidence showing WHERE it breaks THEN analyze evidence to identify failing component THEN investigate that specific component ```

Example (multi-layer system): ```bash # Layer 1: Workflow echo "=== Secrets available in workflow: ===" echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"

# Layer 2: Build script echo "=== Env vars in build script: ===" env | grep IDENTITY || echo "IDENTITY not in environment"

# Layer 3: Signing script echo "=== Keychain state: ===" security list-keychains security find-identity -v

# Layer 4: Actual signing codesign --sign "$IDENTITY" --verbose=4 "$APP" ```

This reveals: Which layer fails (secrets → workflow ✓, workflow → build ✗)

  1. Trace Data Flow

WHEN error is deep in call stack:

See root-cause-tracing.md in this directory for the complete backward tracing technique.

Quick version: - Where does bad value originate? - What called this with bad value? - Keep tracing up until you find the source - Fix at source, not at symptom

Phase 2: Pattern Analysis

Find the pattern before fixing:

  1. Find Working Examples
  2. Locate similar working code in same codebase
  3. What works that's similar to what's broken?

  4. Compare Against References

  5. If implementing pattern, read reference implementation COMPLETELY
  6. Don't skim - read every line
  7. Understand the pattern fully before applying

  8. Identify Differences

  9. What's different between working and broken?
  10. List every difference, however small
  11. Don't assume "that can't matter"

  12. Understand Dependencies

  13. What other components does this need?
  14. What settings, config, environment?
  15. What assumptions does it make?

Phase 3: Hypothesis and Testing

Scientific method:

  1. Form Single Hypothesis
  2. State clearly: "I think X is the root cause because Y"
  3. Write it down
  4. Be specific, not vague

  5. Test Minimally

  6. Make the SMALLEST possible change to test hypothesis
  7. One variable at a time
  8. Don't fix multiple things at once

  9. Verify Before Continuing

  10. Did it work? Yes → Phase 4
  11. Didn't work? Form NEW hypothesis
  12. DON'T add more fixes on top

  13. When You Don't Know

  14. Say "I don't understand X"
  15. Don't pretend to know
  16. Ask for help
  17. Research more

Phase 4: Implementation

Fix the root cause, not the symptom:

  1. Create Failing Test Case
  2. Simplest possible reproduction
  3. Automated test if possible
  4. One-off test script if no framework
  5. MUST have before fixing
  6. Use the superpowers:test-driven-development skill for writing proper failing tests

  7. Implement Single Fix

  8. Address the root cause identified
  9. ONE change at a time
  10. No "while I'm here" improvemen

Details

Category Design → ui
Sourceobra/superpowers
SKILL.mdView on GitHub →
Repo Stars★ 236.9K
Est. per Skill~16.9K (shared across 14 skills from this repo)
DifficultyIntermediate
Risk LevelSafe

Related Skills

Works Well With

Skills from the same repository — often designed to work together