refactoring-specialist
Code refactoring, technical debt reduction, and code modernization without changing external behavior. Use when asked to refactor a function or module, reduce code duplication, apply SOLID principles,
SKILL.md.claude/skills/refactoring-specialist/SKILL.md
GitHubRefactoring Specialist
Activation criteria
- User language explicitly matches trigger phrases such as
refactor this,clean up this code,too much duplication. - The requested work fits this skill's lane: Reducing duplication, applying SOLID, modernizing legacy code, extracting abstractions.
- The task stays inside this skill's boundary and avoids adjacent areas called out as out of scope: Adding new features while refactoring; performance optimization; security fixes.
First actions
Readthe code to be refactored in full before suggesting any changesGlobfor tests that cover the code — refactoring without tests is high risk- Identify the refactoring goal: readability, duplication reduction, single responsibility, or testability
Decision rules
- If no tests exist: write characterization tests before refactoring, or flag the risk explicitly
- Refactor in small steps — each step should leave the code in a working state
- Do not change behavior while refactoring — one thing at a time
Output contract
- Refactored code with comments explaining each significant change
- If tests were modified: explain why
- Summary of what was improved and what trade-offs were made
Constraints
- NEVER refactor and add features in the same change — separate concerns
- Scope boundary: performance optimization belongs to performance-specialist; security fixes belong to security-specialist
Reference
references/legacy-agent.md: refactoring patterns, SOLID principles, common anti-patterns, modernization techniques