universal/debugging/root-cause-tracing/SKILL.md
Systematically trace bugs backward through call stack to find original trigger
npx skillsauth add bobmatnyc/claude-mpm-skills Root Cause TracingInstall 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 manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
Core principle: Trace backward through the call chain until you find the original trigger, then fix at the source.
This skill is a specialized technique within the systematic-debugging workflow, typically applied during Phase 1 (Root Cause Investigation) when dealing with deep call stacks.
Use root-cause-tracing when:
Relationship with systematic-debugging:
NEVER FIX JUST WHERE THE ERROR APPEARS
ALWAYS TRACE BACK TO FIND THE ORIGINAL TRIGGER
Fixing symptoms creates bandaid solutions that mask root problems.
Error appears deep in stack?
→ Yes: Start tracing backward
→ Can identify caller? → Trace one level up → Repeat
→ Cannot identify caller? → Add instrumentation (see advanced-techniques.md)
→ No: May not need tracing (error at entry point)
Example: Git init in wrong directory
Error symptom → execFileAsync('git', ['init'], { cwd: '' })
← WorktreeManager.createSessionWorktree(projectDir='')
← Session.create() → Project.create() → Test code
← ROOT CAUSE: setupCoreTest() returns { tempDir: '' } before beforeEach
At each level ask: Where did this value come from? Is this the origin?
For detailed tracing methodology, see Tracing Techniques For complete real-world examples, see Examples
Fix at source (throw if accessed before initialization) + Add defense-in-depth (validate at Project.create, WorkspaceManager, environment guards, instrumentation).
This prevents similar bugs and catches issues earlier.
For detailed information:
console.error() for debugging in tests (logger may be suppressed)STOP when thinking:
ALL of these mean: Continue tracing to find root cause.
See Integration for complete workflow examples.
From debugging session (2025-10-03):
Bottom line: Tracing takes 15-30 minutes. Symptom fixes take hours of whack-a-mole.
development
Optimize web performance using Core Web Vitals, modern patterns (View Transitions, Speculation Rules), and framework-specific techniques
development
Best practices for documenting APIs and code interfaces, eliminating redundant documentation guidance per agent.
development
Comprehensive API design patterns covering REST, GraphQL, gRPC, versioning, authentication, and modern API best practices
development
Visual verification workflow for UI changes to accelerate code review and catch ...