v1.0.0

open-code-review

alibaba@alibaba⭐ 50.0k stars· last commit 3d ago· 141 open issues

>

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

7.5/10
Verified
Oct 11, 2026

// RATINGS

⭐GitHub Stars
⭐⭐⭐⭐⭐ 50.0k on GitHubGitHub ↗

Very popular

🟢ProSkills ScoreAI Verified
7.5/10
📍

Not yet listed on ClawHub or SkillsMP

// README


What is Open Code Review?

Open Code Review is an AI-powered code review CLI tool. It originated as Alibaba Group's internal official AI code review assistant — over the past two years, it has served tens of thousands of developers and identified millions of code defects. After thorough validation at massive scale, we incubated it into an open source project for the community. Simply configure a model endpoint to get started.

It reads Git diffs, sends changed files to a configurable LLM via an agent with tool-use capabilities, and generates structured review comments with line-level precision. The agent can read full file contents, search the codebase, inspect other changed files for context, and produce deep reviews — not just surface-level diff feedback. Beyond diff review, ocr scan reviews entire files for auditing unfamiliar codebases or directories that have no meaningful diff.

Visit the official website for more details.

Highlights

Benchmark

Compared to general-purpose agents (Claude Code), Open Code Review achieves significantly higher Precision and F1 with the same underlying model, while consuming only ~1/9 of the tokens and completing reviews faster. Note that its Recall is lower than general-purpose agents — a deliberate trade-off favoring precision over noise.

A real-world code review benchmark built from 50 popular open-source repositories, 200 real Pull Requests, and 10 programming languages — cross-validated by 80+ senior engineers (1,505 annotated ground-truth issues).

Explore the AACR-Bench dataset on Hugging Face.

MetricWhat it measuresWhy it matters
F1Harmonic mean of precision and recallBest single number for overall review quality
PrecisionProportion of reported issues that are real defectsHigher = fewer false alarms to triage
RecallProportion of real defects that are foundHigher = fewer issues slip through review
Avg TimeWall-clock time per reviewMatters for CI pipeline latency
Avg TokenTotal tokens consumed per reviewDirectly impacts API cost

Benchmark

Why Open Code Review?

The Problem with General-Purpose Agents

If you've used general-purpose agents like Claude Code with Skills for code review, you've likely encountered these pain points:

  • Incomplete coverage — On larger changesets, agents tend to "cut corners," selectively reviewing only some files and missing others.
  • Position drift — Reported issues frequently don't match the actual code location, with line numbers or file references drifting off target.
  • Unstable quality — Natural-language-driven Skills are hard to debug, and review quality fluctuates significantly with minor prompt variations.

The root cause: a purely language-driven architecture lacks hard constraints on the review process.

Core Design: Deterministic Engineering × Agent Hybrid

Open Code Review's core philosophy is to combine deterministic engineering with an agent, each handling what it does best.

Deterministic Engineering — Hard Constraints

For review steps that must not go wrong, engineering logic — not the language model — guarantees correctness:

  • Precise file selection — Determines exactly which files need review and which should be filtered, ensuring no important change is missed.
  • Smart file bundling — Groups related files into a single review unit (e.g., message_en.properties and message_zh.properties are bundled together). Each bundle runs as a sub-agent with isolated context — a divide-and-conquer strategy that stays stable on very large changesets and naturally supports concurrent review.
  • Fine-grained rule matching — Matches review rules to each file's characteristics, keeping the model's attention sharply focused and eliminating information noise at the source. Compared to purely language-driven rule guidance, template-engine-based rule matching is more stable and predictable.
  • External positioning and reflection modules — Independent comment-positioning and comment-reflection modules systematically improve both the location accuracy and content accuracy of AI feedback.

Agent — Dynamic Decision-Making

The agent's strengths are concentrated where they matter most — dynamic decisions and dynamic context retrieval:

  • Scenario-tuned prompts — Prompt templates deeply optimized for code review, improving effectiveness while reducing token consumption.
  • **Scenario-

