code-review

A set of code-review rules for checking correctness, security, readability, performance, style, tests, and error paths, as well as giving actionable feedback.

In plain words
What is it for?
Use it to review code changes, tests, pull requests, API failures, invalid input, missing files, and security issues.
Why use it?
It makes reviews focus on real risks and gives authors specific changes they can act on instead of vague criticism.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursor-doctor/code-review
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursor-doctor
Per session 821 This file is loaded in full into every session.
When invoked 821 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00821 $0.00821
Opus 5 $0.00411 $0.00411
Sonnet 5 $0.00164 $0.00164
Haiku 4.5 $0.00082 $0.00082

Measured 2d ago against content hash 499b004aaf8d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-review scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to code-review — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

pro-kit/templates/practices/code-review.mdc · 38 lines

How it starts

The opening of the file, as written. The whole thing — 38 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Review Rules

As a Reviewer

  • Review in this priority order: correctness → security → readability → performance → style. Don't block a PR on naming preferences when there's an unchecked SQL injection
  • Point to the specific line. Suggest the specific fix. "This could be better" is not actionable. "This query is vulnerable to SQL injection — use parameterized queries: db.query('SELECT * FROM users WHERE id = $1', [id])" is
  • Ask questions for things you don't understand: "Why does this retry 5 times instead of 3?" — often the author knows something you don't, or they'll realize it's wrong
  • Approve when it's correct and maintainable, even if you'd write it differently. Your style preference is not a bug. Blocking for style teaches the team to stop requesting your review
  • Review the test changes as carefully as the implementation — tests with wrong assertions pass and give false confidence

What to Look For

  • Does the code actually do what the PR title/description claims? Read the diff, don't trust the summary
  • Error paths: what happens when the API call fails, the file doesn't exist, the user input is garbage? Missing error handling passes code review because reviewers follow the happy path
  • N+1 queries: a loop that makes a database call per iteration. This passes every review because it works perfectly with 3 test records and melts the database with 10,000
  • Auth/authz: is the new endpoint protected? Does it check object ownership or just authentication? New endpoints without permission checks are the most common security review miss
  • Breaking changes: does this change affect other consumers? API contract changes, database migrations, config format changes, event schema changes — anything downstream consumers depend on

As a PR Author

  • Self-review the diff before requesting review — you'll catch formatting, debug logs, TODO comments, and accidental file inclusions. If you didn't review your own diff, you're wasting the reviewer's time on typos
  • PR description: what changed, why, how to test, and any risks. "Fixed the bug" is useless. "Users were seeing stale data because the cache TTL was 24h. Changed to 5min. Risk: higher DB load, monitoring dashboard link: X"
  • Keep PRs under 400 lines of meaningful changes. Larger PRs get rubber-stamped because reviewers lose focus after 20 minutes. Split large changes into a stack: refactor → add interface → implement feature
  • Respond to every comment: resolve, explain, or acknowledge. Silent resolution leaves the reviewer wondering if you agreed or disagree

Read the full file on GitHub · 38 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 38 lines · 821 tokens per session scan A 499b004aaf8d

Subscribe to this mod's changes

code-review is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 821 tokens to every session, about $0.0041 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to code-review, differing in 0 lines, and is treated as a copy.