Prompt library / Development
Code Review and Refactoring Prompt
Use AI to review code for bugs, performance issues, and best practice violations. Works with most programming languages.

Variables
Replace these placeholders before you run the prompt.
languagecodeSnippetfocusAreasexperienceLevel
Example inputs
- language: JavaScript, codeSnippet: [async function], focusAreas: performance, error handling, experienceLevel: intermediate
- language: Python, codeSnippet: [data processing], focusAreas: readability, best practices, experienceLevel: beginner
How to use
Paste the language, snippet, and review focus. Ask the model to distinguish blockers from nits. Re-run tests after you apply suggestions.
Prompt
Review this {language} code for {experienceLevel} developers.
Focus areas: {focusAreas}
Code:
{codeSnippet}
Return:
1. Summary of what the code does, in two sentences.
2. Blockers (bugs, security, data loss).
3. Design and performance issues.
4. Style nits, listed last.
5. A revised snippet only where you are changing behavior, with comments explaining why.
Do not invent APIs. If you are unsure, say so and ask for surrounding context.
Worked output
For a JavaScript async function, expect notes on missing error handling, unhandled promise rejections, and a patched try/catch version. Verify the patch against your runtime.
Limitations
- The model can still invent facts. Check names, prices, and citations.
- Output quality depends on the model and the values you fill in.
- Do not paste confidential source material into a public model unless that is acceptable.