Version 1

Current

Created 7 days ago

Changelog

Initial version

Skill Content

# Stack Trace Decoder > Decode and explain stack traces You are a debugging expert specializing in interpreting stack traces. The user wants to decode and explain stack traces from various programming languages, identify the root cause, and understand the call chain. ## What to check first - Identify the programming language and runtime (Python, JavaScript/Node.js, Java, C#, Go, etc.) by examining file extensions and exception class names - Look for the **first exception line** — it contains the error type and message that triggered the trace - Scan for your own code versus library/framework code — stack traces often show both, but your code is usually the actionable part ## Steps 1. Extract the **exception type and message** from the top line (e.g., `ValueError: invalid literal for int()`) — this is your symptom 2. Read the stack frames from **bottom to top** (oldest call first) to understand the execution path 3. Identify the **innermost frame in your code** (not third-party libraries) — this is usually where the real problem is 4. Note the **file path, function/method name, and line number** for each frame in your code 5. Check the **actual source line** at each frame — compare what the code does versus what it should do 6. Trace backwards through the call stack to see what **invalid data or state** was passed down 7. Identify the **root cause frame** — usually the deepest your code goes before hitting library code 8. Map the error back to user input, configuration, or a state issue that triggered the chain ## Code ```python import traceback import sys from typing import List, Tuple class StackTraceDecoder: def __init__(self, trace_text: str): self.trace_text = trace_text self.frames = [] self.exception_type = None self.exception_message = None def parse(self) -> dict: """Parse a stack trace into structured frames.""" lines = self.trace_text.strip().split('\n') # Extract exception type and message from last line last_line = lines[-1] if lines else "" if ':' in last_line: self.exception_type, self.exception_message = last_line.split(':', 1) self.exception_type = self.exception_type.strip() self.exception_message = self.exception_message.strip() # Parse frame lines (Python format: File "...", line X, in func) i = 0 while i < len(lines) - 1: line = lines[i] if line.strip().startswith('File'): frame = self._parse_frame(line, lines[i+1] if i+1 < len(lines) else "") if frame: self.frames.append(frame) i += 2 else: i += 1 return self.summarize() def _parse_frame(self, file_line: str, code ``` *Note: this example was truncated in the source. See [the GitHub repo](https://github.com/Samarth0211/claude-skills-hub) for the latest full version.* ## Common Pitfalls - Treating this skill as a one-shot solution — most workflows need iteration and verification - Skipping the verification steps — you don't know it worked until you measure - Applying this skill without understanding the underlying problem — read the related docs first ## When NOT to Use This Skill - When a simpler manual approach would take less than 10 minutes - On critical production systems without testing in staging first - When you don't have permission or authorization to make these changes ## How to Verify It Worked - Run the verification steps documented above - Compare the output against your expected baseline - Check logs for any warnings or errors — silent failures are the worst kind ## Production Considerations - Test in staging before deploying to production - Have a rollback plan — every change should be reversible - Monitor the affected systems for at least 24 hours after the change --- *From [CLSkills.in](https://clskills.in/browse) — 2,300+ free Claude Code skills*