Code Review
Plugin
完整 code review 生態系統,以 Claude Code plugin 形式發布。提供 24 個語言 / 框架專項 reviewer agent、9 個 slash command、以及 3 個自動觸發的安全 review skill。
所有 agent 僅報告 confidence ≥ 80% 的問題。零 finding 是合法結果,代表 clean code,不會強行挑毛病。
核心特性
- 24 個 Reviewer Agent — 涵蓋 TypeScript、Python、Go、Rust、Java、Kotlin、Swift、C++、C#、F#、Django、FastAPI、Flutter、Database、Healthcare(PHI/HIPAA)、ML pipeline
- 六 Agent 並行 PR Review —
/review-pr同時啟動 6 個專項 agent,confidence < 80% 自動過濾 - 多平台 PR Review — 自動偵測 GitHub(需
ghCLI)與 Bitbucket Cloud(需環境變數) - Auto-trigger Skills — 根據任務上下文自動啟動安全掃描,無需手動呼叫
Installation setup
Plugin 安裝(推薦)
在 Claude Code 中執行 /plugin,搜尋 jurislm/code-review,點擊安裝後執行 /reload-plugins 套用。安裝後無需額外設定即可使用所有功能。
手動安裝
# Clone 專案
git clone https://github.com/jurislm/code-review.git
# 複製各元件到全域
cp commands/*.md ~/.claude/commands/
cp agents/*.md ~/.claude/agents/
cp -r skills/* ~/.claude/skills/
Bitbucket 環境變數
使用 Bitbucket Cloud PR review 前,需在 ~/.zshenv(或 ~/.bashrc)加入:
export BB_USERNAME="your-bitbucket-username"
export BB_APP_PASSWORD="your-app-password"
前往 Bitbucket → Settings → Personal settings → App passwords,勾選 Pull requests(Read + Write)權限後建立。
/code-review command
本地 uncommitted 變更 review 或 GitHub / Bitbucket PR review,自動偵測模式。
/code-review [pr-number | pr-url | blank]
Local Review Mode
不傳參數時進入本地模式,對目前 uncommitted 變更進行審查。
/code-review
執行流程:
- GATHER —
git diff --name-only HEAD收集變更檔案;無變更則停止 - REVIEW — 讀每個變更檔案全文,對照安全與品質清單
- REPORT — 依 CRITICAL → HIGH → MEDIUM → LOW 輸出 finding
GitHub PR Review Mode
傳入 PR 號碼或 GitHub URL,需本機安裝 gh CLI 並已登入。
/code-review 123
/code-review https://github.com/owner/repo/pull/123
執行流程(8 phases):Fetch → Context → Review → Validate → Decide → Report → Publish → Output
Bitbucket Cloud PR Review Mode
URL 含 bitbucket.org 或 remote origin 指向 Bitbucket 時自動切換,使用 REST API(需 BB_USERNAME、BB_APP_PASSWORD)。
/code-review 123
/code-review https://bitbucket.org/workspace/repo/pull-requests/123
/review-pr command
同時啟動 6 個專項 agent 對同一 PR 進行並行審查,再彙整去重並排序 finding。confidence < 80% 自動過濾。
/review-pr [pr-number | pr-url] [--focus <area>]
/review-pr 123
/review-pr 123 --focus security
/review-pr 123 --focus performance
/review-pr 123 --focus types
/review-pr 123 --focus tests
並行 Agents
| Agent | 負責範圍 |
|---|---|
code-reviewer | 整體品質、安全性、可維護性,含 false positive 過濾 |
comment-analyzer | 行內 comment 準確性、完整性、rot 風險 |
pr-test-analyzer | 測試覆蓋率、行為涵蓋、真實 bug 防護 |
silent-failure-hunter | swallowed error、ignored promise、錯誤傳遞缺失 |
type-design-analyzer | 型別封裝、invariant 表達、強制性 |
code-simplifier | 過度複雜實作、重複抽象、可讀性 |
Language Commands commands
語言專項 command,不傳參數則預設審查 staged changes;可傳入目錄或檔案路徑作為參數。
| Command | 調用的 Agent | 適用 |
|---|---|---|
/python-review | python-reviewer | PEP 8、type hints、安全性、Pythonic idioms |
/go-review | go-reviewer | idiomatic Go、並發安全、錯誤處理、效能 |
/rust-review | rust-reviewer | ownership、lifetimes、unsafe usage、慣用模式 |
/cpp-review | cpp-reviewer | 記憶體安全、modern C++ idioms、並發、效能 |
/kotlin-review | kotlin-reviewer | idiomatic Kotlin、coroutine 安全、Compose |
/fastapi-review | fastapi-reviewer | async 正確性、dependency injection、Pydantic |
/flutter-review | flutter-reviewer | widget 最佳實踐、state management、效能 |
Agents — 通用主審 agents
npm audit 與 ESLint security plugin。Agents — PR 協作 agents
以下 agent 由 /review-pr 並行調用,也可在對話中單獨使用。
string 代表有語義的值)或未充分利用型別系統的模式。Agents — 語言 / 框架專項 agents
通用語言(Sonnet)
| Agent | 專項範圍 |
|---|---|
typescript-reviewer | type safety、async correctness、Node/web 安全性、idiomatic patterns。所有 TypeScript / JavaScript 變更必用。 |
python-reviewer | PEP 8 合規、Pythonic idioms、type hints、安全性、效能。所有 Python 變更必用。 |
go-reviewer | idiomatic Go、concurrency patterns、error handling、效能。所有 Go 變更必用。 |
rust-reviewer | ownership、lifetimes、error handling、unsafe usage、idiomatic patterns。所有 Rust 變更必用。 |
cpp-reviewer | 記憶體安全、modern C++ idioms(C++17/20)、concurrency、效能。所有 C++ 變更必用。 |
csharp-reviewer | .NET conventions、async patterns、安全性、nullable reference types、效能。所有 C# 變更必用。 |
java-reviewer | Spring Boot / Quarkus(自動偵測框架)、layered architecture、JPA/Panache、MongoDB、安全性、concurrency。 |
kotlin-reviewer | idiomatic patterns、coroutine 安全、Compose 最佳實踐、clean architecture、Android / KMP 常見陷阱。 |
swift-reviewer | protocol-oriented design、value semantics、ARC 記憶體管理、Swift Concurrency、idiomatic patterns。 |
fsharp-reviewer | functional idioms、type safety、pattern matching、computation expressions、效能。 |
框架專項(Sonnet)
| Agent | 專項範圍 |
|---|---|
django-reviewer | ORM correctness、DRF patterns、migration 安全、security misconfigurations、production-grade Django 實踐。 |
fastapi-reviewer | async 正確性、dependency injection、Pydantic schemas、安全性、OpenAPI 品質、測試、production readiness。 |
flutter-reviewer | widget 最佳實踐、state management patterns(BLoC / Riverpod / Provider / GetX / MobX / Signals)、Dart idioms、效能、accessibility。Library-agnostic。 |
database-reviewer | PostgreSQL query 優化、schema design、安全性、效能。涵蓋 Supabase 最佳實踐。寫 SQL / 建 migration / 設計 schema 時主動使用。 |
network-config-reviewer | Router / switch 設定的安全性、正確性、stale references、risky change-window commands、操作護欄缺失。 |
特殊領域
| Agent | 專項範圍 |
|---|---|
healthcare-reviewer | 臨床安全、CDSS 準確性、PHI 合規(HIPAA)、醫療資料完整性。適用 EMR/EHR、臨床決策支援、健康資訊系統。使用 Opus 模型。 |
mle-reviewer | data contracts、feature pipelines、training reproducibility、offline/online evaluation、model serving、monitoring、rollback。適用 ML / MLOps / 模型訓練 / 推論 / feature store。 |
Auto-trigger Skills skills
Skills 根據任務上下文自動啟動,無需手動呼叫。以下說明各 skill 的觸發條件與功能。
security-review
觸發條件:實作 authentication / authorization、處理 user input 或 file upload、建立 API endpoint、存取 secrets 或 credentials、實作付款功能、儲存或傳輸敏感資料、整合第三方 API。
提供完整的安全清單,涵蓋 secrets management、input validation、authentication、cryptography、dependency security 等,每項均附反例(FAIL)與正確做法(PASS)的程式碼範例。
security-scan
觸發條件:掃描 .claude/ 設定目錄的安全漏洞,包含 settings.json、hooks、MCP 設定、permission 設定等。
flutter-dart-code-review
觸發條件:Review Flutter / Dart 程式碼時啟動。
Library-agnostic 的 Flutter / Dart 完整 review 清單,涵蓋 widget 最佳實踐、各種 state management 模式(BLoC、Riverpod、Provider、GetX、MobX、Signals)、Dart idioms、效能、accessibility、安全性、clean architecture。
Severity Levels reference
| Level | 定義 | 處理方式 |
|---|---|---|
| CRITICAL | 安全漏洞、資料遺失風險 | BLOCK — merge 前必須修復 |
| HIGH | Bug、顯著品質問題 | WARN — 建議 merge 前修復 |
| MEDIUM | 可維護性問題 | INFO — 考慮修復 |
| LOW | 風格或輕微建議 | NOTE — 選擇性修復 |
HIGH / CRITICAL finding 三要素
每個 HIGH 或 CRITICAL finding 必須同時提供:
- 精確行號 — 指出問題所在的具體位置
- 具體失敗場景 — 描述這個問題在什麼情境下會造成實際問題
- 現有 guard 為何不夠 — 說明目前的防護機制有何缺失
Decision Logic reference
PR review 完成後,依據 finding 嚴重程度自動產生決策:
| 決策結果 | 觸發條件 |
|---|---|
| BLOCK | 任一 CRITICAL finding |
| REQUEST CHANGES | 任一 HIGH finding 或 validation 失敗 |
| APPROVE with comments | 僅 MEDIUM / LOW finding |
| APPROVE | 零 finding |
Design Principles reference
- 高信心原則 — 只報告 confidence > 80% 的問題。不確定的 finding 寧可略過,不製造雜訊。
- 讀全文 — PR review 讀每個變更檔案的全文,而非只看 diff 行。context 是判斷問題的關鍵。
- 零 finding 合法 — clean code 應該得到 APPROVE,不強行挑毛病。
- HIGH / CRITICAL 三要素 — 精確行號 + 具體失敗場景 + 現有 guard 為何不夠,缺一不可。
- False positive 過濾 — 明確排除 LLM reviewer 常見誤判,包含:magic number(有命名常數時)、fire-and-forget(設計如此時)、test fixture(測試資料不算 magic number)、未修改的程式碼(除非 CRITICAL 安全問題)。
Contributing guide
新增 Agent
- 在
agents/建立<name>.md,frontmatter 至少包含name、description、color、model、tools - 若需加入
/review-pr並行流程,更新commands/review-pr.md的 agent 列表 - 更新
README.md的 Agents 表格 - 更新
docs/index.html的 agent 列表與 stats 數字
新增 Command
- 在
commands/建立<name>.md,frontmatter 包含description、argument-hint - 更新
README.md的 Slash Commands 表格 - 更新
docs/index.html的側欄導覽、Commands 區塊、stats 數字
Agent Frontmatter 格式
---
name: my-reviewer
description: <一句話說明觸發時機,Claude 靠這段決定何時使用>
tools: [Read, Grep, Glob, Bash]
model: sonnet # sonnet | opus | haiku
color: blue # green | red | blue | cyan | yellow | magenta
---
<agent prompt content>
所有 agent 必須在 prompt 開頭包含 Prompt Defense Baseline,防止 prompt injection 攻擊。參考現有 agent 的格式。