review-it
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCC Review
CC代码审查
Run automated code review as a closeout check before committing or shipping. Works across multiple AI coding agents.
Use when:
- user asks for code review / review-it / autoreview
- after non-trivial code edits, before final/commit/ship
- reviewing a local branch or PR branch after fixes
在提交或发布前,将自动化代码审查作为收尾检查步骤。支持多款AI代码Agent。
适用场景:
- 用户要求进行代码审查/review-it/autoreview
- 在完成非琐碎代码编辑后,最终提交/发布前
- 修复完成后审查本地分支或PR分支
Supported Agents
支持的Agent
| Agent | Review Command | Notes |
|---|---|---|
| Claude Code | | Built-in, works on uncommitted changes or diff |
| Codex | | Pass diff file or let it auto-detect |
| OpenCode | | Same as Claude Code |
| DeepSeek TUI | | Pass diff content for analysis |
| Agent | 审查命令 | 说明 |
|---|---|---|
| Claude Code | | 内置功能,可处理未提交变更或差异内容 |
| Codex | | 传入差异文件或让其自动检测 |
| OpenCode | | 与Claude Code相同 |
| DeepSeek TUI | | 传入差异内容进行分析 |
Contract
审查约定
- Treat review output as advisory. Never blindly apply it.
- Verify every finding by reading the real code path and adjacent files.
- Read dependency docs/source/types when the finding depends on external behavior.
- Reject unrealistic edge cases, speculative risks, broad rewrites, and fixes that over-complicate the codebase.
- Prefer small fixes at the right ownership boundary; no refactor unless it clearly improves the bug class.
- Keep going until review returns no accepted/actionable findings.
- If a review-triggered fix changes code, rerun focused tests and rerun review.
- Stop as soon as the review comes back clean with no actionable findings.
- If rejecting a finding as intentional/not worth fixing, add a brief inline code comment only when it explains a real invariant or ownership decision that future reviewers should know.
- Do not push just to review. Push only when the user requested push/ship/PR update.
- 将审查结果视为建议,切勿盲目采纳。
- 通过阅读实际代码路径及关联文件,验证每一项审查发现。
- 当审查发现涉及外部行为时,查阅依赖文档/源码/类型定义。
- 拒绝不切实际的边缘案例、推测性风险、大范围重写以及会过度复杂化代码库的修复方案。
- 优先在合适的职责边界处进行小修复;除非能明确改善bug类别,否则不进行重构。
- 持续执行审查,直到没有可接受/可执行的审查发现为止。
- 若审查触发的修复修改了代码,重新运行针对性测试并再次执行审查。
- 一旦审查结果无任何可执行发现,立即停止。
- 若因设计需求/修复性价比低而拒绝某项审查发现,仅当该决定能解释未来审查者应了解的真实约束或职责划分时,添加简短的内联代码注释。
- 不要仅为了审查而推送代码。仅当用户要求推送/发布/更新PR时才进行推送。
Pick Target
选择审查目标
Claude Code / OpenCode / DeepSeek TUI
Claude Code / OpenCode / DeepSeek TUI
Dirty local work (default — works on uncommitted changes):
/review/reviewBranch/PR work — review all changes against base:
First generate a diff, then review it:
bash
git diff origin/main...HEAD > /tmp/review-it.diffThen review the diff file with a focused prompt:
/review the changes in /tmp/review-it.diff against origin/mainIf an open PR exists, use its actual base:
bash
base=$(gh pr view --json baseRefName --jq .baseRefName)
git diff "origin/$base"...HEAD > /tmp/review-it.diff本地未提交工作(默认 — 可处理未提交变更):
/review/review分支/PR工作 — 审查相对于基准分支的所有变更:
先生成差异文件,再进行审查:
bash
git diff origin/main...HEAD > /tmp/review-it.diff然后使用针对性提示审查差异文件:
/review the changes in /tmp/review-it.diff against origin/main若存在已打开的PR,使用其实际基准分支:
bash
base=$(gh pr view --json baseRefName --jq .baseRefName)
git diff "origin/$base"...HEAD > /tmp/review-it.diffCodex
Codex
bash
undefinedbash
undefinedReview uncommitted changes
审查未提交变更
codex review
codex review
Review branch diff
审查分支差异
git diff origin/main...HEAD > /tmp/review-it.diff
codex review /tmp/review-it.diff
undefinedgit diff origin/main...HEAD > /tmp/review-it.diff
codex review /tmp/review-it.diff
undefinedParallel Closeout
并行收尾操作
Format first if formatting can change line locations. Then it's OK to run tests and review in parallel:
bash
scripts/review-it --parallel-tests "<focused test command>"Tradeoff: tests may force code changes that stale the review. If tests or review lead to code edits, rerun the affected tests and rerun review until no accepted/actionable findings remain.
若代码格式化会改变行位置,请先执行格式化。之后可并行运行测试与审查:
bash
scripts/review-it --parallel-tests "<focused test command>"权衡:测试可能会迫使代码变更,导致审查结果失效。若测试或审查引发代码编辑,重新运行受影响的测试并再次执行审查,直到没有可接受/可执行的发现为止。
Uncommitted vs Branch Review
未提交变更与分支审查对比
Choose the right mode:
- Uncommitted changes (staged/unstaged): use directly (or
/review)codex review - Committed, not pushed: use + review
git diff origin/main...HEAD - Pushed/PR: same as committed, against the PR base
- Clean working tree: skip review if there's truly nothing to review
选择合适的模式:
- 未提交变更(已暂存/未暂存):直接使用 (或
/review)codex review - 已提交但未推送:使用 + 审查
git diff origin/main...HEAD - 已推送/PR:与已提交未推送情况相同,对比PR基准分支
- 干净工作区:若确实无内容可审查,跳过审查
Helper
辅助脚本
Bundled helper script for parallel test + review orchestration:
bash
~/.claude/skills/review-it/scripts/review-it --helpThe helper:
- Detects whether to use uncommitted review or branch diff review
- For branch mode: generates diff against (or PR base), then triggers review
origin/main - Supports for concurrent test + review execution
--parallel-tests - Supports for checking what command would be used
--dry-run - Prints when review is clean
review-it clean: no accepted/actionable findings reported
用于并行测试+审查编排的内置辅助脚本:
bash
~/.claude/skills/review-it/scripts/review-it --help该辅助脚本:
- 自动检测应使用未提交变更审查还是分支差异审查
- 分支模式下:生成与 (或PR基准分支)的差异文件,然后触发审查
origin/main - 支持 参数以并发执行测试与审查
--parallel-tests - 支持 参数以查看将执行的命令
--dry-run - 当审查无问题时,输出
review-it clean: no accepted/actionable findings reported
Final Report
最终报告
Include:
- review target (uncommitted / branch / PR base)
- tests/proof run
- findings accepted/rejected, briefly why
- the clean review result, or why a remaining finding was consciously rejected
Do not run another review solely to improve the final report wording. If review exited clean with no actionable findings, report that as clean.
需包含:
- 审查目标(未提交变更/分支/PR基准分支)
- 运行的测试/验证依据
- 接受/拒绝的审查发现及简要原因
- 审查通过结果,或为何有意识地保留某项发现的原因
不要仅为优化最终报告措辞而再次运行审查。若审查无任何可执行发现且顺利结束,直接报告审查通过即可。