agentleFS
bordenetbordenet/superpowers-plus/skills/engineering/systematic-debugging/skill.md

systematic-debugging

Skill8 starsChanged 6 months agoMITView on GitHub

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

190 other projects use a version of this, 84 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 20 projects that use this

  • mjunaidcaSkill

    building-chatgpt-apps

    Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode configuration. NOT when building standard MCP servers without widgets (use building-mcp-servers skill instead).

    Also in 4 projects that use this

  • mjunaidcaSkill

    building-chat-interfaces

    Build AI chat interfaces with custom backends, authentication, and context injection. Use when integrating chat UI with AI agents, adding auth to chat, injecting user/page context, or implementing httpOnly cookie proxies. Covers ChatKitServer, useChatKit, and MCP auth patterns. NOT when building simple chatbots without persistence or custom agent integration.

    Also in 4 projects that use this

  • +2 more from Leodorareluctant259
  • +5 more from mjunaidca

The file

We split this skill into the rules it gives an agent

7 rules. 2 are common, 4 are distinctive, and 1 is very specific to this project.

  • 2

    Common

    Most of the 177 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    NOT for: feature design (brainstorming), code review (providing-code-review)

    line 32
  2. Common:

    Core principle: ALWAYS find root cause before attempting fixes.

    line 34
  3. Common:

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

    line 42
  4. Distinctive:

    If the human says any of these, STOP immediately:

    line 46
  5. Distinctive:

    Do not defend the current approach.

    line 55
  6. Distinctive:

    BEFORE attempting ANY fix:

    line 61
  7. Distinctive:

    When fixes keep failing, the problem is usually misdiagnosed.

    line 99

“Common” is measured: kept by at least 6 in 10 of the 177 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

When to Use

  • Any bug, test failure, or unexpected behavior — before proposing fixes
  • Build failures, runtime errors, or flaky tests
  • NOT for: feature design (brainstorming), code review (providing-code-review)

Core principle: ALWAYS find root cause before attempting fixes.

Wrong skill? Feature design → brainstorming. Code review → providing-code-review.

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

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

Human Partner Signals You're Doing It Wrong

If the human says any of these, STOP immediately:

  • "You already tried that"
  • "That's not the problem"
  • "We've been going in circles"
  • "Stop and think about this differently"
  • "You're making this too complicated"
  • "Let's step back"

Do not defend the current approach. Do not continue it. Acknowledge what they said, ask what they're seeing that you're missing, and restart the investigation from scratch.

The Four Phases

Phase 1: Root Cause Investigation

BEFORE attempting ANY fix:

  1. Read Error Messages Carefully — stack traces completely, note line numbers, file paths, error codes
  2. Reproduce Consistently — exact steps, every time? If not reproducible, gather more data, don't guess
  3. Check Recent Changes — git diff, recent commits, new dependencies, config changes
  4. Gather Evidence in Multi-Component Systems — for each component boundary: log what enters, log what exits, verify env/config propagation. Run once to find WHERE it breaks.
  5. Trace Data Flow — where does bad value originate? Trace up the call stack to find the source. Fix at source, not symptom. See root-cause-tracing.md for complete technique.

Phase 2: Pattern Analysis

  1. Find working examples in same codebase — what works that's similar to what's broken?
  2. Compare against references — read reference implementations COMPLETELY, don't skim
  3. Identify differences — list every difference, don't assume "that can't matter"
  4. Understand dependencies — components, settings, config, environment, assumptions

Phase 3: Hypothesis and Testing

  1. Form single hypothesis — "I think X is the root cause because Y"
  2. Test minimally — smallest possible change, one variable at a time
  3. Verify — worked → Phase 4. Didn't work → new hypothesis, don't stack fixes.

Phase 4: Implementation

  1. Create failing test case — use test-driven-development skill
  2. Implement single fix — ONE change, no "while I'm here" improvements
  3. Verify — test passes, no other tests broken
  4. Record the refactoring disposition as a Refactoring-Disposition: line in the fix commit message (or the investigation-state note, if the session has one) — same vocabulary as hotfix-charter: REFACTOR_NOW (the refactor is the fix), PARK (you saw a cleanup worth doing and deliberately deferred it — name what), or NONE (nothing structural worth refactoring) — plus one concrete reason. Default NONE for a clean fix; PARK only when you actually spotted deferrable structure. This is a wrap-up note, NOT license for a "while I'm here" edit (item 2 still governs: ONE change).
  5. If 2+ fixes failed — STOP. Question the architecture. Each fix revealing new problems in different places = wrong architecture, not wrong fix. Discuss with human before continuing.

Red Flags — STOP, Return to Phase 1

  • "Quick fix for now, investigate later"
  • "Just try changing X and see"
  • Proposing solutions before tracing data flow
  • "One more fix attempt" after 2+ failures

Recovery: After 2+ Failed Fix Attempts

When fixes keep failing, the problem is usually misdiagnosed. Don't try a third fix — escalate. If 2 or more distinct approaches have failed, the underlying architecture or assumptions are wrong. Stop adding fixes.

  1. Invoke think-twice — verbalize what you've tried and why each failed
  2. Question the layer — are you fixing the right component? Check one layer up and one layer down
  3. Check assumptions — list every assumption you've made. Test the least-certain one first. Write down what you assumed was true at the start and check each against evidence; the broken assumption is likely the root cause.
  4. Ask the human — "I've tried X and Y, both failed because Z. My current hypothesis is W — does that match your understanding?"

Common Rationalizations

RationalizationWhy it fails
"I'm almost sure it's X"Certainty without evidence is bias. Check assumptions first.
"Let me try one more thing"After 2+ failed fixes, trying harder is wrong. Question the premise.
"This worked before, so it must still work"Environments change. Verify don't assume.
"The error message says X so it must be X"Error messages describe symptoms not root causes.
"I'll add more logging to find it"If you're adding logging blindly, you don't have a hypothesis. Form one first.
"It's probably the same bug as last time"Pattern matching skips root cause analysis. Verify.
"The tests pass so it must be fixed"Tests prove the tested path works. Verify the actual failure path.
"It's working now, I don't know why"Non-deterministic fixes will fail again. Find the root cause.

Failure Modes

FailureSymptomRecovery
Wrong layerFix works locally but breaks integrationCheck one layer up: is the caller sending wrong data?
Confirmation biasOnly testing the happy path after fixWrite a test for the original failure case first
Environment mismatchWorks on your machine, fails in CI/prodCompare env vars, dependency versions, OS differences. Don't assume equivalence

Supporting Techniques

  • root-cause-tracing.md — trace bugs backward through call stack
  • defense-in-depth.md — add validation at multiple layers
  • condition-based-waiting.md — replace arbitrary timeouts with condition polling

Companion Skills

  • investigation-state — persist debugging context across sessions for multi-day bugs
  • think-twice — dispatch fresh sub-agent when stuck in a hypothesis loop
  • adversarial-search — search for the WRONG value when symptoms contradict expectations
  • receiving-code-review — responding to review feedback
  • failure-autopsy — post-mortem on failed approaches
  • hotfix-charter — the mechanically-enforced home of the REFACTOR_NOW/PARK/NONE disposition vocabulary (Phase 4 item 4)

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.