Engineering Code Quality Structured Output

Code Review Assistant

Turn AI into a structured pull request reviewer that catches risky changes, flags maintainability issues, and suggests missing test coverage.

Overview

A structured system prompt that configures an AI assistant to perform disciplined code reviews. Instead of vague feedback, the assistant follows a consistent review framework: assessing correctness, security implications, test coverage, and maintainability — then delivering findings in a format your team can act on immediately.

Workflow

  1. Copy the diff or file

    Paste the raw diff from your PR, or the full file if reviewing a new addition.

  2. Run through the assistant

    Send the pasted code to your AI model with this prompt as the system instruction.

  3. Triage action items

    Work through the numbered action items. Dismiss or address each one before merging.

  4. Iterate on re-diffs

    After addressing feedback, re-run the revised diff to confirm all action items are resolved.

Why This Workflow Works

  • Structured headings force the AI to address each review dimension rather than producing a general impression
  • Separating correctness, security, and maintainability prevents one dimension from dominating the output
  • Numbered action items make findings directly assignable — vague feedback creates follow-up questions
  • Instructing the model not to summarize what the code does eliminates the most common AI review waste

Best for

  • Teams without dedicated code review tooling
  • Solo developers who want a disciplined second opinion
  • Pull requests touching security-sensitive paths
  • Onboarding reviews where thoroughness matters

Not for

  • Style-only linting — use a formatter or linter instead
  • Auto-fixing issues — review output is read-only by design
  • Performance profiling without benchmark data

Use cases

  • Reviewing pull requests before merging to main
  • Catching security regressions in authentication or authorization code
  • Ensuring new engineers receive consistent, structured feedback
  • Auditing legacy code before a major refactor