| 模式 | 誰呼叫 LLM? | 適用場景 |
|---|---|---|
| Agent Skill | OCR | agent 呼叫 ocr review,OCR 驅動完整評審(修復前先問) |
| Command(Claude Code) | OCR | Claude Code 的斜線命令,OCR 驅動評審(預設自動修復) |
| OpenCode 工具 | OCR | 註冊 ocr_review / ocr_health 原生工具 |
| 委託模式 | 宿主 Agent | OCR 提供工程架構,宿主 Agent 用自己的 LLM |
把 OCR 註冊為可呼叫的 skill,讓 agent 框架以正確的參數、前置檢查與分級標準呼叫它。
npx skills add alibaba/open-code-review --skill open-code-review
SKILL.md 讓 agent 執行七步:前置檢查 → CLI 缺失自動安裝 → 無 LLM 停下詢問 → 提取業務脈絡 → 跑評審 → 分級(High/Medium/Low)→ 按需修復。完整 prompt 在 skills/open-code-review/SKILL.md。
在 Claude Code 內端到端跑——評審 diff、分類發現、自動套用值得採納的修復。
/plugin marketplace add alibaba/open-code-review
/plugin install open-code-review@open-code-review
註冊 /open-code-review:review 斜線命令。與 Agent Skill 不同,此命令預設自動修復——適合「評審並清理」工作流。命令檔是帶 frontmatter 的純 markdown,其他支援 command 約定的 agent 也能用。
mkdir -p ~/.config/opencode/plugins
curl -fsSL \
https://raw.githubusercontent.com/alibaba/open-code-review/main/plugins/open-code-review/opencode/open-code-review.ts \
-o ~/.config/opencode/plugins/open-code-review.ts
註冊原生工具:ocr_review(評審工作區 / commit / ref 範圍,回傳結構化 JSON)、ocr_health(顯示版本與 LLM 連通性),以及 /ocr-review、/ocr-health 斜線命令。評審用 --audience agent + JSON 輸出、15 分鐘超時、10 MiB 輸出上限。
讓宿主 Agent 用自己的 LLM 執行評審,OCR 只負責檔案篩選與規則解析——詳見 委託模式專頁。
在每個 PR / MR 上跑 OCR。上游提供 GitHub Actions 與 GitLab CI 兩條現成管線——詳見 CI/CD 專頁。
問三個問題:① OCR 的 LLM 要用誰的?② 要自動修復嗎?③ 用什麼 agent 框架?
SKILL.md 讓 agent 執行:① 前置檢查(Git? LLM?)→ ② CLI 缺失自動安裝 → ③ 無 LLM 停下詢問 → ④ 提取業務脈絡 → ⑤ 跑評審 → ⑥ 分級(High/Medium/Low)→ ⑦ 按需修復。關鍵:第 ⑦ 步是修復前先問,不像 Command 的預設自動修復。
把 open-code-review.ts 放到 ~/.config/opencode/plugins/ 就自動註冊。它暴露 ocr_review(結構化 JSON)和 ocr_health(版本+連通性),以及 /ocr-review、/ocr-health 斜線命令。審計用 --audience agent + JSON 輸出、15 分鐘超時、10 MiB 輸出上限。
ocr_review / ocr_health 工具。