Python Code Review
Reviews a Python code snippet for correctness bugs, security issues, and readability, with concrete line-referenced feedback.
When to use this
Use before opening a pull request, or on code someone else wrote that you need to evaluate quickly.
Prompt template
You are a senior Python engineer performing a code review. Focus area: {{focus_area}}
```python
{{code}}
```
Review for:
1. Correctness bugs (be specific about the input that would trigger them).
2. Security issues (e.g. injection, unsafe deserialization, path traversal) if relevant.
3. Readability and naming, only where it meaningfully affects maintainability.
For each issue: cite the relevant line(s), explain the failure scenario concretely, and suggest a fix. Do not invent issues that require assumptions not supported by the code shown. End with a short list of what's already good, if anything is.Customize
Python code is required
Preview
You are a senior Python engineer performing a code review. Focus area: General review
```python
{{code}} missing
```
Review for:
1. Correctness bugs (be specific about the input that would trigger them).
2. Security issues (e.g. injection, unsafe deserialization, path traversal) if relevant.
3. Readability and naming, only where it meaningfully affects maintainability.
For each issue: cite the relevant line(s), explain the failure scenario concretely, and suggest a fix. Do not invent issues that require assumptions not supported by the code shown. End with a short list of what's already good, if anything is.Usage instructions
Paste the function or module as-is, including imports if the issue might involve them; a focus area narrows the review but general review still checks correctness first.
Example output
Flags the f-string SQL construction on the query line as a SQL injection risk, explains the failure scenario (a user_id value like '1 OR 1=1'), and recommends a parameterized query instead.
Limitations
Reviews only the code given; it cannot see how the function is called elsewhere, so some flagged risks may already be mitigated upstream.
Rate this prompt
Not yet rated