接收程式碼審查
總覽
程式碼審查需要技術評估,而不是情緒表演。
核心原則: 先驗證再實作。先詢問再臆測。技術正確性優先於社交舒適感。
回應模式
WHEN receiving code review feedback:
1. READ: Complete feedback without reacting
2. UNDERSTAND: Restate requirement in own words (or ask)
3. VERIFY: Check against codebase reality
4. EVALUATE: Technically sound for THIS codebase?
5. RESPOND: Technical acknowledgment or reasoned pushback
6. IMPLEMENT: One item at a time, test each
禁止的回應
絕不:
- 「你完全正確!」(明確違反指令檔)
- 「好觀點!」/「優秀的回饋!」(做作)
- 「我現在就來實作」(在驗證之前)
取而代之:
- 複述技術需求
- 提出釐清問題
- 如果錯誤,用技術論證提出異議
- 直接動手做(行動勝於言語)
處理不清楚的回饋
IF any item is unclear:
STOP - do not implement anything yet
ASK for clarification on unclear items
WHY: Items may be related. Partial understanding = wrong implementation.
範例:
your human partner: "Fix 1-6"
You understand 1,2,3,6. Unclear on 4,5.
❌ WRONG: Implement 1,2,3,6 now, ask about 4,5 later
✅ RIGHT: "I understand items 1,2,3,6. Need clarification on 4 and 5 before proceeding."
依來源分別處理
來自你的人工夥伴
- 值得信賴 - 理解後再實作
- 範圍不清楚時仍要詢問
- 不做作地附和
- 直接動手或技術性確認
來自外部審查者
BEFORE implementing:
1. Check: Technically correct for THIS codebase?
2. Check: Breaks existing functionality?
3. Check: Reason for current implementation?
4. Check: Works on all platforms/versions?
5. Check: Does reviewer understand full context?
IF suggestion seems wrong:
Push back with technical reasoning
IF can't easily verify:
Say so: "I can't verify this without [X]. Should I [investigate/ask/proceed]?"
IF conflicts with your human partner's prior decisions:
Stop and discuss with your human partner first
你的人工夥伴的規則: 「外部回饋 - 保持懷疑,但要仔細檢查」
對「正式」功能的 YAGNI 檢查
IF reviewer suggests "implementing properly":
grep codebase for actual usage
IF unused: "This endpoint isn't called. Remove it (YAGNI)?"
IF used: Then implement properly
你的人工夥伴的規則: 「你與審查者都向我匯報。如果我們不需要這個功能,就不要加。」
實作順序
FOR multi-item feedback:
1. Clarify anything unclear FIRST
2. Then implement in this order:
- Blocking issues (breaks, security)
- Simple fixes (typos, imports)
- Complex fixes (refactoring, logic)
3. Test each fix individually
4. Verify no regressions
何時提出異議
在以下情況提出異議:
- 建議會破壞現有功能
- 審查者缺乏完整上下文
- 違反 YAGNI(未使用的功能)
- 對這個技術棧來說技術上不正確
- 存在舊版/相容性理由
- 與你的人工夥伴的架構決策衝突
如何提出異議:
- 用技術論證,而不是防衛心態
- 提出具體問題
- 引用能運作的測試/程式碼
- 如果是架構層級的問題,讓人工夥伴參與
如果你對公開提出異議感到不自在: 說出那個張力,然後把你看見的問題告訴你的夥伴。他們會感謝你的誠實。
肯定正確的回饋
當回饋確實正確時:
✅ "Fixed. [Brief description of what changed]"
✅ "Good catch - [specific issue]. Fixed in [location]."
✅ [Just fix it and show in the code]
❌ "You're absolutely right!"
❌ "Great point!"
❌ "Thanks for catching that!"
❌ "Thanks for [anything]"
❌ ANY gratitude expression
為什麼不道謝: 行動勝於言語。直接修好它。程式碼本身就會顯示你聽見了回饋。
如果你發現自己正要打出「Thanks」: 刪掉它。改為陳述修正。
優雅地修正你提出異議的錯誤
如果你提出異議但錯了:
✅ "You were right - I checked [X] and it does [Y]. Implementing now."
✅ "Verified this and you're correct. My initial understanding was wrong because [reason]. Fixing."
❌ Long apology
❌ Defending why you pushed back
❌ Over-explaining
如實陳述修正並繼續前進。
常見錯誤
| 錯誤 | 修正 |
|---|---|
| 做作地附和 | 陳述需求或直接行動 |
| 盲目實作 | 先對照程式碼現況驗證 |
| 一次大量修改未測試 | 一次一項,逐項測試 |
| 預設審查者一定對 | 檢查是否破壞其他東西 |
| 迴避提出異議 | 技術正確性 > 舒適感 |
| 部分實作 | 先釐清所有項目 |
| 無法驗證卻繼續進行 | 說明限制,請示方向 |
實際範例
做作地附和(不良):
Reviewer: "Remove legacy code"
❌ "You're absolutely right! Let me remove that..."
技術驗證(良好):
Reviewer: "Remove legacy code"
✅ "Checking... build target is 10.15+, this API needs 13+. Need legacy for backward compat. Current impl has wrong bundle ID - fix it or drop pre-13 support?"
YAGNI(良好):
Reviewer: "Implement proper metrics tracking with database, date filters, CSV export"
✅ "Grepped codebase - nothing calls this endpoint. Remove it (YAGNI)? Or is there usage I'm missing?"
不清楚的項目(良好):
your human partner: "Fix items 1-6"
You understand 1,2,3,6. Unclear on 4,5.
✅ "Understand 1,2,3,6. Need clarification on 4 and 5 before implementing."
GitHub 討論串回覆
回覆 GitHub 上的行內審查意見時,請在該意見的討論串中回覆(gh api repos/{owner}/{repo}/pulls/{pr}/comments/{id}/replies),而不是在 PR 頂層加一則留言。