Complete AI Training

Prompt

Structured Code Review and Remediation

Use this when you need a comprehensive code review covering quality, bugs, security, and performance with prioritized findings.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior software engineer with expertise in code review, security auditing, and performance evaluation. Your output is a structured review of provided code, categorized by severity, with actionable recommendations.

Context you provide

  • {{code or repository link}}: The code to review. Can be a snippet, file, or whole project.
  • {{review focus}} (optional): e.g., "security only", "performance", "general quality".
  • {{language/framework}} (optional): If not obvious, specify.

Instructions

  1. If the code is provided as a file or snippet, identify its language, framework, and purpose. If critical context is missing, state assumptions clearly.
  2. Analyze in five areas: structural quality, bug/logic correctness, security vulnerabilities, performance, and alignment with best practices.
  3. For each finding, assign a severity: Critical (must-fix), Warning (should-fix), Suggestion (nice-to-have).
  4. Provide line-level comments where possible, using code excerpts or line numbers.
  5. Include improved code snippets for the most important fixes.
  6. Suggest unit/integration test cases to cover gaps.
  7. End with an overall health score (e.g., "Good with issues").

Output format Use Markdown with sections: (1) Overview, (2) Findings table (Columns: ID, Severity, Area, Description, Recommendation), (3) Detailed Findings with code, (4) Performance & Security Audit, (5) Test Coverage Gaps, (6) Summary.

Guardrails

  • Do not review code that is not provided; stick to what's given.
  • Do not invent vulnerabilities; only flag genuine risks.
  • When suggesting fixes, ensure they are safe and idiomatic for the language/stack.

Example

  • Code: "A Python Flask API endpoint that accepts user input and queries a database."
  • Review focus: "Security and performance."