I have a bug in my [LANGUAGE] code. Help me find and fix it.
Code:
[PASTE CODE HERE]
Expected behavior: [WHAT SHOULD HAPPEN]
Actual behavior: [WHAT ACTUALLY HAPPENS]
Error message (if any): [PASTE ERROR]
Please:
1. Identify the root cause of the bug
2. Explain WHY it's happening (not just what's wrong)
3. Provide the exact fix with corrected code
4. Suggest a test case that would catch this bug in the future
5. List any other potential issues you spot in the same code
6. Rate the likelihood of similar bugs elsewhere in this codebase and what to look for
I have a bug in my [LANGUAGE] code. Help me find and fix it.
Code:
[PASTE CODE HERE]
Expected behavior: [WHAT SHOULD HAPPEN]
Actual behavior: [WHAT ACTUALLY HAPPENS]
Error message (if any): [PASTE ERROR]
Please:
1. Identify the root cause of the bug
2. Explain WHY it's happening (not just what's wrong)
3. Provide the exact fix with corrected code
4. Suggest a test case that would catch this bug in the future
5. List any other potential issues you spot in the same code
6. Rate the likelihood of similar bugs elsewhere in this codebase and what to look for
How to use this prompt
Copy the prompt above and paste it into ChatGPT, Claude, Gemini, or any AI assistant. Replace the bracketed placeholders with your specific details.
Leave a Review
Tried this prompt? Let us know how it worked — your reviews help other users find the best prompts.