Refactoring Assistant | 重構助手

SkillDev tools

[UDS] Guide refactoring decisions and strategy selection, including the refactor-versus-rewrite call. Use when: code has become hard to change, choosing between tactical and architectural refactoring, working safely inside legacy code. Not for: moving to a different framework or major version — use /migrate; clearing debug artifacts and dead code — use /sweep. Keywords: refactor, rewrite, strangler, legacy code, technical debt, code smell, 重構, 重寫, 技術債.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Refactoring Assistant | 重構助手 skill

What this skill tells your AI

The instructions your AI receives, as published by asiaostrich/universal-dev-standards in skills/refactoring-assistant/SKILL.md and read by ahel’s review.

Guide refactoring decisions, recommend strategies, and provide step-by-step execution workflows.

引導重構決策、推薦策略,並提供逐步執行工作流程。

Usage | 使用方式

CommandPurpose用途
/refactorStart interactive refactoring guide啟動互動式重構引導
/refactor decideRun refactor vs. rewrite decision tree執行重構 vs 重寫決策樹
/refactor tacticalSuggest tactical (daily) strategies建議戰術性(日常)策略
/refactor strategicGuide strategic/architectural refactoring引導戰略性/架構重構
/refactor legacyLegacy code safety strategies遺留程式碼安全策略
/refactor debtTechnical debt assessment技術債評估

Strategy Quick Reference | 策略快速參考

Tactical Strategies (Daily) | 戰術性策略

StrategyWhen to Use使用時機
Preparatory RefactoringBefore adding a blocked feature新增被阻擋的功能之前
Boy Scout RuleDuring any maintenance work任何維護工作中
Red-Green-RefactorTDD development cycleTDD 開發循環

Strategic Strategies (Architectural) | 戰略性策略

StrategyWhen to Use使用時機
Strangler FigReplacing entire system gradually逐步替換整個系統
Anti-Corruption LayerIntegrating with legacy system與遺留系統整合
Branch by AbstractionShared code refactoring on trunk在主幹上重構共享程式碼

Safety Strategies (Legacy) | 安全防護策略

StrategyWhen to Use使用時機
Characterization TestsBefore any legacy refactoring任何遺留程式碼重構之前
Scratch RefactoringUnderstanding black-box code理解黑盒程式碼
Finding SeamsInjecting test doubles into legacy在遺留程式碼中注入測試替身

Workflow | 工作流程

  1. Assess - Identify code to refactor, evaluate test coverage
  2. Decide - Run decision tree (refactor vs. rewrite) if needed
  3. Select strategy - Choose appropriate strategy based on scope and risk
  4. Execute - Follow step-by-step workflow with safety checks
  5. Verify - Run tests to confirm behavior is preserved

Usage Examples | 使用範例

User: /refactor src/legacy-auth/
AI: Analyzing src/legacy-auth/...
    Test coverage: 23% — recommending safety-first approach.
    Suggested strategy: Characterization Tests + Preparatory Refactoring
User: /refactor decide
AI: Let me help you decide whether to refactor or rewrite.
    Question 1: Is the code currently working in production? [Y/N]

Next Steps Guidance | 下一步引導

After /refactor completes, the AI assistant should suggest:

重構完成。建議下一步 / Refactoring complete. Suggested next steps:

  • 執行 /checkin 通過品質關卡 ⭐ Recommended / 推薦 — Pass quality gates
  • 執行 /coverage 確認重構後覆蓋率不下降 — Verify coverage not decreased
  • 執行 /commit 提交重構變更 — Commit the refactoring changes

Reference | 參考

AI Agent Behavior | AI 代理行為

完整的 AI 行為定義請參閱對應的命令文件:/refactor

For complete AI agent behavior definition, see the corresponding command file: /refactor

Signals

GitHub stars
73
Forks
13
Last commit
Sep 2026
Hacker News mentions
20
Advanced
Catalog kind
skill
Gateway key
refactor-asiaostrich
Source
github.com/asiaostrich/universal-dev-standards