root-cause-tracing

Trace backward through call stacks to identify original error triggers.

6|1|Updated Oct 23, 2025
One-click install
npx skills add https://github.com/alexsandrocruz/ZenPowers --skill root-cause-tracing-alexsandrocruz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: root-cause-tracing
Source: https://github.com/alexsandrocruz/ZenPowers/tree/main/skills/root-cause-tracing
Command: npx skills add https://github.com/alexsandrocruz/ZenPowers --skill root-cause-tracing-alexsandrocruz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill prevents superficial fixes by guiding you to systematically trace bugs backward through the call stack, identifying the original trigger of invalid data or incorrect behavior, rather than just patching symptoms.

Core Features & Use Cases

  • Backward Tracing Process: Guides through observing symptoms, finding immediate cause, and tracing up the call chain to the original trigger.
  • Instrumentation for Deep Errors: Provides code examples for adding stack trace logging to pinpoint origins of bad values.
  • Test Polluter Identification: Includes a bisection script (find-polluter.sh) to isolate which test introduces unwanted state or pollution.
  • Use Case: When errors occur deep in execution, or when you need to find which test or code triggers a problem, use this Skill to find the true root cause.

Quick Start

1. Observe the Symptom (e.g., "Error: git init failed in C:\Users...\MyProject.Core")

2. Find Immediate Cause (What code directly causes this?)

3. Ask: What Called This? (Trace up the call stack)

4. Keep Tracing Up (What value was passed? Where did it come from?)

5. Find Original Trigger (The ultimate source of the problem)

Example instrumentation for debugging:

Console.Error.WriteLine($"DEBUG git init: {{ Directory = {directory}, StackTrace = {stackTrace} }}");

To find a test polluter:

./find-polluter.sh '.git' 'src/**/*.test.ts'

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 back to its root cause through the call stack?

Root-cause tracing involves observing the symptom, identifying the immediate cause in code, then systematically tracing backward up the call stack to find the original trigger of invalid data or incorrect behavior. This prevents superficial fixes by revealing where the problem actually originates.

When should I use instrumentation and stack trace logging to debug errors?

Use instrumentation and stack trace logging when errors occur deep in execution, stack traces are long, or the origin of invalid data is unclear. Adding debug output at key points captures the call chain and environment context, enabling precise identification of where bad values entered the system.

How do I find which test is polluting state and causing failures?

Test pollution occurs when one test introduces unwanted state affecting others. Use bisection techniques like the provided `find-polluter.sh` script to isolate which test introduces the problem, then trace backward through test execution to identify and fix the root cause.

What's the difference between fixing a symptom and fixing the root cause?

Fixing a symptom patches the immediate error without addressing its source, risking recurrence. Root-cause tracing reveals the original trigger, enabling defense-in-depth fixes that prevent the problem from reoccurring across your codebase through multi-layer validation and pre-operation logging.

Do I need to add logging to every function to trace bugs effectively?

No. Strategic instrumentation at decision points, data entry boundaries, and before error-prone operations captures sufficient context. Focus logging on functions handling external input, state transitions, and areas where invalid data could originate rather than instrumenting comprehensively.

How do I reproduce a bug consistently once I find its root cause?

Root-cause tracing captures environment context, stack traces, and data flow patterns that enable reproducibility. Document the conditions leading to the original trigger, add validation to prevent invalid input earlier, and create tests that verify the fix prevents recurrence.