Coding Workflows Workflow Intermediate

AI Code Review Workflow

A complete AI-assisted review pass — not one prompt — that ends with ranked findings, tests guarding behavior, and a refactor plan when one is warranted.

The problem

One review prompt reads a diff and hands back an opinion. A real review is more than that. Give the model no project context and it invents conventions you don't follow. Let it judge code it doesn't actually understand and it approves the wrong things confidently. And a review that lists problems but leaves behind no tests and no plan hasn't made the merge any safer. This workflow chains the coding tools you already have so each step sets up the next — context, then review, then understanding, then a safety net.

Recommended workflow

Each step uses an existing NewPrompt tool, pre-filled by a matching resource. Open the resource to read it, or jump straight into the tool with the inputs ready.

  1. Prepare project context

    Before the model reviews anything, give it the project's stack, conventions, and domain so it reviews against your standards instead of generic best practice. Build a context profile once and reuse it as the first message in every review session.

    Outcome A reusable project context profile the model reads before every review, so its feedback matches your conventions.
  2. Generate the code review prompt

    With context in place, generate the review contract — what to check (correctness, security, tests, design), how to rank findings (must-fix vs nit), and what format the output should take. Paste the diff after it.

    Outcome A structured review prompt that returns severity-ranked, actionable findings instead of a vague opinion.
  3. Understand risky or unclear code

    When the review flags code you don't fully understand — a dense function, legacy logic, an unfamiliar pattern — don't approve on faith. Get a grounded, line-aware explanation of what it actually does before judging the change.

    Outcome A clear understanding of the risky section, so the review verdict is based on what the code does, not what it looks like.
  4. Generate regression tests

    For behavior the change touches, pin the current behavior with regression tests before anything moves. This turns 'looks fine' into a safety net that catches the bug the next change would reintroduce.

    Outcome Regression tests that lock in current behavior, so a fixed bug stays fixed and risky changes are provably safe.
  5. Plan a safe refactor if needed

    If the review surfaces code that should be restructured, plan the refactor with zero-regression discipline — behavior preserved, changes sequenced, validation defined — rather than rewriting in place during the review.

    Outcome A behavior-preserving refactoring plan you can hand off or execute after the tests are in place.

Expected outcome

You finish with severity-ranked findings, a real understanding of the code you were unsure about, regression tests guarding current behavior, and a behavior-preserving refactor plan when one is warranted. The change is genuinely safer to merge — not just looked at.

Best for

  • Reviewing a teammate's pull request with AI as a consistent process
  • Reviewing your own change before opening the PR
  • Reviewing risky changes to unfamiliar or legacy code

Not for

  • A quick one-off review of a tiny diff — the single Code Review Prompt is enough
  • Replacing human review entirely — this assists judgment, it doesn't remove it

FAQ

AI code review workflow vs a single code review prompt

A single code review prompt reviews one diff and hands back an opinion. This workflow wraps five steps around it: set project context first, generate the ranked review, explain risky code, pin behavior with regression tests, then plan a safe refactor. Use the prompt for a quick look; use the workflow when the change matters.

Code review vs debugging vs refactoring workflow — which do I run?

Run this code review workflow to catch problems before a change merges. Run the AI Debugging Workflow once something is already broken and you need the cause. Run the AI Refactoring Workflow when restructuring is the actual task — step 5 here only sketches a refactor when the review surfaces one.

What does the AI code review workflow produce?

You finish with severity-ranked findings from the review, a grounded explanation of any code you were unsure about, regression tests that lock in current behavior, and a behavior-preserving refactor plan when the review warrants one. The deliverables make the change safer to merge — you still run each prompt and own the verdict.

What do I need before starting the AI code review workflow?

You need the change to review — a diff or pull request — plus your project's stack, conventions, and domain so step 1 can build a reusable context profile. Steps 3 to 5 also draw on the specific risky sections, touched behavior, and code the review flags for restructuring. No account or setup is required.

Do I have to do every step?

No. Steps 1 and 2 are the core. Step 3 only applies when the review flags code you don't fully understand, and steps 4–5 apply when the change touches behavior or needs restructuring. Skip what a given review doesn't need.

Does this run my code or send it anywhere?

No. Every tool in this workflow runs entirely in your browser and only generates prompts — you paste those prompts and your code into the AI you already use. NewPrompt never executes code or sends it to a server.

Part of these projects

Complete build journeys that include this workflow as a stage.

Guides for this workflow

Recommended next workflow

Tip: Each step's resource opens its tool pre-filled — start at step one and carry the output forward.