Skip to main content
skill CX Codex

root-cause-tracing · bobmatnyc — Claude Code skill: install and use

This skill follows a failure up the call chain to its original trigger. Use it when a stack trace is long or the source of a value is unclear.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add bobmatnyc/claude-mpm-skills --skill root-cause-tracing -a claude-code
Open on GitHub

What root-cause-tracing does

The skill starts at the point where an error appears and moves upward through the call chain. It identifies the symptom, finds the immediate cause, checks which code called it, and keeps tracing until it reaches the original trigger. The fix is then made at the source, with checks added across later layers.

It targets failures deep in execution, long stack traces, and data whose origin is unclear. The skill includes a step-by-step tracing process, a decision tree, tracing methods, examples, and guidance for adding instrumentation. When the caller cannot be identified, it recommends logging context before the risky operation.

The practical boundary is clear: root-cause-tracing is used inside systematic-debugging during Phase 1. It does not replace that workflow. Its settings include context_limit: 800; user invocation is disabled, as is automatic model invocation.

What it helps with

  • trace a failure to its original trigger
  • find where an invalid value or path entered the call chain
  • separate the visible symptom from the underlying cause
  • add validation after fixing the source

Example prompts for the agent

  • Apply root-cause-tracing to this failure and follow the call chain back to the original trigger.
  • Find where the empty working-directory path comes from, then fix the source.
  • Trace the invalid state to its origin and add checks at the later layers.

How to install root-cause-tracing

1Skills CLI (Vercel)

npx skills add bobmatnyc/claude-mpm-skills --skill root-cause-tracing -a claude-code

2Manually: put the files in place

~/.claude/skills/root-cause-tracing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/root-cause-tracing/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about root-cause-tracing

How do I install root-cause-tracing in Claude Code?

Run npx skills add bobmatnyc/claude-mpm-skills --skill root-cause-tracing -a claude-code, then check ~/.claude/skills/root-cause-tracing/SKILL.md.

What does root-cause-tracing do?

It follows an error backward through the call chain, finds the original trigger, and guides a source-level fix with added defensive checks.

How does root-cause-tracing relate to systematic-debugging?

It is a focused technique for Phase 1, where the original cause is investigated. It supports the systematic-debugging workflow rather than replacing it.

Source text

SKILL.md · MIT
---
name: root-cause-tracing
description: Systematically trace bugs backward through call stack to find original trigger
user-invocable: false
disable-model-invocation: true
when_to_use: when errors occur deep in execution and you need to trace back to find the original trigger
version: 2.0.0
languages: all
progressive_disclosure:
  entry_point:
    summary: "Trace bugs backward through call chains to find original triggers instead of fixing symptoms"
    when_to_use: "When errors manifest deep in execution, unclear data origins, or long call chains. Use AFTER systematic-debugging Phase 1."
    quick_start: "1. Observe symptom 2. Find immediate cause 3. Ask what called this 4. Keep tracing up 5. Fix at source + add defense"
  references:
    - tracing-techniques.md
    - examples.md
    - advanced-techniques.md
    - integration.md
context_limit: 800
tags:
  - debugging
  - root-cause
  - tracing
  - call-stack
---

# Root Cause Tracing

## Overview

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.

## When to Use This Skill

**Use root-cause-tracing when:**
- Error happens deep in execution (not at entry point)
- Stack trace shows long call chain
- Unclear where invalid data originated
- Need to find which test/code triggers the problem
- Symptom appears far from actual cause

**Relationship with systematic-debugging:**
- systematic-debugging: The overall framework (Phases 1-4)
- root-cause-tracing: A specific technique for Phase 1 investigation
- Use root-cause-tracing WITHIN systematic-debugging Phase 1

## The Iron Law

```
NEVER FIX JUST WHERE THE ERROR APPEARS
ALWAYS TRACE BACK TO FIND THE ORIGINAL TRIGGER
```

Fixing symptoms creates bandaid solutions that mask root problems.

## Core Principles

1. **Trace Backward**: Follow call chain from symptom to source
2. **Find Original Trigger**: Identify where bad data/state originated
3. **Fix at Source**: Address root cause, not symptom
4. **Defense-in-Depth**: Add validation at each layer after fixing source

## Quick Start

### The 5-Step Trace Process

1. **Observe the Symptom**: What error message? What failed operation?
2. **Find Immediate Cause**: What code directly causes this error?
3. **Ask What Called This**: Trace one level up the call stack
4. **Keep Tracing Up**: Continue until you find the original trigger
5. **Fix at Source + Defense**: Fix root cause and add layer validation

### Decision Tree

```
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)
```

## The Tracing Process

**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](references/tracing-techniques.md)**
**For complete real-world examples, see [Examples](references/examples.md)**

## After Finding Root Cause

**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.

