Use when errors occur deep in execution and you need to trace back to find the original trigger - systematically traces bugs backward through call stack to identify source of invalid data
/plugin marketplace add timequity/vibe-coder/plugin install vibe-coder@vibe-coderThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Bugs often manifest deep in the call stack. 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.
Error: database query failed with null user_id
What code directly causes this?
await db.query('SELECT * FROM orders WHERE user_id = ?', [userId]);
OrderService.getOrders(userId)
→ called by OrderController.list()
→ called by router.get('/orders')
→ called by auth middleware
What value was passed?
userId = nullWhere did the problem originate?
// Auth middleware bug: didn't handle expired tokens
if (token.expired) {
// Missing: return error response
// Falls through with req.user = undefined
}
When you can't trace manually, add instrumentation:
async function getOrders(userId: string) {
const stack = new Error().stack;
console.error('DEBUG getOrders:', {
userId,
typeOfUserId: typeof userId,
stack,
});
// ... rest of function
}
Run and capture:
npm test 2>&1 | grep 'DEBUG getOrders'
Symptom: .git created in source directory during tests
Trace chain:
git init runs in process.cwd() ← empty cwd parametercontext.tempDir before beforeEach{ tempDir: '' } initiallyRoot cause: Top-level variable initialization accessing empty value
Fix: Made tempDir a getter that throws if accessed too early
Found immediate cause
↓
Can trace one level up? → YES → Trace backwards
↓ ↓
NO Is this the source?
↓ ↓
NEVER fix just YES → Fix at source
the symptom ↓
Add validation at each layer
↓
Bug impossible
NEVER fix just where the error appears. Trace back to find the original trigger.
console.error() not logger - logger may be suppressednew Error().stack shows complete call chainUsed by:
Pairs with:
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.