What problem does it solve?
This Skill addresses the common problem of fixing symptoms instead of root causes when bugs manifest deep in the execution stack. It provides a systematic process to trace errors backward through the call chain, identify the original trigger of invalid data or incorrect behavior, and fix it at the source, ensuring lasting solutions.
Core Features & Use Cases
- Backward Tracing: Guides you from the symptom back through immediate causes and callers to the original trigger.
- Instrumentation: Teaches how to add diagnostic logging (e.g., stack traces, environment context) to pinpoint where data goes wrong.
- Polluter Identification: Provides a bisection script to find which specific test or code block introduces unwanted state or files.
- Defense-in-Depth Integration: Encourages adding validation at multiple layers after finding the root cause to prevent recurrence.
- Use Case: A
git init command unexpectedly creates a .git directory in your source code. Use this Skill to trace back through the call stack, discover that an empty projectDir was passed, and identify the exact line where the empty string originated, allowing you to fix the true source of the problem.
Quick Start
Example: Adding diagnostic stack trace
Before the problematic operation:
async function gitInit(directory: string) {
const stack = new Error().stack;
console.error('DEBUG git init:', {
directory,
cwd: process.cwd(),
nodeEnv: process.env.NODE_ENV,
stack,
});
await execFileAsync('git', ['init'], { cwd: directory });
}