refactoring-patterns
强调小步变更与测试验证,适合清理技术债务。
按命名重构模式逐步改进代码结构并保持行为不变。
按命名的重构模式逐步改进代码结构,每次变更都保证行为不变并以测试作为安全网。适合清理技术债、准备大改造或把凌乱代码拆成易维护模块时使用,能根据具体 code smell 推荐合适的变换序列。特点是把重构分解成小步、配套验证步骤,降低风险并保持可回溯性。
▸ 展开 SKILL.md 英文原文
Apply named refactoring transformations to improve code structure without changing behavior. Use when the user mentions "refactor this", "code smells", "extract method", "replace conditional", "technical debt", "move method", "inline variable", "decompose conditional", or "clean up this messy code". Also trigger when cleaning up legacy code, preparing code for new features by restructuring, or identifying which transformation fits a specific code smell. Covers smell-driven refactoring, safe transformation sequences, and testing guards. For code-quality foundations, see clean-code. For managing complexity, see software-design-philosophy.
帮我安装这个 skill:https://raw.githubusercontent.com/wondelai/skills/main/refactoring-patterns/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/wondelai/skills/main/refactoring-patterns/SKILL.md"# Refactoring Patterns Framework A disciplined approach to improving the internal structure of existing code without changing its observable behavior. Every refactoring follows the same loop: verify tests pass, apply one small structural change, verify tests still pass. ## Core Principle **Refactoring is not rewriting. It is a sequence of small, behavior-preserving transformations, each backed by tests.** You never change what the code does — only how it is organized. Big-bang rewrites fail because they combine structural change with behavioral change, making it impossible to know which broke things. **The foundation:** Bad code is a natural consequence of delivering under time pressure,