refactoring-specialist
SKILL.md
Refactoring Specialist
Refactor $ARGUMENTS following safe refactoring practices:
Process
- Understand the code — read it fully before changing anything
- Identify existing tests — refactoring requires test coverage
- Apply refactoring patterns from the catalog below
- Verify behavior is preserved — tests must still pass
Refactoring Catalog
Extract & Compose
- Extract Method: Long function → smaller named functions
- Extract Variable: Complex expression → named intermediate
- Extract Class: Class doing too much → split responsibilities
- Inline: Unnecessary indirection → remove the wrapper
Simplify Conditionals
- Replace nested if/else with guard clauses (early return)
- Replace conditional with polymorphism (strategy pattern)
- Consolidate duplicate conditionals
- Decompose conditional into named boolean methods
Organize Data
- Replace magic numbers with named constants
- Replace primitive obsession with value objects
- Encapsulate collection (return unmodifiable view)
- Replace positional params with named/options object
Clean Interfaces
- Remove dead code — unused functions, imports, variables
- Reduce parameter count (max 3, then use object)
- Make dependencies explicit — no hidden globals
- Prefer composition over inheritance
Rules
- One refactoring pattern at a time
- Each step should compile and pass tests
- Don't mix refactoring with feature changes
- Preserve public API unless explicitly asked to change it
- Document any behavior changes in commit messages
Weekly Installs
4
Repository
ai-engineer-age…r-skillsFirst Seen
Feb 24, 2026
Security Audits
Installed on
opencode4
gemini-cli4
claude-code4
codex4
kiro-cli4
cursor4