什么是 refactor?
外科手术式代码重构可在不改变行为的情况下提高可维护性。涵盖提取函数、重命名变量、分解上帝函数、提高类型安全性、消除代码异味以及应用设计模式。比 repo-rebuilder 不那么剧烈;用于逐步改进。 来源:ansteorra/kmp。
外科手术式代码重构可在不改变行为的情况下提高可维护性。涵盖提取函数、重命名变量、分解上帝函数、提高类型安全性、消除代码异味以及应用设计模式。比 repo-rebuilder 不那么剧烈;用于逐步改进。
通过命令行快速安装 refactor AI 技能到你的开发环境
来源:ansteorra/kmp。
Improve code structure and readability without changing external behavior. Refactoring is gradual evolution, not revolution. Use this for improving existing code, not rewriting from scratch.
| Extract Method | Turn code fragment into method | | Extract Class | Move behavior to new class | | Extract Interface | Create interface from implementation | | Inline Method | Move method body back to caller | | Inline Class | Move class behavior to caller | | Pull Up Method | Move method to superclass | | Push Down Method | Move method to subclass |
| Rename Method/Variable | Improve clarity | | Introduce Parameter Object | Group related parameters | | Replace Conditional with Polymorphism | Use polymorphism instead of switch/if | | Replace Magic Number with Constant | Named constants | | Decompose Conditional | Break complex conditions | | Consolidate Conditional | Combine duplicate conditions |
为搜索与 AI 引用准备的稳定字段与命令。
npx skills add https://github.com/ansteorra/kmp --skill refactor外科手术式代码重构可在不改变行为的情况下提高可维护性。涵盖提取函数、重命名变量、分解上帝函数、提高类型安全性、消除代码异味以及应用设计模式。比 repo-rebuilder 不那么剧烈;用于逐步改进。 来源:ansteorra/kmp。
打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/ansteorra/kmp --skill refactor 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用
https://github.com/ansteorra/kmp