code-review

A rule file defining a pull request review checklist, where a pull request is a proposed set of code changes for a team to inspect before merging. It covers developer, architecture, security, and performance reviews.

In plain words
What is it for?
Checking code logic and maintainability, design and dependencies, input and access controls, sensitive data handling, and likely performance problems.
Why use it?
It gives reviews a consistent set of questions instead of relying only on the reviewer’s personal habits.

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/mr-chen-05/rules-2.1-optimized/code-review
Clone the repo
git clone --depth 1 https://github.com/Mr-chen-05/rules-2.1-optimized
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,029 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.02029
Opus 5 $0.00000 $0.01014
Sonnet 5 $0.00000 $0.00406
Haiku 4.5 $0.00000 $0.00203

Measured 2d ago against content hash e600ea5de85e, 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.

project-rules/code-review.mdc · 242 lines

How it starts

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

🔍 Code Review Workflow - 代码审查工作流

多角色拉取请求审查清单,确保代码质量和团队协作。

🚀 Commands - 命令

  • /code-review - 启动代码审查流程
  • /review-checklist - 显示审查清单
  • /security-review - 安全审查
  • /performance-review - 性能审查

👥 Review Roles - 审查角色

🧑‍💻 Developer Review - 开发者审查

关注点:代码逻辑、可读性、最佳实践

Checklist - 检查清单
  • 代码逻辑正确 - 实现符合需求,逻辑清晰
  • 命名规范 - 变量、函数、类名有意义且一致
  • 代码复用 - 避免重复代码,合理抽象
  • 错误处理 - 适当的异常处理和边界条件
  • 注释质量 - 复杂逻辑有清晰注释
  • 代码风格 - 遵循项目编码规范
Questions to Ask - 审查问题
  • 这段代码是否易于理解和维护?
  • 是否有更简洁的实现方式?
  • 错误处理是否充分?
  • 是否遵循了SOLID原则?

🏗️ Architecture Review - 架构审查

关注点:设计模式、系统架构、扩展性

Checklist - 检查清单
  • 设计模式 - 使用合适的设计模式
  • 模块划分 - 职责分离,模块边界清晰
  • 依赖管理 - 依赖注入,避免循环依赖
  • 接口设计 - API设计合理,向后兼容
  • 扩展性 - 代码易于扩展和修改
  • 性能考虑 - 算法复杂度合理
Questions to Ask - 审查问题
  • 这个设计是否符合系统整体架构?
  • 是否引入了不必要的复杂性?
  • 如何处理未来的需求变更?
  • 是否有潜在的性能瓶颈?

🔒 Security Review - 安全审查

关注点:安全漏洞、数据保护、权限控制

Checklist - 检查清单
  • 输入验证 - 所有用户输入都经过验证
  • SQL注入防护 - 使用参数化查询
  • XSS防护 - 输出编码,CSP配置
  • 认证授权 - 权限检查完整
  • 敏感数据 - 密码、token等安全存储
  • HTTPS使用 - 敏感操作使用HTTPS
Questions to Ask - 审查问题
  • 是否存在潜在的安全漏洞?
  • 敏感数据是否得到适当保护?
  • 权限控制是否足够严格?
  • 是否遵循了安全最佳实践?

⚡ Performance Review - 性能审查

关注点:性能优化、资源使用、扩展性

Checklist - 检查清单
  • 算法效率 - 时间和空间复杂度合理
  • 数据库查询 - 查询优化,避免N+1问题
  • 缓存策略 - 合理使用缓存
  • 资源管理 - 内存泄漏,连接池管理
  • 并发处理 - 线程安全,死锁预防
  • 监控指标 - 关键性能指标监控
Questions to Ask - 审查问题
  • 这段代码在高负载下表现如何?
  • 是否有性能优化的空间?
  • 资源使用是否合理?
  • 如何监控和调试性能问题?

📋 Review Process - 审查流程

1. Pre-Review Preparation - 审查前准备

# 检查PR信息
- PR标题和描述清晰
- 关联相关Issue
- 包含测试用例
- CI/CD检查通过

2. Code Review Steps - 代码审查步骤

Step 1: Overview - 概览
  • 理解PR的目的和范围
  • 检查文件变更列表
  • 评估变更的影响范围
Step 2: Detailed Review - 详细审查
  • 逐文件审查代码变更
  • 应用相应角色的检查清单
  • 标记问题和改进建议
Step 3: Testing Review - 测试审查
  • 检查测试覆盖率
  • 验证测试用例质量
  • 确认边界条件测试
Step 4: Documentation Review - 文档审查
  • API文档更新
  • README和使用指南
  • 代码注释完整性

Read the full file on GitHub · 242 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 · 242 lines · 0 tokens per session scan A e600ea5de85e

Subscribe to this mod's changes

code-review is a cursor rule published in the GitHub repository Mr-chen-05/rules-2.1-optimized (172 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,029 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.