Systematic debugging

From joshmanders/dotfiles · View interactive version

Systematic debugging is an AI agent skill from the GitHub repository joshmanders/dotfiles. Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

How to use this skill

Skill file

Systematic Debugging

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

Applies to every technical issue (tests, production bugs, build, performance, integration), especially under time pressure, when a quick fix looks obvious, or after a fix already failed. Complete each phase before the next.

Phase 1: Root cause

  1. Read errors fully: whole stack trace, line numbers, paths, codes, warnings.
  2. Reproduce reliably. Not reproducible → gather more data, don't guess.
  3. Check recent changes: diff, commits, dependencies, config, environment.
  4. Multi-component systems (CI → build → signing, API → service → DB): before proposing fixes, log what enters and exits each boundary and whether env/config propagates (e.g. is the secret set in the workflow, present in the build script's environment, visible to the signing step). Run once to find the failing layer, then investigate that layer.
  1. Error deep in the call stack: trace the bad value backward to its source and fix there. See root-cause-tracing.md.

Phase 2: Pattern

Phase 3: Hypothesis

Phase 4: Fix

  1. Write a failing test (or one-off script) reproducing it before fixing.
  2. One fix for the root cause. No bundled refactors or "while I'm here" changes.
  3. Verify: test passes, nothing else broke, issue resolved.
  4. Fix failed: under 3 attempts → back to Phase 1 with the new information. 3+ failed → stop and question the architecture with Josh before a 4th. Signs: each fix exposes new coupling elsewhere, fixes need massive refactoring, fixes create symptoms elsewhere. That's a wrong architecture, not a failed hypothesis.

Stop and return to Phase 1 when

No root cause found

If investigation shows it's truly environmental, timing-dependent, or external: document what you investigated, add handling (retry, timeout, error message) and logging. Most "no root cause" cases are incomplete investigation.

Supporting files

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.