Skip to content
sinc-LLMBook a 30-minute call

Engineering instrument

Code Review Prompt Template — AI-Structured Analysis

Code review prompt template for AI-assisted reviews. The 6-band sinc structure specifies review depth, what to focus on, severity levels, and what not to nitpick — producing actionable review feedback.

Inputs, specification fields, and output format for the task described here.

A code-review prompt can state focus areas, severity levels and exclusions. Check actual findings against the code and task; a structured template does not establish a smaller or more actionable finding set.

x(t) = Σ x(nT) · sinc((t − nT) / T)
Code review signal-to-noise ratio is determined by prompt structure. The sinc template encodes what matters before the model reads a line of code.

This template is configured for a security-focused review of authentication code — the highest-stakes review type where missing a vulnerability has real consequences:

{
  "formula": "x(t) = Σ x(nT) · sinc((t - nT) / T)",
  "T": "specification-axis",
  "fragments": [
    {
      "n": 0,
      "t": "PERSONA",
      "x": "You are a senior security engineer doing a pre-merge review. You think like an attacker, not a teacher. You look for vulnerabilities that could be exploited in production, not style improvements. You rate severity honestly — if something is low risk, say so."
    },
    {
      "n": 1,
      "t": "CONTEXT",
      "x": "This is a password reset flow in a production web app. It handles generating reset tokens, sending emails, and validating tokens at redemption time. The code is being reviewed before merging to main. The service handles 50,000 users."
    },
    {
      "n": 2,
      "t": "DATA",
      "x": "[paste the code to review here]\n\nStack: Python 3.11, FastAPI, SQLAlchemy, itsdangerous for token signing. Token expiry: 1 hour. Database: PostgreSQL."
    },
    {
      "n": 3,
      "t": "CONSTRAINTS",
      "x": "Do NOT comment on code style, naming conventions, or formatting — those are handled by the linter. Do NOT suggest docstrings. Do NOT flag issues that the linter would catch. Only report findings that could cause: (1) security vulnerabilities, (2) data corruption, (3) authentication bypass, (4) token enumeration attacks, (5) race conditions that affect correctness. Rate each finding: CRITICAL (block merge), HIGH (fix before next release), MEDIUM (fix in next sprint), LOW (optional). Skip LOW findings unless there are fewer than 3 higher-severity findings."
    },
    {
      "n": 4,
      "t": "FORMAT",
      "x": "Numbered findings only. Each finding: [SEVERITY] — file:line — issue description (1-2 sentences) — specific exploit scenario — fix recommendation (1-2 sentences). Maximum 8 findings. If code is clean, say 'No critical or high findings. Code is safe to merge.' Do not add preamble."
    },
    {
      "n": 5,
      "t": "TASK",
      "x": "Review the password reset code for security vulnerabilities, data integrity risks, and authentication bypass vectors."
    }
  ]
}

When a code review prompt includes a severity rating framework, the model applies it as a filter before generating output. Without it, all findings are implicitly equal — a missing docstring gets the same weight as a timing attack vulnerability. With it, the model categorizes each finding before reporting it, and your CONSTRAINTS can suppress low-priority categories entirely.

The example triage rule prioritizes higher-severity findings. Evaluate whether it retains relevant issues and supports the team’s review process; no response or remediation result is established here.

Use PERSONA to state a review perspective, then independently verify the resulting findings. A requested role does not establish that the response finds security, performance or API defects.

Review this code for my password reset feature. Point out any issues you find. [code pasted]
PERSONA: Security engineer, thinks like attacker, rates severity honestly.
CONSTRAINTS: No style/naming/docstring comments. Only security, data corruption, auth bypass, race conditions. Rate CRITICAL/HIGH/MEDIUM/LOW. Max 8 findings.
FORMAT: Numbered findings with severity + exploit scenario + fix. No preamble.

Compare raw and structured review prompts on the same code with independent issue verification. Record valid findings, severity and missed issues; no finding-count advantage or recovered critical issue is established here.

Try AI Transform — Structure Your Review Prompt Free
Scope and context

sinc-LLM / Code Review Prompt Template