## Navigation

For detailed information:
- **[Tracing Techniques](references/tracing-techniques.md)**: Complete tracing methodology, patterns, and decision trees
- **[Examples](references/examples.md)**: Real-world debugging scenarios with full trace chains
- **[Advanced Techniques](references/advanced-techniques.md)**: Stack traces, instrumentation, test pollution detection
- **[Integration](references/integration.md)**: How to use with systematic-debugging and other skills

## Key Reminders

- NEVER fix just where the error appears
- ALWAYS trace back to find the original trigger
- Use `console.error()` for debugging in tests (logger may be suppressed)
- Log BEFORE the dangerous operation, not after it fails
- Include context: directory, cwd, environment, timestamps
- Add defense-in-depth after fixing source
- Document your trace as you go (write down the call chain)

## Red Flags - STOP

STOP when thinking:
- "I'll just add validation here" (without finding source)
- "This will prevent the error" (symptom fix)
- "Too hard to trace back" (add instrumentation instead)
- "Quick fix for now" (creates technical debt)

**ALL of these mean: Continue tracing to find root cause.**

## Integration with Other Skills

- **systematic-debugging**: Use root-cause-tracing during Phase 1
- **defense-in-depth**: Add after finding root cause
- **verification-before-completion**: Verify fix worked at source
- **test-driven-development**: Write test for root cause, not symptom

See [Integration](references/integration.md) for complete workflow examples.

## Real-World Impact

From debugging session (2025-10-03):
- Found root cause through 5-level trace
- Fixed at source (getter validation)
- Added 4 layers of defense
- 1847 tests passed, zero pollution
- Time saved: 3+ hours vs symptom-fix approach

**Bottom line:** Tracing takes 15-30 minutes. Symptom fixes take hours of whack-a-mole.

© bobmatnyc · MIT · bobmatnyc/claude-mpm-skills

Similar skills

All skills for Code review and refactoring →

root-cause-tracing by other authors comes first.

root-cause-tracing NeoLabHQ A skill that walks the agent backward through the call stack until it finds the original trigger, then fixes there instead of at the crash site. CX Codex +1 1,300installs root-cause-tracing secondsky Walks an agent backward through the call stack until it finds the original trigger. Useful when an error surfaces deep in execution, not at the entry point. CX Codex +1 426installs om-root-cause open-mercato Performs read-only root-cause analysis for tracker issues and maps out the minimal files to change. Helps prepare precise fix plans without altering repository code. CX Codex +1 2,900installs principle-fix-root-causes backnotprop A debugging skill that walks each symptom back to the first place the system went wrong and insists the fix lands there. CX Codex +1 5,700installs root-cause-analysis aj-geddes A skill that walks an incident down to the cause you can actually fix, instead of patching the symptom again. CX Codex +1 884installs investigate-first JuliusBrussee The skill keeps the agent in diagnosis mode: gather evidence, rank hypotheses, name the cause. Only then does it touch code. CX Codex +1 105,400installs debugging-strategies Seth Hobson This skill gives an agent a step-by-step way to investigate bugs, crashes, and performance problems. Use it when a project behaves unexpectedly. CX Codex 13,414installs systematic-debugging Hermes Agent (adapted from obra/superpowers) A four-phase skill that moves from a reproducible symptom to its root cause. Use it for test failures, build errors, integration issues, and unexpected behavior. CX Codex +1 471installs

From the same set125

systematic-debugging This skill guides an agent from reproducing a bug to checking the fix. Use it when an error or unexpected behavior has no clear cause. CX Codex +1 382installs vue A Vue 3 skill for your coding agent: Composition API, reactivity, single-file components, Vue Router, Pinia, TypeScript and Vite. Useful when the agent writes Vue frontend code. CX Codex +1 381installs screenshot This skill sets up screenshot checks for UI changes across desktop, tablet, and mobile. Use it when a pull request needs visible proof of the result. CX Codex +1 380installs api-documentation A set of rules that tells the agent how to write docstrings, JSDoc, Godoc and endpoint descriptions. Useful when several agents each carry their own copy of the same guidance. CX Codex +1 379installs software-patterns Compares tradeoffs between architectural patterns and points to the one that fits your problem: coupling, resilience, service boundaries. Useful when code resists testing. CX Codex +1 373installs nextjs-v16 A skill that walks a project through the Next.js 16 migration: async request APIs, opt-in caching with "use cache", Turbopack. Useful when upgrading an existing app. CX Codex +1 371installs testing-anti-patterns A skill for spotting tests that verify mock behavior, add test-only production methods, or use incomplete mocks. CX Codex +1 368installs vercel-deployments-builds Walks through the Vercel deployment lifecycle: builds, previews, release phases and rollback. Useful when you configure build output or control releases. CX Codex +1 368installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor