- Coding
- Agent
- Beginner
- ChatGPT
- Claude
- Claude Code
- Published
Debug an Error From the Message and the Code Around It
Finds the most likely cause of an error from the message and the relevant code, ranks other possible causes, and gives the smallest fix plus a way to prove it worked.
You get: Cause, Why it happens, Fix (as a diff or code block), How to verify, Other possible causes with checks. End with assumptions about my environment, such as versions, and the…
The prompt
mkdir -p .agents/skills/debug-an-error-from-the-message-and-the-code-around-it && curl -sL "https://prompts-gpt.com/prompts/debug-an-error-from-the-message-and-the-code-around-it/raw" -o .agents/skills/debug-an-error-from-the-message-and-the-code-around-it/SKILL.mdAct as a calm senior developer pairing with me on a bug. Here is the error message and stack trace: {paste the error}
First ask me for the code at the lines in the stack trace if I have not pasted it, and what I expected to happen.
Rules:
1. Read the error literally first: what failed, where, and with which value.
2. Give the most likely cause and explain the chain from cause to error in plain steps.
3. List up to three other possible causes, ranked, with a quick check that rules each one in or out.
4. Propose the smallest fix that addresses the cause, not the symptom. No unrelated refactors.
5. Say how to confirm the fix: a command to run, a log line to look for, or a test to add.
Output format: Cause, Why it happens, Fix (as a diff or code block), How to verify, Other possible causes with checks. End with assumptions about my environment, such as versions, and the missing information that would make the diagnosis certain.Tips and common edits
Use when you are stuck on an error. Works in ChatGPT, Claude or Gemini; in Claude Code or Cursor it can read the files and run the check commands itself.
Questions about this prompt
More like this
More in CodingFailing Test First Bug Fix
Reproduces a bug with a failing test, finds the root cause, applies the smallest fix and shows the test passing.
Root Cause Analysis from Stack Trace and Logs
Turns an error report, stack trace, and logs into ranked root-cause hypotheses. Includes the cheapest checks to confirm each one, a fix proposal, and a regression test plan.
Explain This Error with Ranked Causes
Explains an error and stack trace in plain words, ranks the three most likely causes and gives a confirming check for each.
Characterization Tests Before a Refactor
Writes tests that lock in a module's current behavior, including edge cases and quirks, so you can refactor safely.
Codebase Tour for a Specific Task
Explores a repo through the lens of your task and explains the architecture, key files and data flow, then says where to start.
Edge-Case Test Suite for One Function in Your Existing Test Framework
Writes tests for a single function that cover normal inputs, boundaries, bad input and error paths, in the test framework your project already uses.
Explain a Codebase Folder to a New Developer on Their First Day
Produces an onboarding guide for one folder of a codebase: what it does, how data moves through it, the files to read first and the traps a new developer should avoid.
Test-First Bug Fix Skill: Reproduce, Fix, Prove (SKILL.md)
A SKILL.md that forces your coding agent to reproduce a bug with a failing test before changing code, apply the smallest fix, and prove it with the test suite.
Plain-English Question to a Correct SQL Query for Your Schema
Writes a SQL query from a plain-English question using your real table definitions, explains each part, checks it for common mistakes and suggests indexes if it will be slow.
Pull Request Review with Merge Recommendation
Reviews a diff against your standards and returns a merge, merge-with-changes, or do-not-merge recommendation. Findings are ranked by severity, with evidence, suggested fixes, and open questions.
Unit Test Plan and Test Code for an Existing Function
Builds a behavior-based test matrix for a function or module and then generates test code in your framework. Covers edge cases, failures, and mocking boundaries, with coverage gaps stated honestly.
Release Notes From Git Log Skill for Users and Developers (SKILL.md)
A SKILL.md that writes release notes from the commits between two tags, split into a plain-language section for users and a technical changelog for developers.