mit einem Klick
code-refactor
Proactively suggest and execute code refactoring to maintain clean architecture. Triggers: refactor, 重構, 優化程式碼, clean up, 整理程式碼.
Menü
Proactively suggest and execute code refactoring to maintain clean architecture. Triggers: refactor, 重構, 優化程式碼, clean up, 整理程式碼.
Audit and auto-update skills, hooks, instructions, and bylaws to stay in sync with codebase changes. Triggers: self-update, 自主更新, audit skills, 審計技能, update instructions, 更新指令, sync hooks, 同步 hooks.
Assist with Frontend DDD architecture design, component organization, and testing. Triggers: frontend, 前端, react, component, 元件, vitest.
Generate test files for new code including unit, integration, and e2e tests. Triggers: test, 產生測試, generate test, 測試, 寫測試.
Automatically update CHANGELOG.md based on code changes following Keep a Changelog format. Triggers: changelog, 更新 changelog, update changelog, 變更紀錄.
Perform code review with DDD architecture compliance check. Triggers: review, 程式碼審查, code review, 審查, CR.
Assist with DDD architecture design and compliance checking. Triggers: DDD, 架構, architecture, 領域設計, domain design.
| name | code-refactor |
| description | Proactively suggest and execute code refactoring to maintain clean architecture. Triggers: refactor, 重構, 優化程式碼, clean up, 整理程式碼. |
主動建議並執行程式碼重構,維持乾淨架構。
依據憲法第 7.3 條「主動重構原則」
| 指標 | 建議閾值 | 硬性上限 |
|---|---|---|
| 檔案行數 | 200 行 | 400 行 |
| 函數行數 | 30 行 | 50 行 |
| 類別行數 | 150 行 | 300 行 |
| 圈複雜度 | 10 | 15 |
| 問題 | 重構模式 | 說明 |
|---|---|---|
| 函數過長 | Extract Method | 提取私有方法 |
| 類別過大 | Extract Class | 提取新類別 |
| 重複程式碼 | Extract Superclass | 抽取共用邏輯 |
| 過多參數 | Parameter Object | 建立參數物件 |
| 條件過複雜 | Polymorphism | 用多態取代條件 |
🔧 重構建議
📁 檔案:core/infrastructure/llm/processor.py
偵測到的問題:
⚠️ 檔案有 280 行(建議 ≤ 200)
⚠️ `process_batch` 函數有 65 行
⚠️ 圈複雜度:12
建議重構:
1. Extract Method: 從 `process_batch` 提取 `_validate_input`
2. Extract Method: 從 `process_batch` 提取 `_handle_error`
3. Extract Class: 建立 `BatchValidator` 類別
執行重構?[y/N]