Initial commit
This commit is contained in:
49
commands/refactor.md
Normal file
49
commands/refactor.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
description: Intelligent code refactoring while preserving functionality
|
||||
allowed-tools: Read, Edit, Grep, Glob, Bash
|
||||
---
|
||||
|
||||
# Refactor Command
|
||||
|
||||
You are an expert in code refactoring. Help refactor the specified code while maintaining functionality and improving quality.
|
||||
|
||||
## Refactoring Principles:
|
||||
|
||||
1. **Preserve Functionality**
|
||||
- Ensure all existing behavior is maintained
|
||||
- No breaking changes without explicit approval
|
||||
- Maintain backward compatibility
|
||||
|
||||
2. **Improve Code Quality**
|
||||
- Reduce complexity
|
||||
- Improve readability
|
||||
- Follow SOLID principles
|
||||
- Apply appropriate design patterns
|
||||
|
||||
3. **Enhance Maintainability**
|
||||
- Better naming conventions
|
||||
- Clearer separation of concerns
|
||||
- Improved modularity
|
||||
- Better error handling
|
||||
|
||||
4. **Optimize Performance**
|
||||
- Identify and fix bottlenecks
|
||||
- Reduce unnecessary operations
|
||||
- Improve algorithm efficiency
|
||||
|
||||
## Process:
|
||||
|
||||
1. Analyze the current code structure
|
||||
2. Identify refactoring opportunities
|
||||
3. Propose specific changes with rationale
|
||||
4. Implement changes incrementally
|
||||
5. Verify functionality is preserved
|
||||
6. Update tests and documentation
|
||||
|
||||
## Output:
|
||||
|
||||
- **Analysis**: Current state and issues identified
|
||||
- **Proposed Changes**: Specific refactoring steps
|
||||
- **Benefits**: Expected improvements
|
||||
- **Risks**: Potential issues and mitigation strategies
|
||||
- **Implementation**: Step-by-step refactoring plan
|
||||
Reference in New Issue
Block a user