--- name: code-review description: Review changed code against the Refactoring smell catalog in six groups (bloaters, obscurity, couplers, dispensables, comment contract, shallow modules). Run when a file change is complete or an implementation is complete, e.g. from jsc-sdlc implement. Each group runs as a sub agent over the git diff; findings are reported with file:line, severity, and refactoring, and the caller decides whether to fix. Not a replacement for the CLI's built-in security or bug review. --- # code-review — 壞味道分組審查 依 `references/smells.md`(來自《Refactoring》)審查變更的程式碼。 ## 審查時機 1. **檔案變更完成時**:單檔或一組相關檔案改完。 2. **實作完成時**:一個工作包的所有待辦完成(`jsc-sdlc:implement` 步驟 6 呼叫)。 ## 分工 - 本技能專注《Refactoring》壞味道與註解契約(第 5 組)與淺模組(第 6 組)。 - 安全性、邏輯 bug、測試涵蓋率交給 CLI 內建的 review 能力(例:claude 的 `/security-review`),不重複實作。 ## 流程 1. 取得審查範圍:`git diff`(未 commit 變更)或 `git diff {base}...HEAD`(實作完成時對基準分支);列出變更檔案清單。 2. 六組檢查分組進行,**每組必須以 sub agent 執行**,六組可平行: | 組 | 範圍 | | --- | --- | | 1 結構與體積(Bloaters) | smells.md 第 1 組 | | 2 可讀性與命名(Obscurity) | smells.md 第 2 組 | | 3 耦合與設計(Couplers) | smells.md 第 3 組 | | 4 邏輯與壞習慣(Dispensables & Others) | smells.md 第 4 組 | | 5 註解問題(介面契約) | smells.md 第 5 組 | | 6 淺模組(Shallow Module) | smells.md 第 6 組 | 每個 sub agent 的指示:只讀不改;依該組的「定義 / 偵測訊號」逐檔檢查變更行與其所在函式/類別;每筆發現回報 `檔案:行號`、壞味道名稱、嚴重度(高/中/低,依 smells.md 分級)、一句話證據、建議重構手法。 3. 彙整六組發現:去除重複(同位置多組命中時合併並列出所有壞味道)、依嚴重度排序。 4. 回報審查結果清單。**本技能不修改程式碼**;是否修正由呼叫端決定(實作流程中通常高、中必修,低擇要修)。 ## 注意 - 第 5 組範例資料若查詢資料庫取得,必須去識別化,不可含個資。 - 無任何發現時明確回報「無發現」,不可留白。