$npx -y skills add alibaba/open-code-review --skill open-code-reviewPerforms AI-powered code review on Git changes using the ocr CLI from alibaba/open-code-review. Use when the user asks to review code, review a pull request, review staged/unstaged changes, review a commit, or compare branches for code quality issues. Produces line-level review
| 1 | # Open Code Review |
| 2 | |
| 3 | This Codex plugin skill intentionally mirrors the canonical skill at |
| 4 | `skills/open-code-review/SKILL.md`. Keep both files synchronized when updating |
| 5 | OCR agent instructions; a symlink is avoided because plugin installs may only |
| 6 | materialize the plugin subtree. |
| 7 | |
| 8 | A skill for invoking [open-code-review](https://github.com/alibaba/open-code-review) (`ocr`) — an open-source AI code review CLI that reads Git diffs and generates structured, line-level review comments. |
| 9 | |
| 10 | ## Prerequisites check |
| 11 | |
| 12 | Before starting a review, verify the environment: |
| 13 | |
| 14 | ```bash |
| 15 | # 1. Check the CLI is installed |
| 16 | which ocr || echo "NOT INSTALLED" |
| 17 | |
| 18 | # 2. Verify LLM connectivity |
| 19 | ocr llm test |
| 20 | ``` |
| 21 | |
| 22 | If `ocr` is not installed, install it first: |
| 23 | |
| 24 | ```bash |
| 25 | npm install -g @alibaba-group/open-code-review |
| 26 | ``` |
| 27 | |
| 28 | If `ocr llm test` fails, the user must configure an LLM. Guide them with one of these options: |
| 29 | |
| 30 | **Option A — Environment variables (highest priority, recommended for CI):** |
| 31 | |
| 32 | ```bash |
| 33 | export OCR_LLM_URL=https://api.anthropic.com/v1/messages |
| 34 | export OCR_LLM_TOKEN=<api-key> |
| 35 | export OCR_LLM_MODEL=claude-opus-4-6 |
| 36 | export OCR_USE_ANTHROPIC=true |
| 37 | ``` |
| 38 | |
| 39 | **Option B — Persistent config:** |
| 40 | |
| 41 | ```bash |
| 42 | ocr config set llm.url https://api.anthropic.com/v1/messages |
| 43 | ocr config set llm.auth_token <api-key> |
| 44 | ocr config set llm.model claude-opus-4-6 |
| 45 | ocr config set llm.use_anthropic true |
| 46 | ``` |
| 47 | |
| 48 | Stop here and ask the user to provide credentials — never invent or hardcode API keys. |
| 49 | |
| 50 | ## Workflow |
| 51 | |
| 52 | ### Step 1: Gather Business Context |
| 53 | |
| 54 | Analyze the review target (commits, branch, or changes) to extract concise business context. Pass this context via `--background` to improve review quality. |
| 55 | |
| 56 | ### Step 2: Run Code Review |
| 57 | |
| 58 | Run the OCR command with appropriate flags. **Always pass business context via `--background`** when available: |
| 59 | |
| 60 | ```bash |
| 61 | ocr review --audience agent --background "business context here" [user-args] |
| 62 | ``` |
| 63 | |
| 64 | **Argument handling:** |
| 65 | |
| 66 | - **Background context** (RECOMMENDED): use `--background "context"` or `-b "context"` to provide business context for better review quality |
| 67 | - **Default** (no user arguments): reviews staged, unstaged, and untracked changes (workspace mode) |
| 68 | - **Specific commit**: use `--commit` or `-c` to review a single commit against its parent |
| 69 | - **Branch comparison**: use `--from <ref>` and `--to <ref>` to review diff between two refs |
| 70 | - **Timeout**: default timeout is 10 minutes per file; adjust with `--timeout <minutes>` |
| 71 | - **Concurrency**: default concurrency is 8 file workers; reduce with `--concurrency <n>` if rate limits are hit |
| 72 | - **Preview mode**: use `--preview` or `-p` to preview which files will be reviewed without running the LLM |
| 73 | - **Installation**: if `ocr` command is not found, install it by running `npm i -g @alibaba-group/open-code-review` |
| 74 | |
| 75 | **Common invocation patterns:** |
| 76 | |
| 77 | | User says | Command to run | |
| 78 | |-----------|---------------| |
| 79 | | "review my changes" / "review the working copy" | `ocr review --audience agent -b "context"` | |
| 80 | | "review this PR" / "review feature branch" | `ocr review --audience agent -b "context" --from main --to <branch>` | |
| 81 | | "review commit abc123" | `ocr review --audience agent -b "context" --commit abc123` | |
| 82 | | "what would be reviewed?" (dry-run) | `ocr review --preview` | |
| 83 | |
| 84 | **Output mode:** |
| 85 | |
| 86 | - Always use `--audience agent` to suppress progress UI and emit only the final summary |
| 87 | |
| 88 | ### Step 3: Classify and Report |
| 89 | |
| 90 | For each comment from the review output, classify by priority and report all issues to the user: |
| 91 | |
| 92 | - **High**: Obvious bugs, security issues, clear mistakes, or well-founded suggestions with precise fix proposals |
| 93 | - **Medium**: Reasonable concerns but context-dependent, style/performance suggestions, or fixes that require manual implementation |
| 94 | - **Low**: Likely false positives, lacking sufficient context, nitpicks, or meaningless suggestions |
| 95 | |
| 96 | Report all comments grouped by priority level. |
| 97 | |
| 98 | ### Step 4: Fix |
| 99 | |
| 100 | Before applying fixes, check whether the user requested automatic fixes: |
| 101 | |
| 102 | - If the user explicitly requested "review and fix" or similar, proceed with automatic fixes |
| 103 | - If the user only requested "review" without fix intent, ask fo |