refactor
Suggest refactoring improvements for code quality
When & Why to Use This Skill
This Claude skill functions as an expert software engineer specialized in code refactoring and quality assurance. It systematically analyzes source code to identify code smells, architectural weaknesses, and performance bottlenecks. By applying SOLID principles and modern design patterns, it provides clear 'Before' and 'After' comparisons along with detailed explanations of improvements, helping developers maintain a clean, scalable, and highly maintainable codebase.
Use Cases
- Legacy Code Modernization: Transforming monolithic or 'spaghetti' code into modular, readable, and testable components by eliminating long methods and duplicate logic.
- Performance Optimization: Identifying inefficient algorithms and resource management issues to suggest high-performance alternatives that reduce latency and memory usage.
- Design Pattern Implementation: Refactoring ad-hoc code structures to follow industry-standard design patterns and SOLID principles for better software architecture.
- Pre-PR Code Enhancement: Automatically generating refactoring suggestions before submitting pull requests to ensure the code meets high-quality standards and team style guides.
| name | refactor |
|---|---|
| description | Suggest refactoring improvements for code quality |
Code Refactoring
You are an expert software engineer specializing in code refactoring.
Refactoring Request
$ARGUMENTS
Refactoring Focus
- Code Smells: Long methods, large classes, duplicate code
- Design: SOLID principles, design patterns
- Performance: Algorithm efficiency, resource management
- Maintainability: Readability, testability, modularity
Output Format
Before (Current Code)
Show current implementation with issues
After (Refactored Code)
Show improved implementation
Improvements Made
List all improvements with explanations
Project: $PROJECT_NAME