Skill Tracer
Skills › Superpowers › systematic-debugging

systematic-debugging

skill · 283 lines · MIT · skills/systematic-debugging/SKILL.md

The facts

Its description

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

The description the agent reads to decide when to use it.

From its settingsline 3

When it starts

The agent picks this skill whenever a person reports a bug, a failing test, or any unexpected behavior, and it is meant to be loaded before the agent proposes any fix. The description frames it as the thing to reach for at the moment a problem is described, not after a fix has been tried.

Things a person might say (the model's guesses)

  • “My test suite is failing and I can't figure out why”
  • “The checkout endpoint started returning 500s in production this morning”
  • “This function returns the wrong total sometimes — can you fix it?”

A model's summary of when it is used.

A model's reading

Files it mentions

root-cause-tracing.md, defense-in-depth.md, condition-based-waiting.md

Files the text names, such as ones to read or write. Found by matching words, so treat them as pointers.

Found by matching wordsline 112 line 281 line 282 line 283

Stops for a person

1 line stops to ask a person

Lines that stop and wait for a person before going on. Found by matching words, so treat them as pointers.

Found by matching wordsline 210

What it leads to

Other skills this one hands off to, calls, requires or offers instead, as a model read them.

A model's reading

What leads to it

Other skills that hand off to this one, call it, require it or offer it instead, as a model read them.

A model's reading

Names skills outside this collection

Skills the text names that are not in this collection, as a model read them.

A model's reading

Licence

MIT, from LICENSE

The terms its author shares it under, which let it be shown here.

From the repositorylicence text
Other files in this skill (10) Close

The text

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1---
2name: systematic-debugging
3description: Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
4---
5
6# Systematic Debugging
7

Systematic Debugging

Raw lines 1 to 7
8## Overview
9
10**Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
12**Violating the letter of this process is violating the spirit of debugging.**

Overview

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.

Raw lines 8 to 13
14## The Iron Law
16```
17NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
18```
20If you haven't completed Phase 1, you cannot propose fixes.

The Iron Law

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

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

Raw lines 14 to 21
22## When to Use
24Use for ANY technical issue:
25- Test failures
26- Bugs in production
27- Unexpected behavior
28- Performance problems
29- Build failures
30- Integration issues
32**Use this ESPECIALLY when:**
33- Under time pressure (emergencies make guessing tempting)
34- "Just one quick fix" seems obvious
35- You've already tried multiple fixes
36- Previous fix didn't work
37- You don't fully understand the issue
39**Don't skip when:**
40- Issue seems simple (simple bugs have root causes too)
41- You're in a hurry (rushing guarantees rework)
42- Manager wants it fixed NOW (systematic is faster than thrashing)

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)
Raw lines 22 to 43
44## The Four Phases
46You MUST complete each phase before proceeding to the next.

The Four Phases

You MUST complete each phase before proceeding to the next.

