Code Review Prompts

Senior-engineer-grade reviews of diffs and PRs.

8+ prompts
4 AI models
Advanced
Code Review prompts
7
AI models supported
3
Parent category
Coding
Total library
410+

Code Review prompts help you produce code review faster using ChatGPT, Claude, Gemini and more. Browse optimized prompts for coding workflows — copy, tweak the placeholders, and ship.

Editorial

The code review prompt library, explained

This is the Code Review hub, part of our broader Coding collection. You'll find 7 code review prompts written specifically for this workflow — each one structured to give the AI the role, audience, format and constraints it needs to produce output you can use immediately.

These prompts are built for software engineers, ML engineers and indie devs who want code, tests and architecture suggestions they can ship. They work across the major AI models — ChatGPT, Claude, Gemini and the leading image and video generators — and they hold up whether you're prompting in a chat window, an editor extension or a workflow tool. Pull these in during scoping, scaffolding, refactors and code reviews — anywhere a teammate would help.

Why these prompts work: each one starts with a clear role, names the audience or scene, defines the output format and adds 2–3 hard constraints. That structure is what separates a vague AI answer from a usable one. The library is curated so you don't have to test 30 versions of the same prompt to find the one that actually performs — that work is already done.

Expect production-style code, types, edge-case handling and at least a smoke test — written in the style you specify. You'll occasionally want to regenerate or refine, especially the first time you use a prompt with your own context. Treat each prompt as a starting structure: the variables and constraints stay, the topic and tone become yours.

Read each prompt before you copy it. Swap the placeholders for your real audience, product and constraints, and add one or two engineering-specific details from your own brief. The prompts here are designed to be edited — the more context you bring, the stronger the output.

If this is your first time using AI for code review, start with the featured prompt below and adapt it to your context. Then explore the related use cases for adjacent workflows that often pair well with this one.

⭐ Editor's Choice

The featured prompt on this page

One prompt we'd ship today. Read why it works, see a preview, and copy it in a click.

Editor's Choice · Tuned for Claude

Generate JSON Schema from Python Dataclasses for OpenAPI

Why it works · It defines the runtime, behaviour and edge cases, then asks for tests — turning the AI from a code generator into a reliable engineering pair.

Best use case

Best for code review workflows where this prompt helps python platform engineers generate accurate json schema definitions directly from their existing `dataclass` or pydantic models. it simplifies the creation of openapi documentation for internal event payloads, ensuring consistency and reducing manual effort in api specification maintenance.

Expected output

Working code in the runtime you specified, with edge cases handled and a small test you can run immediately.

Open full prompt

This prompt helps Python platform engineers generate accurate JSON Schema definitions directly from their existing `dataclass` or Pydantic models. It simplifies the creation of OpenAPI documentation for internal event payloads, ensuring consistency and reducing manual effort in API specification maintenance.

Featured Prompts

Top Code Review prompts

Prompts to copy, tweak and ship right now.

Coding
Claude

Generate JSON Schema from Python Dataclasses for OpenAPI

This prompt helps Python platform engineers generate accurate JSON Schema definitions directly from their existing `dataclass` or Pydantic models. It simplifies the creation of OpenAPI documentation for internal event payloads, ensuring consistency and reducing manual effort in API specification maintenance.

View prompt →
Coding
Claude

Build a Headless React Data Table with Compound Components

Develop a headless React data table using the compound component pattern, featuring sorting, pagination, and column visibility. This solution provides a type-safe, performant foundation for internal tools, eliminating reliance on third-party UI libraries while ensuring accessibility and testability.

View prompt →
Coding
Claude

Typed React Compound Table Component with Generics

This prompt outlines the design and implementation of a React compound table component, including Table.Row and Table.Cell, with TypeScript generics. It focuses on preserving column-specific types throughout the component structure, enhancing type safety and developer experience for complex data tables in design systems.

View prompt →
Coding
Claude

Build a FastAPI CRUD Service with Pydantic V2 and SQLModel

Generate a complete FastAPI CRUD application for a Task resource. It uses Pydantic V2 for robust data schemas, SQLModel for database interaction, and incorporates dependency injection for session management, providing a production-minded Python solution with code, tests, and dependency setup.

View prompt →
Coding
Claude

React Polymorphic Button Component with `as` Prop

Develop a React polymorphic Button component enabling `as` prop usage for `button`, `a`, or `Link` elements. This solution ensures strict type safety by inferring correct props for each element, crucial for maintaining consistency and reducing errors in shared design systems.

View prompt →
Coding
Claude

React SSR Theme Provider with System Preference & Hydration Safety

Implement a reliable SSR-compatible React theme provider. This solution detects user system preferences, persists theme choices to cookies, and prevents the "flash of unstyled content" (FOUC) during hydration. It ensures a consistent UI experience across server and client renders.

View prompt →
Coding
Claude

React Drag-and-Drop Kanban Column with Optimistic UI

Generate a React Kanban column component with native HTML5 drag-and-drop for reordering cards. This solution includes optimistic UI updates, API rollback on failure, and comprehensive tests to ensure a resilient and responsive user experience.

