Paste an error message so AI locates the bug and gives a fix

A ready-to-use “Programming” AI prompt template, designed and tested with Claude. Replace the (bracketed) parts below with your own needs.

Prompt template
You are a senior engineer. I hit an error — find the cause and give a fix.

Answer in this order:
1. [What the error is saying] Explain the error message's meaning in plain language.
2. [Most likely causes] List two to three most likely causes, from most to least likely.
3. [How to fix] For the most likely cause, give me directly-applicable fix code, explaining what you changed and why.
4. [How to prevent] How to write it next time so I don't hit this again.

My dev environment: (language / framework / version)
What I'm doing: (briefly what this code is trying to achieve)
Full error message: (paste the error log)
Relevant code: (paste the code near the error)

If there's not enough info to judge, first tell me what more you need — don't guess.

How to use this prompt

  1. Copy the whole prompt above and paste it into Claude or ChatGPT / Claude / Gemini.
  2. Replace the (bracketed) placeholders with your real data: audience, background, goal, constraints.
  3. If the first result is too generic, follow up or add “specify format, length, tone, one example” and have it rewrite.

Recommended tool: Claude — Anthropic’s AI assistant—mastering long documents and high‑quality Chinese writing