用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/AsiaOstrich/universal-dev-standards --skill refactor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
[UDS] 以 Claude 原生 Agent tool 编排多任务执行计划(DAG-based,无外部引擎)。 Use when: executing a plan.json file with parallel/sequential task dependencies. Keywords: orchestrate, plan, execute, DAG, task plan, 编排, 执行计划, 并行.
[UDS] 从 Spec 文档、OpenSpec 变更或自由文本需求生成 plan.json。 Use when: converting specifications into executable task plans for /orchestrate. Keywords: plan, spec, task plan, 计划, 规格, 任务, plan.json, DAG.
[UDS] AI 辅助 git push 安全层:质量门禁 + 协作护栏。 Use when: pushing commits, force pushing, pushing to protected branches, pushing feature branches. Keywords: git push, force push, protected branch, quality gate, push receipt, PR automation, 推送, 保护分支, 质量门禁.
基于 SOC 职业分类
正在显示 SKILL.md
| name | refactor |
| scope | universal |
| description | [UDS] Guide refactoring decisions and strategy selection |
| allowed-tools | Read, Write, Grep, Glob, Bash(npm test:*), Bash(npx:*) |
| argument-hint | [file or module | 檔案或模組] |
Guide refactoring decisions, recommend strategies, and provide step-by-step execution workflows.
引導重構決策、推薦策略,並提供逐步執行工作流程。
| Command | Purpose | 用途 |
|---|---|---|
/refactor | Start interactive refactoring guide | 啟動互動式重構引導 |
/refactor decide | Run refactor vs. rewrite decision tree | 執行重構 vs 重寫決策樹 |
/refactor tactical | Suggest tactical (daily) strategies | 建議戰術性(日常)策略 |
/refactor strategic | Guide strategic/architectural refactoring | 引導戰略性/架構重構 |
/refactor legacy | Legacy code safety strategies | 遺留程式碼安全策略 |
/refactor debt | Technical debt assessment | 技術債評估 |
| Strategy | When to Use | 使用時機 |
|---|---|---|
| Preparatory Refactoring | Before adding a blocked feature | 新增被阻擋的功能之前 |
| Boy Scout Rule | During any maintenance work | 任何維護工作中 |
| Red-Green-Refactor | TDD development cycle | TDD 開發循環 |
| Strategy | When to Use | 使用時機 |
|---|---|---|
| Strangler Fig | Replacing entire system gradually | 逐步替換整個系統 |
| Anti-Corruption Layer | Integrating with legacy system | 與遺留系統整合 |
| Branch by Abstraction | Shared code refactoring on trunk | 在主幹上重構共享程式碼 |
| Strategy | When to Use | 使用時機 |
|---|---|---|
| Characterization Tests | Before any legacy refactoring | 任何遺留程式碼重構之前 |
| Scratch Refactoring | Understanding black-box code | 理解黑盒程式碼 |
| Finding Seams | Injecting test doubles into legacy | 在遺留程式碼中注入測試替身 |
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]
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
完整的 AI 行為定義請參閱對應的命令文件:
/refactorFor complete AI agent behavior definition, see the corresponding command file:
/refactor