agentleFS
nicodiansknicodiansk/turbocharge/skills/debug/SKILL.md

debug

Skill2 starsChanged 11 months agoMITView on GitHub

Use when encountering any bug, test failure, or unexpected behavior. Enforces systematic root-cause investigation before proposing fixes. Prevents guess-and-check debugging.

We split this skill into the rules it gives an agent

20 rules. 0 are common, 20 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 166 edited versions we read keep these.

  • 20

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Core principle: ALWAYS find root cause before attempting fixes.

    line 12
  2. Distinctive:

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

    line 22
  3. Distinctive:

    Don't skip past errors or warnings

    line 33
  4. Distinctive:

    Read stack traces completely

    line 35
  5. Distinctive:

    If not reproducible → gather more data, don't guess

    line 42
  6. Distinctive:

    Keep tracing up until you find the source

    line 62
  7. Distinctive:

    If implementing pattern, read reference implementation COMPLETELY

    line 74
  8. Distinctive:

    Don't skim - read every line

    line 75
  9. Distinctive:

    Don't assume "that can't matter"

    line 81
  10. Distinctive:

    Don't fix multiple things at once

    line 100
  11. Distinctive:

    DON'T add more fixes on top

    line 105
  12. Distinctive:

    Don't pretend to know

    line 109
  13. Distinctive:

    MUST have before fixing

    line 121
  14. Distinctive:

    No other tests broken?

    line 132
  15. Distinctive:

    If < 3: Return to Phase 1, re-analyze with new information

    line 138
  16. Distinctive:

    DON'T attempt Fix #4 without architectural discussion

    line 140
  17. Distinctive:

    Should we refactor architecture vs.

    line 152
  18. Distinctive:

    If 3+ fixes failed: question the architecture (see Phase 4, step 5).

    line 169
  19. Distinctive:

    review: - Verify fix worked before claiming success

    line 189
  20. Distinctive:

    Before declaring a bug fixed:

    line 196

“Common” is measured: kept by at least 6 in 10 of the 166 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.

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
    • Don't skip past errors or warnings
    • They often contain the exact solution
    • Read stack traces completely
    • Note line numbers, file paths, error codes
  2. Reproduce Consistently
    • Can you trigger it reliably?
    • What are the exact steps?
    • Does it happen every time?
    • If not reproducible → gather more data, don't guess
  3. Check Recent Changes
    • What changed that could cause this?
    • Git diff, recent commits
    • New dependencies, config changes
    • Environmental differences
  4. Gather Evidence at Component Boundaries For multi-component systems: log what enters and exits each component. Run once to find WHERE it breaks, then investigate that specific component.
  5. 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
    • Locate similar working code in same codebase
    • What works that's similar to what's broken?
  2. Compare Against References
    • If implementing pattern, read reference implementation COMPLETELY
    • Don't skim - read every line
    • Understand the pattern fully before applying
  3. Identify Differences
    • What's different between working and broken?
    • List every difference, however small
    • Don't assume "that can't matter"
  4. Understand Dependencies
    • What other components does this need?
    • What settings, config, environment?
    • What assumptions does it make?

Phase 3: Hypothesis and Testing

Scientific method:

  1. Form Single Hypothesis
    • State clearly: "I think X is the root cause because Y"
    • Write it down
    • Be specific, not vague
  2. Test Minimally
    • Make the SMALLEST possible change to test hypothesis
    • One variable at a time
    • Don't fix multiple things at once
  3. Verify Before Continuing
    • Did it work? Yes → Phase 4
    • Didn't work? Form NEW hypothesis
    • DON'T add more fixes on top
  4. When You Don't Know
    • Say "I don't understand X"
    • Don't pretend to know
    • Ask for help
    • Research more

Phase 4: Implementation

Fix the root cause, not the symptom:

  1. Create Failing Test Case
    • Simplest possible reproduction
    • Automated test if possible
    • One-off test script if no framework
    • MUST have before fixing
    • TDD is baked into the builder agent — use it
  2. Implement Single Fix
    • Address the root cause identified
    • ONE change at a time
    • No "while I'm here" improvements
    • No bundled refactoring
  3. Verify Fix
    • Test passes now?
    • No other tests broken?
    • Issue actually resolved?
  4. If Fix Doesn't Work
    • STOP
    • Count: How many fixes have you tried?
    • If < 3: Return to Phase 1, re-analyze with new information
    • If ≥ 3: STOP and question the architecture (step 5 below)
    • DON'T attempt Fix #4 without architectural discussion
  5. 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.

Red Flags — STOP and Return to Phase 1

ThoughtWhy It's Wrong
"Quick fix for now, investigate later"First fix sets the pattern. Do it right from the start
"Just try changing X and see if it works"Seeing symptoms ≠ understanding root cause
"Skip the test, I'll manually verify"Untested fixes don't stick
"Multiple changes at once, run tests"Can't isolate what worked. Causes new bugs
"I don't fully understand but this might work"Partial understanding guarantees bugs
"One more fix attempt" (after 2+ failures)3+ failures = architectural problem. Question pattern, don't fix again

If 3+ fixes failed: question the architecture (see Phase 4, step 5).

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

Integration

Workflow position:

[bug/failure] → debug → build (for fix) → review

Chains to:

  • build - For implementing the fix with TDD via builder agent
  • review - Verify fix worked before claiming success

Chains from:

  • Entry point skill - triggered by any bug, test failure, or unexpected behavior

Verification Checklist

Before declaring a bug fixed:

  • Root cause identified (not just symptoms)
  • Evidence gathered through systematic investigation
  • Failing test case created before fix
  • Single fix applied (not multiple changes)
  • Fix addresses root cause, not symptom
  • All tests pass after fix
  • No regressions introduced

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.