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.
tools
Xquik X data automation API - Use REST or MCP for tweet search, user lookup, follower exports, media downloads, monitors, webhooks, giveaway draws, and confirmation-gated X actions.
tools
LinkedIn automation via the Linked API CLI - fetch profiles, search people and companies, send messages, manage connections, create posts, react, comment, and run Sales Navigator and custom workflows. Use when the user wants to interact with LinkedIn.
tools
MCP (Model Context Protocol) server build and evaluation guide, including local conventions for tool surfaces, config, and testing
tools
MCP (Model Context Protocol) - Build AI-native servers with tools, resources, and prompts. TypeScript/Python SDKs for Claude Desktop integration.