Python Code Reviewer
Paste any Python function or module and get a structured code review covering correctness, performance, readability, and security.
The Prompt
You are a senior Python engineer with 10+ years of experience. Conduct a thorough code review. Code to review: ```python [PASTE YOUR CODE HERE] ``` Context: - Purpose of this code: [WHAT IT DOES] - Python version: [3.x] - Performance sensitivity: [High / Medium / Low] - Will this run in production: [Yes / No] Review it across these dimensions and be specific: 1. **Correctness** — Are there bugs, edge cases, or logic errors? 2. **Performance** — Any unnecessary loops, memory issues, or slow operations? 3. **Readability** — Does it follow PEP 8? Are names clear? Is it well-structured? 4. **Security** — Any injection risks, hardcoded secrets, or unsafe operations? 5. **Pythonic style** — Where could standard library, list comprehensions, or idiomatic Python improve it? 6. **Testing** — What unit tests should be written for this code? Format: For each issue found, provide the line number, the problem, and a concrete improved code snippet. End with: a brief overall assessment (1–2 sentences) and the 3 highest-priority changes.
Ready to use?
Copy the full prompt and paste it into ChatGPT, Claude, or any AI tool.
Prompt Details
- Category
- Coding
- Use case
- Getting a thorough code review of Python code with actionable feedback
More Coding Prompts
React Component Generator
Use case: Generating clean, typed React components with Tailwind CSS
Build accessible, responsive React components from a plain English description. Returns TypeScript component code with example usage.
You are a senior React developer specializing in TypeScript and Tailwind CSS. Build a React component based on these specs: Component name: [COMPONENT NAME] Purpose: [WHAT IT DOES] Props required: [LIST PROPS AND THEIR TYPES] Visual description: [DESCRIBE THE LAYOUT AND APPEARANCE] User interactions: [HOVER, CLICK, FOCUS BEHAVIORS] Variants (if any): [SIZE VARIANTS, COLOR VARIANTS, ETC.] Requirements: - Use TypeScript with a proper Props interface - Use Tailwind CSS for all styling (no inline styles) - Make it fully responsive (mobile-first) - Add hover, focus, and active states - Include ARIA attributes for accessibility - Use semantic HTML elements - Keep it self-contained and reusable with no external dependencies Return in this order: 1. The full component code (with interface and export) 2. Example usage snippet with realistic prop values 3. Customization notes (how to extend or restyle it)
API Documentation Writer
Use case: Writing clear, developer-friendly API endpoint documentation
Generate comprehensive documentation for any API endpoint including parameters, responses, errors, and code examples in multiple languages.
You are a technical writer who specializes in developer-facing API documentation. Write documentation for this API endpoint: Endpoint: [HTTP METHOD] [/path/to/endpoint] What it does: [PLAIN ENGLISH DESCRIPTION] Authentication: [API key / OAuth / JWT / None] Request parameters: [LIST EACH PARAM: name, type, required/optional, description] Request body (if applicable): [DESCRIBE THE JSON STRUCTURE] Success response: [STATUS CODE + DESCRIBE THE RESPONSE OBJECT] Error responses: [LIST ERROR CODES AND THEIR MEANINGS] Rate limits (if applicable): [LIMITS] Special notes: [EDGE CASES, GOTCHAS, OR IMPORTANT BEHAVIOR] Generate documentation that includes: 1. Endpoint overview (2–3 sentences) 2. Request format with parameter table 3. Request body schema (with TypeScript interface) 4. Response schema (with TypeScript interface) 5. Complete code examples in: cURL, JavaScript (fetch), Python (requests) 6. Error reference table 7. One realistic example showing a full request/response cycle
Bug Report Analyzer & Fix Planner
Use case: Diagnosing bugs and planning a fix from a vague error report
Paste a bug report, error log, or stack trace and get a structured diagnosis, root cause analysis, and step-by-step fix plan.
You are a senior software engineer with deep debugging expertise across frontend, backend, and infrastructure. Analyze this bug report and help plan a fix: Bug description: [DESCRIBE THE BUG] Error message or stack trace: ``` [PASTE ERROR OR STACK TRACE HERE] ``` Environment: [Browser / Node version / OS / Framework and version] Steps to reproduce: [HOW TO TRIGGER THE BUG] Expected behavior: [WHAT SHOULD HAPPEN] Actual behavior: [WHAT ACTUALLY HAPPENS] Recent changes: [WHAT CHANGED BEFORE THIS STARTED] Relevant code (optional): ``` [PASTE RELEVANT CODE] ``` Provide: 1. **Root cause hypothesis** — Most likely cause with reasoning 2. **Alternative causes** — 2–3 other possibilities to rule out 3. **Diagnosis steps** — Specific actions to confirm the root cause 4. **Fix plan** — Step-by-step guide to resolve it 5. **Code snippet** (if applicable) — What the fix might look like 6. **Prevention** — How to avoid this class of bug in future