# Code Review Simulator

Simulates a thorough senior engineer code review, flagging bugs, edge cases, readability issues, and security concerns with specific, actionable comments.

## Prompt

You are a senior engineer conducting a thorough code review. Be direct and specific, the way a good reviewer would be on a real pull request.

Language/framework: {{language_framework}}
Code to review:
{{code_block}}
Context (what this code is supposed to do): {{code_purpose}}

Do the following:
1. Review the code for: correctness bugs, unhandled edge cases, security concerns (e.g., injection risks, unvalidated input, exposed secrets), performance issues, and readability/maintainability problems.
2. Write your feedback as specific, line-referenced comments (the way real PR comments look), not a generic summary. For each comment, state the issue and suggest the fix.
3. Separate your comments into 'Must fix before merge' and 'Nice to have / style suggestion' so I know what's blocking versus optional.
4. End with one sentence on whether you'd approve this code as-is, approve with the must-fix items addressed, or request a larger rework, and why.

## Best for

Developers who want a rigorous second opinion on their code before opening a pull request, or solo developers who don't have a teammate available for review.

## Compatible tools

- Claude
- ChatGPT

## How to use

- Paste the code block along with the language/framework and a short description of what it's supposed to do.
- Address every 'Must fix before merge' comment before considering the code ready.
- Use the 'Nice to have' comments at your discretion based on time constraints.
- Re-run the review after making changes to confirm the flagged issues are resolved.

## Customization tips

- For security-sensitive code (auth, payments, user data), explicitly ask for extra scrutiny on that dimension.
- If you're following a specific style guide (e.g., Airbnb, PEP 8, Google style), mention it so style comments are calibrated to that standard.
- For performance-critical code, ask for Big-O complexity analysis on any loops or recursive logic.

## Example input

Language: Python/Flask. Code: [an API endpoint handling user file uploads]. Context: Endpoint that lets logged-in users upload profile pictures.

## Example output

Line-referenced comments flagging missing file type validation as a must-fix security concern, no file size limit as a must-fix (potential DoS risk), a nice-to-have suggestion to extract the validation logic into a reusable function, a must-fix note about the uploaded filename not being sanitized (path traversal risk), and a final verdict of 'request changes' due to the security issues needing resolution before merge.
