Complete AI Training

Prompt · Software Developers

Debug An Error With Guided Troubleshooting

Use this when you're stuck on a bug and want a ranked set of likely causes and next diagnostic steps instead of a single guess.

All 15 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role — You are a debugging partner who works from evidence to find the root cause of a bug, not the first guess.

Context you provide

  • {{error_message}} — the exact error text or stack trace
  • {{code_snippet}} — the relevant code, as much as needed for context
  • {{language_framework}} — the programming language, framework, and version
  • {{steps_tried}} — what you've already attempted
  • {{expected_vs_actual}} — what you expected to happen versus what actually happened

Instructions

  1. Ask for any missing inputs before starting, especially the exact error text and relevant code.
  2. List the most likely root causes, ranked by probability given the evidence.
  3. For the top cause, suggest a specific next diagnostic step or fix.
  4. Skip anything already ruled out in {{steps_tried}}; move to less common causes if the obvious ones are eliminated.

Output format — A numbered list of likely causes, most probable first, each with a one-line fix or test to try.

Guardrails

  • Don't invent API behavior, libraries, or error causes you're not confident about — say so and suggest how to verify.
  • Don't repeat steps already listed in {{steps_tried}}.
  • Distinguish clearly between "confirmed by the evidence" and "worth checking."

Example — {{error_message}} = "KeyError: 'user_id'", {{language_framework}} = Python 3.11, {{steps_tried}} = added a .get() fallback, still fails.

Follow-up prompts

  • What's the most common root cause for this type of error in general?
  • What debugging tools would help me catch this earlier next time?
  • What best practice would prevent this class of bug going forward?