File contents 程式碼重構技能
主動偵測並執行程式碼重構,維持 DDD 架構和程式碼品質。
觸發:「重構」「refactor」「太長了」「模組化」「拆分」,或偵測到超過閾值時主動觸發。
閾值設定
類型
警告
強制重構
檔案
> 200 行
> 400 行
類別
> 150 行
> 300 行
函數
> 30 行
> 50 行
目錄檔案數
> 10
> 15
圈複雜度
> 10
> 15
巢狀深度
> 3 層
> 4 層
參數數量
> 4
> 6
依賴數量
> 5
> 8
重構模式庫
#
模式
觸發條件
1
Extract Method
函數過長、重複邏輯
2
Extract Class
類別職責過多、>150 行
3
Replace Conditional with Polymorphism
大量 if-elif-else
4
Introduce Parameter Object
參數 >4 個
5
Split Module
目錄 >10 檔案 → 按子領域拆分
DDD 架構守護
依賴方向:Presentation → Application → Domain ← Infrastructure
禁止:Domain 依賴 Infrastructure、Presentation 直接存取 Domain、Entity 包含持久化邏輯。
重構流程
偵測 :報告檔案/函數/複雜度超標情況
分析 :識別重複邏輯、隱藏 Value Object、職責分離點
規劃 :列出重構步驟(新檔案、遷移、測試)
執行 :逐步重構,每步確認測試通過
驗證 :全部測試通過、覆蓋率、複雜度、DDD 合規
與其他 Skills 整合
Skill
整合
code-reviewer
審查時觸發重構建議
test-generator
重構前先生成測試
ddd-architect
確保重構符合 DDD
memory-updater
記錄重構決策
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1 --- 2 name: u9401066-med-paper-assistant-code-refactor 3 description: 程式碼重構技能 4 --- 5 6 # 程式碼重構技能 7 8 主動偵測並執行程式碼重構,維持 DDD 架構和程式碼品質。 9 10 觸發:「重構」「refactor」「太長了」「模組化」「拆分」,或偵測到超過閾值時主動觸發。 11 12 --- 13 14 ## 閾值設定 15 16 | 類型 | 警告 | 強制重構 | 17 | ---------- | -------- | -------- | 18 | 檔案 | > 200 行 | > 400 行 | 19 | 類別 | > 150 行 | > 300 行 | 20 | 函數 | > 30 行 | > 50 行 | 21 | 目錄檔案數 | > 10 | > 15 | 22 | 圈複雜度 | > 10 | > 15 | 23 | 巢狀深度 | > 3 層 | > 4 層 | 24 | 參數數量 | > 4 | > 6 | 25 | 依賴數量 | > 5 | > 8 | 26 27 --- 28 29 ## 重構模式庫 30 31 | # | 模式 | 觸發條件 | 32 | --- | ------------------------------------- | ---------------------------- | 33 | 1 | Extract Method | 函數過長、重複邏輯 | 34 | 2 | Extract Class | 類別職責過多、>150 行 | 35 | 3 | Replace Conditional with Polymorphism | 大量 if-elif-else | 36 | 4 | Introduce Parameter Object | 參數 >4 個 | 37 | 5 | Split Module | 目錄 >10 檔案 → 按子領域拆分 | 38 39 --- 40 41 ## DDD 架構守護 42 43 依賴方向:`Presentation → Application → Domain ← Infrastructure` 44 45 禁止:Domain 依賴 Infrastructure、Presentation 直接存取 Domain、Entity 包含持久化邏輯。 46 47 --- 48 49 ## 重構流程 50 51 1. **偵測**:報告檔案/函數/複雜度超標情況 52 2. **分析**:識別重複邏輯、隱藏 Value Object、職責分離點 53 3. **規劃**:列出重構步驟(新檔案、遷移、測試) 54 4. **執行**:逐步重構,每步確認測試通過 55 5. **驗證**:全部測試通過、覆蓋率、複雜度、DDD 合規 56 57 --- 58 59 ## 與其他 Skills 整合 60 61 | Skill | 整合 | 62 | -------------- | ------------------ | 63 | code-reviewer | 審查時觸發重構建議 | 64 | test-generator | 重構前先生成測試 | 65 | ddd-architect | 確保重構符合 DDD | 66 | memory-updater | 記錄重構決策 | 67 68 --- 69 > Converted and distributed by [TomeVault](https://tomevault.io/claim/u9401066) — claim your Tome and manage your conversions. 70 <!-- tomevault:4.0:skill_md:2026-04-11 -->
tomevault-io/skills-registry/tree/main/u9401066--med-paper-assistant--code-refactor commit 527872c084
Frequently asked questions How do I install the U9401066 Med Paper Assistant Code Refactor skill? Run npx skillmds@latest add tomevault-io/u9401066-med-paper-assistant-code-refactor in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the U9401066 Med Paper Assistant Code Refactor skill do? 程式碼重構技能 It is listed under Coding & Dev Tools on SkillMD.
Is U9401066 Med Paper Assistant Code Refactor safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with U9401066 Med Paper Assistant Code Refactor? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is U9401066 Med Paper Assistant Code Refactor free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published U9401066 Med Paper Assistant Code Refactor? tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.