50 lines
1.7 KiB
Markdown
50 lines
1.7 KiB
Markdown
# Refactor Code for Quality
|
|
|
|
Refactor the following code for better quality: $ARGUMENTS
|
|
|
|
## Refactoring Framework:
|
|
1. **Code Analysis**: Identify code smells, duplication, and complexity
|
|
2. **Design Review**: Evaluate architecture and design patterns
|
|
3. **Implementation**: Apply refactoring techniques
|
|
4. **Testing**: Ensure refactored code maintains functionality
|
|
5. **Documentation**: Update documentation to reflect changes
|
|
|
|
## Refactoring Standards:
|
|
- **SOLID Principles**: Apply Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion
|
|
- **DRY Principle**: Eliminate duplication
|
|
- **KISS Principle**: Keep it simple and straightforward
|
|
- **YAGNI Principle**: Don't implement unnecessary features
|
|
- **Code Readability**: Improve code clarity and maintainability
|
|
|
|
## Language-Specific Guidelines:
|
|
|
|
### Go Refactoring
|
|
- Simplify complex functions and reduce cyclomatic complexity
|
|
- Improve error handling patterns
|
|
- Optimize struct and interface design
|
|
- Enhance concurrency patterns
|
|
|
|
### Solidity Refactoring
|
|
- Optimize gas consumption
|
|
- Improve contract upgradeability
|
|
- Enhance security patterns
|
|
- Simplify complex contract interactions
|
|
|
|
### JavaScript/TypeScript Refactoring
|
|
- Apply Vue 3 Composition API patterns
|
|
- Improve component organization
|
|
- Optimize state management with Pinia
|
|
- Enhance web3 integration patterns
|
|
|
|
## Testing Requirements:
|
|
- Maintain existing test coverage
|
|
- Add tests for newly introduced patterns
|
|
- Verify no functionality regression
|
|
- Update benchmarks if performance is affected
|
|
|
|
## Deliverables:
|
|
- Refactored code with improved quality
|
|
- Updated tests
|
|
- Performance comparison (if applicable)
|
|
- Documentation updates
|
|
- Refactoring rationale and benefits |