skills/tools-debugging-root-cause/SKILL.md
Systematic debugging playbook for tracing failures backward through the call chain, adding instrumentation, and fixing bugs at their origin.
npx skillsauth add tjboudreaux/cc-plugin-engineering-excellence tools-debugging-root-causeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Bugs often surface deep in a stack trace—far away from the code that actually caused them. This skill teaches you to walk the chain backward until you reach the true trigger, then reinforce defenses so the issue cannot recur.
Core principle: Never patch just the symptom. Follow the evidence upstream and fix the source.
Decision flow:
Bug surfaces deep? → yes → Can you trace back? → yes → Trace to original trigger → Add defense-in-depth → Done
↘ no → Temporary symptom fix (last resort)
git init failed in ...).execFileAsync('git', ...)).projectDir = '').When static tracing stalls, instrument the suspicious operation before it runs:
async function gitInit(directory: string) {
const stack = new Error().stack;
console.error('DEBUG git init', {
directory,
cwd: process.cwd(),
nodeEnv: process.env.NODE_ENV,
stack,
});
await execFileAsync('git', ['init'], { cwd: directory });
}
console.error in tests (loggers may be muted).npm test 2>&1 | grep 'DEBUG git init'.If you know an artifact is created but not which test caused it, bisect:
./find-polluter.sh '.git' 'src/**/*.test.ts'
Script runs tests individually and stops at the first polluter. Adapt paths to your suite.
Once the root cause is fixed, add guards at multiple layers:
Project.create() rejects empty dirs).git init outside temp directories in tests).new Error().stack captures full call chain without throwing.By tracing backward and reinforcing defenses, you turn “mystery” bugs into deterministic issues. The result: the bug becomes impossible or at least loudly detected long before it corrupts deeper systems.
testing
Startup protocol for every task—discover applicable skills, run them, announce usage, and follow required workflows (brainstorming, TodoWrite checklists, etc.).
testing
Mandatory checklist before claiming work is complete—run the evidence-producing command, inspect output, and only then state a result.
testing
Anchor every engineering decision in user value, measurable outcomes, accessibility, and cross-platform experience coherence.
tools
Use when writing or modifying tests, adding mocks, or considering test-only hooks—prevents common mistakes like testing mocks, polluting production with test helpers, and mocking without understanding dependencies.