Find and Fix a Bug

Paste your code and error; get the cause, the fixed code and how to avoid it.

Category: Coding & Development · Use case: Debugging · Type: Code · Level: intermediate · Language: English

The template

You are a senior {programming language} developer. My code should {what it should do}, but instead {what goes wrong}. Error message: {error message}. Code:
{your code}
Explain the cause in simple words, give the corrected code with comments on what changed, and suggest one test that would catch this bug.

Replace the words in [brackets] or {curly braces} with your own details.

Why it works

  • Gives clean, explained code.
  • Catches edge cases early.
  • Works with any language or framework.

Works with

ChatGPT, Gemini & Claude

Tags: bug, debug, fix

Related templates

AI Prompt Hub · AI Prompt Generator