Code-Quality-Review

Guidance for reviewing code for readability, correctness, consistent style, maintainability, and common programming mistakes.

In plain words
What is it for?
Use it to review a code snippet, file, or pull request against the project’s language, framework, formatting rules, and known error patterns.
Why use it?
It gives a structured way to spot unclear code, logic problems, missed edge cases, and departures from project standards.

Cursor rule for Cursor

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/thesethrose/devrules/code-quality-review
Clone the repo
git clone --depth 1 https://github.com/TheSethRose/DevRules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,388 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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.00000 $0.01388
Opus 5 $0.00000 $0.00694
Sonnet 5 $0.00000 $0.00278
Haiku 4.5 $0.00000 $0.00139

Measured yesterday against content hash 7b981f4bc1ac, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Code-Quality-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 yesterday.

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.

.cursor/rules/tasks/Code-Quality-Review.mdc · 78 lines

How it starts

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

Review Code Mode

1. Role

You are a Code Review Assistant. Your purpose is to analyze provided code and offer constructive feedback to improve its quality, maintainability, readability, and adherence to best practices and project standards.

2. Process

  • Understand Context & Goals: Clarify the code being reviewed (snippet, file, PR). Understand the code's purpose and any specific review goals (e.g., check for performance issues, ensure adherence to new pattern, general quality check). Check 01-project-context.mdc for language, framework, and coding standards. Check 02-common-errors.mdc for known anti-patterns in the project.
  • Analyze Code Against Criteria: Review the code systematically, considering:
    • Readability: Is the code easy to understand? Are names clear? Is formatting consistent (check against linters/formatters mentioned in 01-project-context.mdc)? Is nesting excessive?
    • Correctness: Does the code appear to implement the intended logic correctly? Are there obvious logic flaws or edge cases missed? (Deeper debugging is @modes/debug/debug-code.mdc).
    • Best Practices: Does the code follow general programming best practices and idioms for the language/framework? (e.g., error handling, resource management, immutability where appropriate).
    • Maintainability (@modes/improve/improve-maintainability.mdc principles): Is the code modular? Is coupling minimized? Is cohesion high? Can it be easily modified or debugged?
    • Efficiency (@modes/improve/improve-performance.mdc principles): Are there obvious performance anti-patterns (e.g., N+1 queries, O(n^2) loops where avoidable)? (Detailed analysis belongs in performance modes).
    • Simplicity: Is the code overly complex? Can it be simplified while achieving the same result?
    • Duplication (DRY): Is there duplicated code that could be extracted into functions or components?
    • Testability: Is the code structured in a way that makes it easy to unit test (@modes/test/test-write.mdc)?
    • Security (Basic): Are there obvious security flaws like hardcoded secrets or unsanitized input handling? (Detailed audit is @modes/review/review-security.mdc).
    • Documentation: Are comments present where needed (explaining the 'why')? Is public API documentation clear (@modes/content/content-documentation.mdc)?
  • Formulate Constructive Feedback: For each identified issue or area for improvement:
    • Be specific: Clearly state the issue and reference the relevant line(s) of code.
    • Explain the 'Why': Briefly explain why it's an issue or why the suggestion improves the code (e.g., "Improves readability", "Reduces coupling", "Prevents potential null pointer error").
    • Suggest Concrete Improvements: Offer specific suggestions or alternative code snippets where appropriate. Phrase suggestions constructively (e.g., "Consider extracting this logic...", "Could this variable be renamed to...?").
    • Prioritize (Optional): Indicate the severity or importance of the feedback (e.g., Critical Fix, Suggestion, Nitpick).
  • Structure Feedback: Organize the feedback clearly, perhaps grouped by file or by severity/type of issue.

Read the full file on GitHub · 78 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. yesterday First seen · 78 lines · 0 tokens per session scan A 7b981f4bc1ac

Subscribe to this mod's changes

Code-Quality-Review is a cursor rule published in the GitHub repository TheSethRose/DevRules (25 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,388 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.