// HOW IT'S BUILT

// FILES

2 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.

  • plugins/open-code-review/skills/open-code-review/SKILL.md7.8 KBupstream ↗
    ---
    name: open-code-review
    description: >
      Performs 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
      comments and can automatically apply fixes when requested. With appropriate
      review rules, can detect various types of issues including bugs, security
      vulnerabilities, performance problems, and code quality concerns.
    license: Apache-2.0
    compatibility: >
      Requires the `ocr` CLI installed (via `npm install -g
      @alibaba-group/open-code-review` or GitHub release binary). Requires a
      configured supported LLM provider before first run (protocols: Anthropic,
      OpenAI Chat Completions, OpenAI Responses, AWS Bedrock).
    metadata:
      author: alibaba
      homepage: https://github.com/alibaba/open-code-review
      version: "1.0.0"
    ---
    
    # Open Code Review
    
    This Codex plugin skill intentionally mirrors the canonical skill at
    `skills/open-code-review/SKILL.md`. Keep both files synchronized when updating
    OCR agent instructions; a symlink is avoided because plugin installs may only
    materialize the plugin subtree.
    
    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.
    
    ## Workflow
    
    ### Step 1: Gather Business Context
    
    Analyze the review target (commits, branch, or changes) to extract concise business context. Pass this context via `--background` to improve review quality.
    
    ### Step 2: Run Code Review
    
    **Do not pre-check whether `ocr` is installed** — skip probes like `command -v ocr` or `ocr --version`. Assume the CLI is available and run the review directly; that saves a tool call on the common path. Only if the review fails with `command not found` should you install it per Troubleshooting.
    
    Run the OCR command with appropriate flags. **Always pass business context via `--background`** when available:
    
    ```bash
    ocr review --audience agent --background "business context here" [user-args]
    ```
    
    **Argument handling:**
    
    - **Background context** (RECOMMENDED): use `--background "context"` or `-b "context"` to provide business context for better review quality
    - **Default** (no user arguments): reviews staged, unstaged, and untracked changes (workspace mode)
    - **Specific commit**: use `--commit` or `-c` to review a single commit against its parent
    - **Branch comparison**: use `--from <ref>` and `--to <ref>` to review diff between two refs
    - **Timeout**: effective timeout per review group = `--timeout` × review rounds. Default `--timeout 15` with default effort `medium` (2 rounds) gives 30 minutes; `low`/`high` give 15/45 minutes.
    - **Concurrency**: default concurrency is 8 file workers; reduce with `--concurrency <n>` if rate limits are hit
    - **Preview mode**: use `--preview` or `-p` to preview which files will be reviewed without running the LLM
    - **Output file**: use `--output <path>` to write the full result to a file instead of stdout. If the command fails with `unknown flag: --output`, do not continue the review with plain stdout. Ask the user whether to upgrade (`npm i -g @alibaba-group/open-code-review@latest`) and wait for the answer before proceeding. After the user confirms and the upgrade succeeds, rerun with `--output`.
    - **Installation**: if `ocr` command is not found, install it by running `npm i -g @alibaba-group/open-code-review`
    
    **Common invocation patterns:**
    
    | User says | Command to run |
    |-----------|---------------|
    | "review my changes" / "review the working copy" | `ocr review --audience agent -b "context"` |
    | "review this PR" / "review feature branch" | `ocr review --audience agent -b "context" --from main --to <branch>` |
    | "review commit abc123" | `ocr review --audience agent -b "context" --commit abc123` |
    | "what would be reviewed?" (dry-run) | `ocr review --preview` |
    
    **Output mode:**
    
    - Always use `--audience agent` to suppress progress UI and emit only the final summary
    - **Prevent output truncation**: For large reviews or restricted tool environments, pass `--output /tmp/ocr_out.txt` and inspect the file in full via a file reading tool instead of piping stdout through `tail` or `head`, which drops earlier review comments.
    
    **On failure:** If `ocr review` exits non-zero (e.g. an LLM connection error), do not retry blindly — consult the Troubleshooting section below for the matching fix before re-running.
    
    ### Step 3: Report
    
    OCR output includes structured `severity` (critical / high / medium / low) and `category` (bug / security / performance / maintainability / test / style / documentation / other) on each comment. Present results grouped by severity, discarding `low` severity items that are likely false positives or nitpicks.
    
    ### Step 4: Fix
    
    Before applying fixes, check whether the user requested automatic fixes:
    
    - If the user explicitly requested "review and fix" or similar, proceed with automatic fixes
    - If the user only requested "review" without fix intent, ask for permission before applying any changes
    
    When fixing issues and suggestions:
    
    - Focus on critical, high, and medium severity items
    - Apply fixes directly to the code when safe and well-defined
    - For complex fixes requiring manual intervention, clearly describe what needs to be done
    - Always verify fixes with the user before committing
    
    ## Output Format
    
    Each comment in OCR's output contains:
    
    - `path`: File path
    - `content`: Review comment text
    - `start_line` / `end_line`: Line range (both 0 means positioning failed)
    - `category`: Issue category (bug, security, performance, maintainability, test, style, documentation, other)
    - `severity`: Issue severity (critical, high, medium, low)
    - `suggestion_code`: Optional fix suggestion
    - `existing_code`: Optional original code snippet
    - `thinking`: Optional LLM reasoning process
    
    Present results grouped by severity using this template:
    
    ```markdown
    ## Code Review Results
    
    **Files reviewed**: N
    **Issues found**: X critical, Y high, Z medium
    
    ### Critical
    
    - **`path/to/file.java:42`** [bug] — Brief description
      > Recommendation: How to fix
    
    ### High
    
    - **`path/to/file.java:26`** [bug] — Brief description
      > Recommendation: How to fix
    
    ### Medium
    
    - **`path/to/file.ts:88`** [performance] — Brief description
      > Recommendation: How to fix (if applicable)
    ```
    
    If no critical, high, or medium severity issues remain after filtering, state: "Review complete — no critical, high, or medium issues found in N files."
    
    **Handling mispositioned comments:**
    
    When `start_line` and `end_line` are both `0`, the comment failed to locate the exact position in the file. In such cases:
    
    1. Read the comment content to understand the issue
    2. Examine the target file mentioned in the comment
    3. Identify the relevant code section based on the comment's context
    4. Apply the fix or suggestion to the correct location
    
    ## Custom Review Rules
    
    If the user wants project-specific rules, OCR resolves them in this priority order:
    
    1. `--rule <path>` flag (highest)
    2. `<repo>/.opencodereview/rule.json`
    3. `~/.opencodereview/rule.json`
    4. Built-in system defaults (lowest)
    
    By default, the first matching user rule replaces the built-in system rule. Set `merge_system_rule: true` on a rule entry when the matched system rule and user rule should both be included.
    
    Rule file format:
    
    ```json
    {
      "rules": [
        {
          "path": "**/*.java",
          "rule": "All new methods must validate required parameters for null",
          "merge_system_rule": true
        },
        {
          "path": "**/*mapper*.xml",
          "rule": "Check SQL for injection risks and missing closing tags"
        }
      ]
    }
    ```
    
    To preview which rule applies to a file before reviewing:
    
    ```bash
    ocr rules check src/main/java/com/example/Foo.java
    ```
    
    ## Advanced Review Options
    
    Beyond the common flags above, `ocr review` exposes a few groups of contr
  • README.mdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

Plain-text copy, no login: /skill-bundles/alibaba-open-code-review-plugins-open-code-review-skills-open-code-review.md

// REPO STATS

50.0k stars
141 open issues
Last commit: 3d ago