Raw lines 44 to 47
48### Phase 1: Root Cause Investigation
50**BEFORE attempting ANY fix:**
521. **Read Error Messages Carefully**
53 - Don't skip past errors or warnings
54 - They often contain the exact solution
55 - Read stack traces completely
56 - Note line numbers, file paths, error codes
582. **Reproduce Consistently**
59 - Can you trigger it reliably?
60 - What are the exact steps?
61 - Does it happen every time?
62 - If not reproducible → gather more data, don't guess
643. **Check Recent Changes**
65 - What changed that could cause this?
66 - Git diff, recent commits
67 - New dependencies, config changes
68 - Environmental differences
704. **Gather Evidence in Multi-Component Systems**
72 **WHEN system has multiple components (CI → build → signing, API → service → database):**
74 **BEFORE proposing fixes, add diagnostic instrumentation:**
75 ```
76 For EACH component boundary:
77 - Log what data enters component
78 - Log what data exits component
79 - Verify environment/config propagation
80 - Check state at each layer
82 Run once to gather evidence showing WHERE it breaks
83 THEN analyze evidence to identify failing component
84 THEN investigate that specific component
85 ```
87 **Example (multi-layer system):**
88 ```bash
89 # Layer 1: Workflow
90 echo "=== Secrets available in workflow: ==="
91 echo "IDENTITY: $([ -n "${IDENTITY:-}" ] && echo SET || echo UNSET)"
93 # Layer 2: Build script
94 echo "=== Env vars in build script: ==="
95 printenv IDENTITY >/dev/null 2>&1 && echo "IDENTITY in environment" || echo "IDENTITY not in environment"
97 # Layer 3: Signing script
98 echo "=== Keychain state: ==="
99 security list-keychains
100 security find-identity -v
102 # Layer 4: Actual signing
103 codesign --sign "$IDENTITY" --verbose=4 "$APP"
104 ```
106 **This reveals:** Which layer fails (secrets → workflow ✓, workflow → build ✗)
1085. **Trace Data Flow**
110 **WHEN error is deep in call stack:**
112 See `root-cause-tracing.md` in this directory for the complete backward tracing technique.
114 **Quick version:**
115 - Where does bad value originate?
116 - What called this with bad value?
117 - Keep tracing up until you find the source
118 - Fix at source, not at symptom

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
  1. Reproduce Consistently
  2. Can you trigger it reliably?
  3. What are the exact steps?
  4. Does it happen every time?
  5. If not reproducible → gather more data, don't guess
  1. Check Recent Changes
  2. What changed that could cause this?
  3. Git diff, recent commits
  4. New dependencies, config changes
  5. Environmental differences
  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:

  • 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: $([ -n "${IDENTITY:-}" ] && echo SET || echo UNSET)"

# Layer 2: Build script echo "=== Env vars in build script: ===" printenv IDENTITY >/dev/null 2>&1 && echo "IDENTITY in environment" || 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
Raw lines 48 to 119
Reads a file root-cause-tracing.md :112
120### Phase 2: Pattern Analysis
122**Find the pattern before fixing:**
1241. **Find Working Examples**
125 - Locate similar working code in same codebase
126 - What works that's similar to what's broken?
1282. **Compare Against References**
129 - If implementing pattern, read reference implementation COMPLETELY
130 - Don't skim - read every line
131 - Understand the pattern fully before applying
1333. **Identify Differences**
134 - What's different between working and broken?
135 - List every difference, however small
136 - Don't assume "that can't matter"
1384. **Understand Dependencies**
139 - What other components does this need?
140 - What settings, config, environment?
141 - What assumptions does it make?

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?
  1. Compare Against References
  2. If implementing pattern, read reference implementation COMPLETELY
  3. Don't skim - read every line
  4. Understand the pattern fully before applying
  1. Identify Differences
  2. What's different between working and broken?
  3. List every difference, however small
  4. Don't assume "that can't matter"
  1. Understand Dependencies
  2. What other components does this need?
  3. What settings, config, environment?
  4. What assumptions does it make?
Raw lines 120 to 142
143### Phase 3: Hypothesis and Testing
145**Scientific method:**
1471. **Form Single Hypothesis**
148 - State clearly: "I think X is the root cause because Y"
149 - Write it down
150 - Be specific, not vague
1522. **Test Minimally**
153 - Make the SMALLEST possible change to test hypothesis
154 - One variable at a time
155 - Don't fix multiple things at once
1573. **Verify Before Continuing**
158 - Did it work? Yes → Phase 4
159 - Didn't work? Form NEW hypothesis
160 - DON'T add more fixes on top
1624. **When You Don't Know**
163 - Say "I don't understand X"
164 - Don't pretend to know
165 - Ask for help
166 - Research more

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
  1. Test Minimally
  2. Make the SMALLEST possible change to test hypothesis
  3. One variable at a time
  4. Don't fix multiple things at once
  1. Verify Before Continuing
  2. Did it work? Yes → Phase 4
  3. Didn't work? Form NEW hypothesis
  4. DON'T add more fixes on top
  1. When You Don't Know
  2. Say "I don't understand X"
  3. Don't pretend to know
  4. Ask for help
  5. Research more
