root-cause-tracing

Trace error root causes backward through execution call stacks with instrumentation and logging.

6|1|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/LEEI1337/phantom-neural-cortex --skill root-cause-tracing-leei1337
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: root-cause-tracing
Source: https://github.com/LEEI1337/phantom-neural-cortex/tree/main/.claude/skills/root-cause-tracing
Command: npx skills add https://github.com/LEEI1337/phantom-neural-cortex --skill root-cause-tracing-leei1337

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This skill addresses the challenge of debugging errors that manifest deep within the call stack, preventing symptom-fixing and ensuring the true source of invalid data or incorrect behavior is identified. It provides a systematic method to trace issues backward, saving significant debugging time and leading to more robust solutions.

Core Features & Use Cases

  • Backward Tracing Process: Guides through observing symptoms, finding immediate causes, and tracing up the call chain to the original trigger.
  • Instrumentation for Debugging: Instructs on adding console.error() with stack traces to pinpoint problematic operations.
  • Test Polluter Identification: Provides a script (find-polluter.sh) to isolate which test introduces unwanted files or state.
  • Root Cause Principle: Emphasizes "NEVER fix just where the error appears," promoting deep understanding over superficial patches.
  • Use Case: When a git init command unexpectedly creates a .git directory in the wrong location, use this skill to trace back through the call stack, identify the empty projectDir parameter, and find the exact test setup that caused the incorrect value.

Quick Start

I'm seeing an error deep in the execution stack. Use the root-cause-tracing skill to find the original trigger.

Frequently Asked Questions about root-cause-tracing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I trace a bug that appears deep in the call stack?

Root-cause tracing guides you backward through the execution stack to identify where invalid data originated, not just where the error manifested. Start by observing the symptom, find the immediate cause, then systematically trace up through layers to locate the original trigger using instrumentation and stack-trace logging.

What's the best way to debug errors caused by incorrect parameters passed through multiple function calls?

Apply backward tracing by inserting instrumentation like console.error() with stack traces at each layer. This reveals where parameters become invalid or empty—for example, tracking an empty projectDir parameter backward to the test setup that caused it—enabling fixes at the source rather than symptom masking.

How do I identify which test is polluting state or creating unwanted files?

Root-cause tracing includes a find-polluter.sh script that isolates which test introduces unwanted state or files. Run it to pinpoint the exact test setup causing side effects, then trace backward through that test's initialization to find where the incorrect behavior originates.

Why should I avoid fixing errors where they appear in the code?

Fixing symptoms at the error site masks the root cause, leaving the underlying defect intact. Root-cause tracing enforces a defense-in-depth principle: trace backward to discover the original trigger—like a wrong file path or repository initialization—so the fix prevents the problem upstream.

Can I use root-cause tracing for integration failures across multiple layers?

Yes. Root-cause tracing handles cross-layer integration failures by applying backward tracing and instrumentation across repository, file-path, and initialization boundaries. It's designed for scenarios where bugs arise far from entry points with long, noisy call chains and unclear data origins.

When do I need instrumentation versus reading the stack trace alone?

When call chains are long and noisy, or data origins are unclear, add instrumentation with console.error() and stack traces to pinpoint which operation produced invalid data. This transforms an opaque stack trace into concrete evidence of where the problem started.