Stack Trace and Log Root Cause Debugging
Trace errors across stacks and logs, isolate the failing condition, and deliver a minimal fix with a targeted regression test.
Before & after
Same prompt, same agent — the only difference is the skill.
I can help you debug this error. It looks like you're calling a function that doesn't exist or hasn't been defined properly. To troubleshoot, I'd recommend checking a few things: first, verify that the function is actually defined in the scope where you're trying to call it; second, check that all imports are correct; third, look at the surrounding context to see if there's a type mismatch. You might want to add some console.log statements to trace the execution flow. Would it be helpful if I took a closer look at your code? I can examine the stack trace more carefully once you share it.
EXECUTION TRACE: TypeError originates at line 427 in parseUserInput(). Promise chain shows: main() → loadData() → parseUserInput() → missing handler. LOG CORRELATION: • 14:32:15 — loadData() returns successfully • 14:32:16 — parseUserInput() invoked with null config • 14:32:16 — TypeError thrown, handler not defined ROOT CAUSE: The Promise chain at line 427 expects a .catch() block, but only .then() is chained. When loadData() completes, it passes incomplete data to parseUserInput(), which attempts to call a formatter function that was never attached to this Promise path. HYPOTHESIS DRIVEN FIX: 1. Add .catch() to loadData() Promise (lines 124-130) 2. Verify formatter function is bound before parseUserInput() runs 3. Add null-check guard at line 426 TEST: Wrap loadData() in try-catch, log config state before parseUserInput() invocation, step through Promise chain in debugger at line 423.
About this skill
The stack trace points at a framework wrapper, the logs disagree, and the crash disappears when you add logging. This skill reconstructs the failure path, separates evidence from guesses, and identifies the smallest experiment that can establish the cause.
What it does
- Unwraps exception chains and distinguishes throw, propagation, and reporting sites.
- Correlates logs by request, trace, process, and attempt identifiers without assuming timestamps prove causality.
- Ranks competing explanations and designs tests whose outcomes distinguish them.
- Makes intermittent failures reproducible with controlled inputs, execution barriers, and state transitions.
- Produces a minimal patch that restores the violated invariant, plus a targeted regression test.
- Reports exactly what was reproduced, changed, and verified, including remaining uncertainty.
What you get
A focused diagnosis tied to specific evidence, followed by the next decisive experiment or an actionable patch and regression test. Quick questions receive a short interpretation; larger investigations receive a compact evidence trail and verification results.
Best for
Developers investigating crashes, misleading stack traces, cross-service failures, and intermittent bugs in existing applications.
SKILL.md preview
---
name: stack-trace-and-log-root-cause-debugging
description: Reconstructs failures from exception chains, application frames, correlated logs, and state transitions, then uses discriminating experiments to isolate the cause and verify a minimal repair. Use when the user says "explain this stack trace", "find the root cause", "my service keeps crashing", "this only fails sometimes", "the logs don't make sense", "it works locally but fails in production", or "fix this bug and add a regression test".
---
# Stack Trace and Log Root Cause Debugging
… (sign up to view the full skill)More development skills
View all Development skills →React and Next.js Regression Test Coverage
Generate React and Next.js tests with Jest, Testing Library, MSW, and Playwright, prioritized by regression risk.
Playwright E2E Tests and Flake Repair
Build reliable Playwright tests, repair flakes from evidence, migrate suites, and configure faster, diagnosable CI.
Pre-Ship Verification for Code Changes
Before calling a code change done, Claude grades every claim by evidence, tries to break it, and reports what's verified vs assumed.
TestRail Case and CI Result Sync
Sync automated tests to TestRail cases and scoped runs with stable mappings, retry handling, and verified result counts.