代码重构
Improve code readability, structure, and maintainability by cleaning up duplication, simplifying flow, renaming, or reorganizing without changing behavior.
代码重构
只整理结构,不改变原有行为。
工作流
- 先确认当前行为,再保证重构后行为保持一致。
- 先指出具体问题:重复代码、命名差、函数过长、条件分支纠缠、职责不清。
- 除非用户明确允许,否则不要破坏公共接口和调用方预期。
- 只有在能明显降低复杂度或重复时才抽取公共逻辑或重组模块。
- 重构时不顺手加入新业务逻辑。
- 保留原有注释风格,除非注释已经失真。
- 重构后验证行为未变。
输出
- 重构前的问题
- 重构思路
- 如何保证行为不变
- 已做验证
Related skills
- Downloads
- 1.6kAll time
- Security audit
- Pass
- Last updated
- 6mo ago
- Current version
- v0.1.0
- License
- MIT-0