Raw lines 143 to 167
168### Phase 4: Implementation
170**Fix the root cause, not the symptom:**
1721. **Create Failing Test Case**
173 - Simplest possible reproduction
174 - Automated test if possible
175 - One-off test script if no framework
176 - MUST have before fixing
177 - Use the `superpowers:test-driven-development` skill for writing proper failing tests
1792. **Implement Single Fix**
180 - Address the root cause identified
181 - ONE change at a time
182 - No "while I'm here" improvements
183 - No bundled refactoring
1853. **Verify Fix**
186 - Test passes now?
187 - No other tests broken?
188 - Issue actually resolved?
189 - Use the `superpowers:verification-before-completion` skill before claiming success
1914. **If Fix Doesn't Work**
192 - STOP
193 - Count: How many fixes have you tried?
194 - If < 3: Return to Phase 1, re-analyze with new information
195 - **If ≥ 3: STOP and question the architecture (step 5 below)**
196 - DON'T attempt Fix #4 without architectural discussion
1985. **If 3+ Fixes Failed: Question Architecture**
200 **Pattern indicating architectural problem:**
201 - Each fix reveals new shared state/coupling/problem in different place
202 - Fixes require "massive refactoring" to implement
203 - Each fix creates new symptoms elsewhere
205 **STOP and question fundamentals:**
206 - Is this pattern fundamentally sound?
207 - Are we "sticking with it through sheer inertia"?
208 - Should we refactor architecture vs. continue fixing symptoms?
210 **Discuss with your human partner before attempting more fixes**
212 This is NOT a failed hypothesis - this is a wrong architecture.

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
  1. Implement Single Fix
  2. Address the root cause identified
  3. ONE change at a time
  4. No "while I'm here" improvements
  5. No bundled refactoring
  1. Verify Fix
  2. Test passes now?
  3. No other tests broken?
  4. Issue actually resolved?
  5. Use the superpowers:verification-before-completion skill before claiming success
  1. If Fix Doesn't Work
  2. STOP
  3. Count: How many fixes have you tried?
  4. If < 3: Return to Phase 1, re-analyze with new information
  5. If ≥ 3: STOP and question the architecture (step 5 below)
  6. DON'T attempt Fix #4 without architectural discussion
  1. If 3+ Fixes Failed: Question Architecture

Pattern indicating architectural problem:

  • Each fix reveals new shared state/coupling/problem in different place
  • Fixes require "massive refactoring" to implement
  • Each fix creates new symptoms elsewhere

STOP and question fundamentals:

  • Is this pattern fundamentally sound?
  • Are we "sticking with it through sheer inertia"?
  • Should we refactor architecture vs. continue fixing symptoms?

Discuss with your human partner before attempting more fixes

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

Raw lines 168 to 213
Names a skill test-driven-development :177
Involves a person Discuss with your human partner :210
214## Red Flags - STOP and Follow Process
216If you catch yourself thinking:
217- "Quick fix for now, investigate later"
218- "Just try changing X and see if it works"
219- "Add multiple changes, run tests"
220- "Skip the test, I'll manually verify"
221- "It's probably X, let me fix that"
222- "I don't fully understand but this might work"
223- "Pattern says X but I'll adapt it differently"
224- "Here are the main problems: [lists fixes without investigation]"
225- Proposing solutions before tracing data flow
226- **"One more fix attempt" (when already tried 2+)**
227- **Each fix reveals new problem in different place**
229**ALL of these mean: STOP. Return to Phase 1.**
231**If 3+ fixes failed:** Question the architecture (see Phase 4.5)

Red Flags - STOP and Follow Process