View prompt →

Model comparison

Best AI models for code review

A ranked shortlist of the models PromptInFlow users reach for first.

  1. #1

    ChatGPT

    General-purpose reasoning

    7 code review prompts

  2. #2

    Gemini

    Multimodal reasoning

    7 code review prompts

  3. #3

    Claude

    Long-form writing & analysis

    7 code review prompts

Prompt Writing Guide

How to write better Code Review prompts

Six habits that consistently produce stronger AI output. Apply them to any prompt on this page.

  1. 1

    State the runtime and stack

    Language, version, framework, target platform. "Node 20 on Cloudflare Workers" produces very different code than "any JavaScript".

  2. 2

    Write the requirements first

    Functional behaviour, inputs, outputs, error handling. The AI is excellent at following a spec and mediocre at guessing intent.

  3. 3

    List the edge cases

    Empty arrays, null, network failures, race conditions, oversize payloads. Naming them up front prevents the "happy path only" trap.

  4. 4

    Ask for tests

    Request a small test suite alongside the implementation. Tests force the model to reason about boundaries — and you get verification for free.

  5. 5

    Pin code style

    TypeScript strict, no `any`, named exports, early returns. Pin style and you'll spend zero time on lint cleanup.

  6. 6

    Demand explanations on tricky parts

    Ask the model to comment any non-obvious step. Comments expose flawed reasoning before you ship the code.

Best Practices

Code Review best practices

Apply these in every prompt on this page. Small habits, outsized improvements in output quality.

Pin the runtime and version

Language + framework + version. Skip and you'll get half-deprecated APIs.

Write the spec first

Inputs, outputs, errors, edge cases. The AI is a great spec follower.

Ask for tests alongside code

Tests catch flawed reasoning before you ship.

Forbid `any` in TypeScript

One rule removes 80% of weak AI-generated TS code.

Avoid These

Common Code Review prompt mistakes

The same handful of mistakes are responsible for most weak AI output. Catch them before you hit send.

  • Missing the runtime

    Different runtimes have different APIs. Without it, the AI guesses — usually wrongly.

  • Glossing over edge cases

    If the prompt only describes the happy path, the code will only handle the happy path.

  • Asking for "clean code"

    "Clean" is subjective. Specify naming, style and lint rules instead.

  • Skipping tests

    Without tests you have no way to verify the AI's reasoning. Always ask for at least a smoke test.

  • Pasting too much code

    Dump only the relevant functions and types. Long context dilutes attention.

Pro Tips

Advanced prompt patterns

Side-by-side rewrites that show what separates a weak prompt from a great one.

Instead of

Write a function to debounce.

Use

Write a TypeScript `debounce<T>` higher-order function targeting Node 20. Cancel in-flight calls, return a `.cancel()` method, preserve `this`, type the return as `(...args: Parameters<T>) => void`. Include 4 Vitest tests covering rapid calls, cancel, late call, and `this` binding.

Why it works: Stack, behaviour, types and tests are all defined.

Instead of

Make this API.

Use

Implement a REST endpoint POST /api/invoices in Hono on Cloudflare Workers. Validate body with Zod. Return 400 on invalid input, 409 on duplicate, 201 with the new invoice on success. Include a small handler test and a sample curl.

Why it works: Framework, runtime, errors and verification are pinned.

Instead of

Fix this bug.

Use

Here's the error: `TypeError: cannot read 'map' of undefined`. The function receives `items` from the API. Add a guard, log a warning when it's missing, and update the test to cover the empty case. Don't change the public API.

Why it works: Symptom, expected fix and scope are explicit.

Instead of

Optimise this query.

Use

This Postgres query takes 1.4s on a 12M-row `events` table. The filter is `user_id = ? AND created_at > ?`. Propose 2 index strategies, explain the trade-offs, and rewrite the query if helpful.

Why it works: Volume, filter and trade-off framing produce useful answers.

Instead of

Refactor this code.

Use

Refactor this React component to extract the data fetching into a TanStack Query hook. Keep the rendering identical. Add types, no `any`, and update tests if they reference the old API.

Why it works: Boundary and constraints prevent over-refactoring.

Browse by Model

Every AI model for code review

Jump into the model hub to see how each one handles this workflow.

Parent category

Browse all Coding prompts

Code Review is one of 5 coding workflows on PromptInFlow. Open the full hub for the complete library, FAQs and supported AI models.

Visit Coding hub

Collections

Prompt collections

Curated groups for different skill levels and goals.

6 prompts

Beginner Prompts

Easy starters with clear placeholders — copy, paste, done.

5 prompts

Advanced Prompts

Multi-step prompts with role, constraints and structured output.

4 prompts

Marketing Prompts

Conversion-focused angles built on proven frameworks.

5 prompts

Professional Prompts

Polished, client-ready outputs for day-to-day work.

FAQ

Code Review prompts, answered

Common questions about these prompts.

Related searches

People also search for code review prompts

Popular searches related to this page. Each one links to the closest matching prompt library.

Explore more Code Review prompts

Browse optimized prompts for modern AI models.

View Prompt Library