refactoring-specialist
40
总安装量
40
周安装量
#5220
全站排名
安装命令
npx skills add https://github.com/404kidwiz/claude-supercode-skills --skill refactoring-specialist
Agent 安装分布
opencode
30
claude-code
29
gemini-cli
26
cursor
23
antigravity
20
Skill 文档
Refactoring Specialist
Purpose
Provides expertise in systematically improving code quality and structure without altering external behavior. Specializes in applying design patterns, enforcing SOLID principles, and managing technical debt through incremental refactoring strategies.
When to Use
- Improving code readability and maintainability
- Reducing code duplication and complexity
- Applying design patterns to solve structural problems
- Breaking apart monolithic classes or functions
- Introducing proper abstraction layers
- Preparing codebase for new feature development
- Migrating legacy code to modern patterns
- Establishing anti-corruption layers between systems
Quick Start
Invoke this skill when:
- Improving code readability and maintainability
- Reducing code duplication and complexity
- Applying design patterns to solve structural problems
- Breaking apart monolithic classes or functions
- Introducing proper abstraction layers
Do NOT invoke when:
- Adding new features (refactor first, then add) â use appropriate domain skill
- Debugging runtime errors â use debugger
- Reviewing code for security issues â use security-auditor
- Optimizing performance bottlenecks â use performance-engineer
Decision Framework
Code Smell Detected?
âââ Duplication â Extract Method/Class, Template Method pattern
âââ Long Method â Extract Method, Decompose Conditional
âââ Large Class â Extract Class, Single Responsibility
âââ Feature Envy â Move Method to appropriate class
âââ Primitive Obsession â Introduce Value Objects
âââ Shotgun Surgery â Move related changes together
âââ Divergent Change â Split by responsibility
Core Workflows
1. Safe Refactoring Cycle
- Ensure comprehensive test coverage exists
- Identify specific code smell to address
- Apply smallest possible refactoring step
- Run tests to verify behavior unchanged
- Commit the change
- Repeat until smell eliminated
2. Pattern Introduction
- Identify recurring structural problem
- Select appropriate design pattern
- Create new structure alongside existing code
- Migrate consumers incrementally
- Remove old implementation
- Document pattern usage for team
3. Anti-Corruption Layer Implementation
- Identify boundary between systems/domains
- Define clean interface for internal domain
- Create adapter/translator layer
- Route all cross-boundary calls through ACL
- Evolve internal model independently
Best Practices
- Always refactor with tests as a safety net
- Make small, incremental changes with frequent commits
- Refactor before adding new features, not during
- Use IDE refactoring tools for mechanical transformations
- Document why patterns were applied, not just what
- Prioritize refactoring by business value and risk
Anti-Patterns
- Big Bang refactoring â Use incremental strangler pattern
- Refactoring without tests â Add characterization tests first
- Over-engineering â Apply patterns only when needed
- Refactoring during feature work â Separate refactoring commits
- Ignoring team conventions â Align with existing codebase style