| name | dual-code-review |
| description | Orchestrate a comprehensive code review process involving both Gemini (Antigravity) and Claude CLI, synthesizing a consensus report. |
Dual Code Review Protocol
透過 Gemini 與 Claude CLI 的雙重審查,產出高可信度的程式碼審查報告。
決策流程圖
flowchart TD
START([開始審查]) --> SCOPE[確定審查範圍]
SCOPE --> PARALLEL{平行分析}
PARALLEL --> GEMINI[Antigravity 分析]
PARALLEL --> CLAUDE[Claude CLI 分析]
GEMINI --> COLLECT[收集兩方結果]
CLAUDE --> COLLECT
COLLECT --> COMPARE{比對發現}
COMPARE -->|雙方都發現| CONFIRMED[✅ Double Verified]
COMPARE -->|僅 Claude 發現| VERIFY_C{驗證 Claude 發現}
COMPARE -->|僅 Gemini 發現| VERIFY_G{驗證 Gemini 發現}
VERIFY_C -->|有效| ACCEPT_C[接受並標記]
VERIFY_C -->|幻覺| DISCARD_C[捨棄]
VERIFY_G -->|有效| ACCEPT_G[接受並標記]
CONFIRMED --> REPORT[產出報告]
ACCEPT_C --> REPORT
ACCEPT_G --> REPORT
DISCARD_C --> REPORT
REPORT --> DONE([完成])
Workflow
1. 確定審查範圍
git diff --staged > /tmp/review_content.txt
git diff main > /tmp/review_content.txt
cat src/auth/*.ts > /tmp/review_content.txt
2. 雙重分析
A. Claude CLI 分析(使用管道模式)
cat /tmp/review_content.txt | claude -p \
"你是資深程式碼審查員。請審查以下程式碼變更。
重點關注:Bug、安全性、效能、可讀性。
以 JSON 格式回傳發現。" \
--output-format json \
--json-schema '{
"type": "object",
"properties": {
"findings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"severity": {"type": "string", "enum": ["High", "Medium", "Low"]},
"category": {"type": "string"},
"file": {"type": "string"},
"line": {"type": "integer"},
"message": {"type": "string"},
"suggestion": {"type": "string"}
},
"required": ["severity", "category", "message"]
}
},
"summary": {"type": "string"}
}
}' \
--allowedTools \
--max-turns 5 | jq > /tmp/claude_review.json