AI 程式設計教程中文版
官方教程中文版Agent 工作流

Agent Review

基於 Cursor 官方 Agent Review 文件解釋本地變更審查、自動觸發、slash command、Source Control 和 review depth。

Agent Review 是 Cursor 內建的程式碼審查能力,用來對本地變更執行專門 review。它不是替代人工 review,而是把“AI 寫完就合併”的風險降下來:先讓 Cursor 找 bug、風險和不一致,再由人決定怎麼處理。

閱讀目標:讀完本章,你應該能配置 Agent Review,知道三種觸發方式,並能選擇 Quick 或 Deep review depth。

1. 怎麼配置

官方文件給出配置路徑:

  1. 開啟 Cursor Settings
  2. 進入 Agents
  3. 找到 Agent Review
  4. 配置偏好。

Agent Review 也會讀取儲存庫中的 BUGBOT.md rules(BugBot 規則檔案,定義自動 PR review 關注點)。要配置這些 rule files,需要參考 BugBot 文件。

2. 三種觸發方式

官方文件列出三種執行 review 的方式。

方式行為適合
Automatic開啟後,每次 commit 後自動執行 Agent Review團隊統一質量門檻
Slash command在 agent window 輸入 /agent-review手動檢查當前工作
Source Control tab從 Source Control 對本地變更和 main branch 做比較審整組 local changes
flowchart TD
  Changes["Local changes"] --> Trigger{"觸發方式"}
  Trigger --> Auto["Automatic after commit"]
  Trigger --> Slash["/agent-review"]
  Trigger --> Source["Source Control tab"]
  Auto --> Review["Agent Review"]
  Slash --> Review
  Source --> Review
  Review --> Findings["Findings / risks / suggestions"]
  Findings --> Human["Human decides fix / ignore / test"]

3. Quick 與 Deep

官方文件列出兩個 review depth。

DepthSpeedCostBest for
QuickFastLow小 diff、格式改動、快速 sanity check
DeepSlowHigh複雜邏輯、安全敏感程式碼、大重構

選擇建議:

  • 文案、格式、輕微樣式改動:Quick。
  • 跨檔案邏輯變更:Deep。
  • 許可權、認證、支付、資料、安全相關:Deep。
  • 釋出前最終檢查:按風險選 Deep 或結合人工 review。

4. Source Control 視角很關鍵

官方說明 Source Control tab 的 Agent Review 會比較 all local changes against your main branch,而不是隻看最近一次 edit。

這很重要。Agent 一次任務可能只改了一部分,但你本地可能還有歷史未提交改動。Source Control 視角可以檢查完整工作集,避免只審最近訊息造成漏看。

提交前至少看一次 Source Control 全域性 diff。Agent Review 的結果要和測試、lint、build、人工 review 一起使用。

深讀:為什麼 Agent Review 不能替代人工 review

Agent Review 能快速發現 bug、風險和不一致,但它不知道所有產品背景、客戶承諾、團隊釋出視窗和業務權衡。它也可能漏掉需求層面的錯誤:程式碼沒 bug,但做的不是使用者真正要的東西。

因此它適合放在人工 review 前:先做機器檢查,再由人判斷是否採納、是否補測試、是否調整方案、是否允許提交。

5. 推薦審查閉環

  1. 讓 Agent 完成任務或 Plan Mode 構建。
  2. 看 diff。
  3. 跑已有測試或構建。
  4. 觸發 /agent-review 或 Source Control Review。
  5. 對關鍵 finding 讓 Agent 最小修復。
  6. 再跑測試。
  7. 人工決定是否提交。

本章自檢

完成本章後,用這 3 個問題檢查自己是否真正理解:

  1. Agent Review 有哪三種觸發方式?
  2. Quick 和 Deep 應該怎麼選?
  3. 為什麼 Source Control tab 的 review 比只看最近一次 agent edit 更穩?

透過標準:你能在提交前對本地變更執行合適深度的 Agent Review,並把 finding 轉成可驗證修復。

官方來源

  • Cursor Agent Review —— 官方說明 setup、自動 / slash command / Source Control 三種觸發方式,以及 Quick / Deep review depth。
  • Cursor BugBot —— Agent Review 讀取 BUGBOT.md rules 的關聯文件。

接下來去哪

本頁目錄