refactor-to-pattern
Refactor to Pattern
Refactoring workflow: verify test coverage, analyze with DRY + SOLID principles, design decomposition and relationships, discover patterns from symptoms, write a chunked spec for user review, and execute with regression safety.
When to Use
Invoke this skill when:
- Refactoring existing code for better structure
- An initial implementation is complete and needs architectural review
- Code smells suggest SRP violations, excessive coupling, or missing abstractions
If you are still implementing new functionality, finish the implementation first. Make it work, make it pass tests, then invoke this skill.
Stance on Project Conventions
Refactoring tears down old structure and builds better structure. The project's existing documentation — agent-memory files such as AGENTS.md and CLAUDE.md, README.md, style guides, architectural decision records — describes what the code is today, not what it should become. Treat these documents as reference material, not as binding constraints.
During this workflow: