open-code-review-delegate
它能做什么
这个工具可以帮助审查编程代码。它会找出需要检查的代码部分,以及应该遵循的规则,而把详细的分析交给主代理的智能来完成。当你希望由主代理来执行审查时,这个工具很有用。
适用场景
- ✓当你希望主 AI 代理来分析代码时。
- ✓当你想检查某段特定代码或一组文件中的改动时。
- ✓当你需要比较不同版本的代码,以便进行审查时。
技能链接
https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/skills/open-code-review-delegate/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我审查一下代码,重点关注安全性和性能。”
每周 5 个新技能,1 分钟读完。
工作原理
首先,这个工具会找出需要审查的文件,以及适用的规则。然后,它会获取代码版本之间的差异(也就是改动的内容)。最后,主代理会利用这些信息完成审查。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Open Code Review — Delegation Mode
This Codex plugin skill intentionally mirrors the canonical skill at
skills/open-code-review-delegate/SKILL.md. Keep both files synchronized when
updating OCR delegation instructions; a symlink is avoided because plugin
installs may only materialize the plugin subtree.
A skill for performing AI code review where OCR provides deterministic engineering (file filtering, rule resolution) and the host agent performs the actual review using its own intelligence and tools.
Workflow
Step 1: Preview — Determine What to Review
ocr delegate preview --format json [--from <ref> --to <ref>] [--commit <hash>] [--exclude <patterns>]
This outputs:
- mode (workspace / range / commit)
- from / to / commit / merge_base — ref metadata for constructing git commands
- Reviewable file list — paths, status, insertions/deletions
- Excluded files — with exclusion reason
Common invocations:
| Scenario | Command |
|---|---|
| Workspace changes | ocr delegate preview |
| Branch comparison | ocr delegate preview --from main --to feature |
| Single commit | ocr delegate preview -c abc123 |
Step 2: Get Rules for Files
ocr delegate rule --format json <path1> <path2> ...
Pass the reviewable file paths from Step 1. Output is grouped by rule content — files sharing the same rule appear under one group, avoiding repetition.
Step 3: Get Diffs
Choose the diff command using the mode and refs from Step 1. Use git --no-pager for every Git call during the review.
The diff commands disable external diff programs, text conversion, and color to produce plain patches.
Range mode (merge_base provided in preview output):
git --no-pager diff --no-ext-diff --no-textconv --no-color <merge_base>..<to> -- "<path>"
Commit mode:
git --no-pager show --no-ext-diff --no-textconv --no-color <commit> -- "<path>"
Workspace mode:
# Tracked files
git --no-pager diff --no-ext-diff --no-textconv --no-color HEAD -- "<path>"
# New untracked files — read directly (entire file is new code)
cat "<path>"
To read context:
git --no-pager log --no-color --oneline -- "<path>"
git --no-pager blame --no-textconv -- "<path>"
git --no-pager show --no-ext-diff --no-textconv --no-color "<ref>:<path>"
For large diffs, add --output="<absolute-diff-file>" to the command for the selected mode. Choose a unique absolute path outside the repository and create its parent directory. Use the same path in file-reading tool calls:
git --no-pager diff --no-ext-diff --no-textconv --no-color --output="<absolute-diff-file>" <merge_base>..<to> -- "<path>"
After Git exits with code 0, read and review the entire file in chunks, then remove it. If Git fails or times out, retry or record skipped with the error. Check unexpectedly empty output against a fresh preview.
Step 4: Review Each File
Create a checklist containing every reviewable_files entry. For each reviewable file:
Use (path, status) as the checklist identity. Workspace mode can report the same path twice when a staged deletion is followed by an untracked recreation.
- Get its diff (Step 3)
- Consult its Rule Group (from Step 2) for the review checklist
- Conduct a thorough review, using appropriate context tools as needed
- Mark the file
reviewed, orskippedwith a concrete reason
For large changes, review in bounded batches grouped by shared rules and diff size. Do not stop after finding the first high-severity issue.
Step 5: Format Output
Each comment must follow this structure:
| Field | Type | Required | Description |
|---|---|---|---|
| path | string | yes | Relative file path |
| content | string | yes | Review comment describing the issue |
| start_line | integer | no | Start line in the new file |
| end_line | integer | no | End line in the new file |
| category | enum | no | bug, security, performance, maintainability, test, style, documentation, other |
| severity | enum | no | critical, high, medium, low |
Step 6: Classify and Report
Before reporting, verify that every previewed file is accounted for. Include total_files, reviewed_files, skipped_files, and coverage_rate in the summary. A skipped file must include its reason.
Group findings by severity:
- Critical/High: Bugs, security issues, data loss risks — always report
…
常见问题
“委派”是什么意思?
意思是这个工具把主要的分析工作交给主 AI 代理,自己只负责整理和准备分析所需的信息。
使用这个工具需要懂编程吗?
不需要,这个工具设计得很简单。你只需要说明你想审查什么就可以了。
什么是“规则”?
规则是代码应该遵守的指导原则或标准,比如安全方面或编程风格方面的最佳实践。
详情
作者的原始描述
Delegation mode for open-code-review (OCR). Instead of OCR calling an LLM endpoint, this skill instructs the host agent to perform the code review itself, using OCR only for deterministic engineering: file selection and rule resolution. Use when the host agent should drive the review with its own LLM capabilities.
repo: alibaba/open-code-review
热度
- GitHub 星标
- 47k
- 排名
- #6315
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/15
评论
- …