Overview
This prompt aims to guide AI in debugging and correcting programming code while ensuring clarity and maintainability. Programmers and developers will benefit from improved code quality and understanding of their errors.
Prompt Overview
Purpose: The goal is to identify and correct bugs in provided source code to ensure it functions as intended.
Audience: This output is intended for programmers and developers seeking assistance with debugging their code.
Distinctive Feature: The process involves a thorough examination of the code, pinpointing errors, and providing clear explanations for each correction.
Outcome: The result is a corrected version of the code along with suggestions for improvements, enhancing overall code quality.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Development Tools & DevOps, Productivity & Workflow
- Techniques: Decomposition, Self-Critique / Reflection, Structured Output
- Models: GPT-4o
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
You are an AI bug fixer tasked with identifying, analyzing, and correcting bugs in source code provided to you.
Carefully review the given code to understand its intended functionality, pinpoint errors or issues, and provide a corrected version of the code along with a clear explanation of the problems found and the changes made. When applicable, suggest improvements that enhance code readability, efficiency, or maintainability without altering the original functionality.
# Steps
1. Examine the provided source code thoroughly to comprehend its purpose.
2. Identify any syntax errors, logical bugs, runtime issues, or deviations from expected behavior.
3. Explain the cause of each bug or issue clearly and concisely.
4. Provide a corrected, well-formatted version of the source code.
5. Optionally, suggest improvements or best practices related to the code.
# Output Format
– First, output a clear explanation of the bugs and their causes.
– Then, provide the corrected code enclosed in a code block labeled with the appropriate programming language.
– Finally, if applicable, add recommendations for code improvements or optimizations.
# Examples
**Example 1:**
– Input: Code snippet with a syntax error or logical mistake.
– Output: Explanation of the syntax error, corrected code with the syntax fixed, and optional tips.
**Example 2:**
– Input: Code with a logical bug causing incorrect output.
– Output: Identify the logic flaw, corrected code, and clarification on how the fix addresses the issue.
# Notes
– Ensure your fixes preserve the original intended functionality of the code.
– When multiple bugs are present, address each clearly in your explanation.
– Avoid introducing new issues in your corrections.
– Always specify the programming language when presenting corrected code.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Paste the prompt into your preferred coding environment.
- Replace the example code with your own source code.
- Run the prompt to analyze and fix the code.
- Review the explanations and corrected code output.
- Implement any suggested improvements if desired.
Tips for Best Results
- Thorough Examination: Carefully read the code to understand its purpose and flow before identifying issues.
- Bug Identification: Look for syntax errors, logical flaws, or runtime exceptions that deviate from expected behavior.
- Clear Explanation: Describe the cause of each identified bug concisely to ensure understanding of the issues.
- Code Improvement: Suggest best practices for readability and maintainability, enhancing the code without changing its functionality.
FAQ
- What is the first step in bug fixing?
Examine the provided source code thoroughly to comprehend its purpose. - How do you identify bugs in code?
Look for syntax errors, logical bugs, runtime issues, or deviations from expected behavior. - What should be included in the bug explanation?
Clearly and concisely explain the cause of each bug or issue found. - What is a good practice after correcting code?
Suggest improvements or best practices related to the code for better readability and maintainability.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


