一键导入
open-code-review
Use this skill when asked to review code changes. Runs OpenCodeReview (ocr) in the background, classifies findings by severity, and applies fixes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use this skill when asked to review code changes. Runs OpenCodeReview (ocr) in the background, classifies findings by severity, and applies fixes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | open-code-review |
| description | Use this skill when asked to review code changes. Runs OpenCodeReview (ocr) in the background, classifies findings by severity, and applies fixes. |
Review code changes using the ocr CLI (Alibaba Open Code Review), then
classify and report the findings. If the user asks to fix, apply validated
fixes for High and Medium findings.
ocr (OpenCodeReview CLI) — install: npm i -g @alibaba-group/open-code-reviewocr llm testCopy the review rubric and test-include patterns so test files are reviewed and the senior-engineer rubric is applied automatically:
mkdir -p ~/.opencodereview
cp review-configs/ocr/rule.json ~/.opencodereview/rule.json
Source: review-configs/ocr/ in this repo. A per-project .opencodereview/rule.json
overrides the global one.
Always preview which files will be reviewed before running the full review:
ocr review --preview --from <base> --to <head>
Expect test files under "Will review". If a test file shows under
"Excluded ... (default_path)", the global rule is missing — copy it (see
Prerequisites) or pass --rule <path-to-rule.json>.
Never run ocr in the foreground. Under --audience agent, ocr buffers all
output until completion. A foreground run will be killed by the shell's
~2-minute process watchdog, losing all buffered output. A high timeout on
the calling tool does NOT save a foreground run.
Always pass --timeout 20 (the default is only 10 minutes). Do NOT reduce it
below 20 unless the user explicitly asks; raise it (e.g., --timeout 30) only
for very large reviews.
nohup ocr review --audience agent --timeout 20 \
--from <base> --to <head> > /tmp/ocr_review.log 2>&1 &
echo "PID=$!"
Repeat until the process is DONE. Output only appears once ocr finishes (it is buffered):
sleep 90
ps -p $PID >/dev/null && echo RUNNING || echo DONE
cat /tmp/ocr_review.log
Cap total patience at ~25 minutes (the 20-minute --timeout floor plus
slack). If a run exceeds ~25 minutes with no output, treat it as hung and
investigate the session logs at ~/.opencodereview/sessions/ (the per-run
.jsonl captures all LLM turns and code_comment findings even when stdout
was lost).
Use --format json when you want structured findings (file, line, severity,
suggestion) to classify programmatically; the default text summary is fine
otherwise.
Group the review comments by priority:
config.json only
holds provider/llm/telemetry; env vars are only OCR_LLM_*). The 20-minute
floor is enforced by the --timeout 20 flag — keep it.~/.opencodereview/rule.json overrides this with include patterns for
**/*.test.*, **/*.spec.*, **/__tests__/**, etc., plus a thorough rubric
(merge_system_rule: true). Rule priority: --rule >
<repo>/.opencodereview/rule.json > ~/.opencodereview/rule.json > built-in.ocr scan --path <dir> (also honors the
global rule/include)."include": ["**/*.test.{ts,tsx,js,jsx}", "**/*.spec.{ts,tsx,js,jsx}", "**/__tests__/**"]
and pass --rule <file>.