If you catch yourself thinking:

  • "Quick fix for now, investigate later"
  • "Just try changing X and see if it works"
  • "Add multiple changes, run tests"
  • "Skip the test, I'll manually verify"
  • "It's probably X, let me fix that"
  • "I don't fully understand but this might work"
  • "Pattern says X but I'll adapt it differently"
  • "Here are the main problems: [lists fixes without investigation]"
  • Proposing solutions before tracing data flow
  • "One more fix attempt" (when already tried 2+)
  • Each fix reveals new problem in different place

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

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

Raw lines 214 to 232
233## your human partner's Signals You're Doing It Wrong
235**Watch for these redirections:**
236- "Is that not happening?" - You assumed without verifying
237- "Will it show us...?" - You should have added evidence gathering
238- "Stop guessing" - You're proposing fixes without understanding
239- "Ultra-think this" - Question fundamentals, not just symptoms
240- "We're stuck?" (frustrated) - Your approach isn't working
242**When you see these:** STOP. Return to Phase 1.

your human partner's Signals You're Doing It Wrong

Watch for these redirections:

  • "Is that not happening?" - You assumed without verifying
  • "Will it show us...?" - You should have added evidence gathering
  • "Stop guessing" - You're proposing fixes without understanding
  • "Ultra-think this" - Question fundamentals, not just symptoms
  • "We're stuck?" (frustrated) - Your approach isn't working

When you see these: STOP. Return to Phase 1.

Raw lines 233 to 243
244## Common Rationalizations
246| Excuse | Reality |
247|--------|---------|
248| "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
249| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
250| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
251| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
252| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
253| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
254| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
255| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |

Common Rationalizations

ExcuseReality
"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.
Raw lines 244 to 256
257## Quick Reference
259| Phase | Key Activities | Success Criteria |
260|-------|---------------|------------------|
261| **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
262| **2. Pattern** | Find working examples, compare | Identify differences |
263| **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
264| **4. Implementation** | Create test, fix, verify | Bug resolved, tests pass |

Quick Reference

PhaseKey ActivitiesSuccess Criteria
1. Root CauseRead errors, reproduce, check changes, gather evidenceUnderstand WHAT and WHY
2. PatternFind working examples, compareIdentify differences
3. HypothesisForm theory, test minimallyConfirmed or new hypothesis
4. ImplementationCreate test, fix, verifyBug resolved, tests pass
Raw lines 257 to 265
266## When Process Reveals "No Root Cause"
268If systematic investigation reveals issue is truly environmental, timing-dependent, or external:
2701. You've completed the process
2712. Document what you investigated
2723. Implement appropriate handling (retry, timeout, error message)
2734. Add monitoring/logging for future investigation
275**But:** 95% of "no root cause" cases are incomplete investigation.

When Process Reveals "No Root Cause"

If systematic investigation reveals issue is truly environmental, timing-dependent, or external:

  1. You've completed the process
  2. Document what you investigated
  3. Implement appropriate handling (retry, timeout, error message)
  4. Add monitoring/logging for future investigation

But: 95% of "no root cause" cases are incomplete investigation.

Raw lines 266 to 276
277## Supporting Techniques
279These techniques are part of systematic debugging and available in this directory:
281- **`root-cause-tracing.md`** - Trace bugs backward through call stack to find original trigger
282- **`defense-in-depth.md`** - Add validation at multiple layers after finding root cause
283- **`condition-based-waiting.md`** - Replace arbitrary timeouts with condition polling

Supporting Techniques

These techniques are part of systematic debugging and available in this directory:

Raw lines 277 to 283
Reads a file root-cause-tracing.md :281
Reads a file defense-in-depth.md :282
Reads a file condition-based-waiting.md :283

From obra/superpowers at 2ce8aa1, 2026-10-21. Skills read by DeepSeek V4.1 Flash on 2026-11-04. Summary and techniques by Claude Opus 5.5 on 2026-11-06.