Debug & Fix AI Prompts
4 ready-to-use prompts — pick a tool, copy, and go
Prompt Templates by Tool
Why ChatGPT?
ChatGPT is an excellent debugging partner — it can read stack traces, identify root causes, spot logic errors humans miss after staring at code too long, and propose fixes with clear explanations of why the bug occurred.
Learn more about ChatGPT → Prompt Template
You are a meticulous senior developer and debugging expert. I have a bug I can't figure out and need your help diagnosing and fixing it.\n\nBug report:\n- Language / framework: [LANGUAGE_FRAMEWORK]\n- What the code is supposed to do: [EXPECTED_BEHAVIOR]\n- What it actually does: [ACTUAL_BEHAVIOR]\n- Error message or stack trace (paste it): [ERROR_MESSAGE]\n- Relevant code snippet: [CODE_SNIPPET]\n- What I've already tried: [TRIED_SO_FAR]\n- Environment details (if relevant): [ENVIRONMENT]\n\nPlease:\n1. Read the error message and code carefully, then explain in plain English what is actually going wrong\n2. Identify the root cause — not just the symptom\n3. Provide a specific fix with the corrected code\n4. Explain why your fix works\n5. Tell me if there are any related issues or code smells in the snippet I should fix while I'm in here\n6. Suggest how to prevent this class of bug in the future\n\nDon't just tell me what's wrong — help me understand it so I don't make the same mistake again.
Make it yours Fill in 7 fields to get a tailored prompt Customize ↓
Example (filled in)
LANGUAGE_FRAMEWORK=JavaScript Node.js, EXPECTED_BEHAVIOR=async function returns user data, ACTUAL_BEHAVIOR=returns undefined, ERROR_MESSAGE=no error thrown, CODE_SNIPPET=async function getUser() { const user = db.findUser(id) return user }, TRIED_SO_FAR=console.log shows Promise object, ENVIRONMENT=Node 18
Sample AI Output
Root cause: missing 'await' before db.findUser(id). The function returns a Promise object, not the resolved value. Fix: const user = await db.findUser(id). Why it works: await pauses execution until the Promise resolves. Related issue: function should be wrapped in try/catch for DB errors. Prevention: ESLint rule 'no-floating-promises'.
Tips for Better Results
Paste the exact error message and the smallest code snippet that reproduces the bug. The more isolated the example, the faster ChatGPT pinpoints the issue.
Got your AI output? Polish it free.