69 lines
2.2 KiB
Markdown
69 lines
2.2 KiB
Markdown
---
|
|
description: Analyze and optimize code performance, security, and quality
|
|
argument-hint: [optimization-type] [target-area]
|
|
---
|
|
|
|
# Code Optimization Command
|
|
|
|
Analyze and optimize code for performance, security, and quality with actionable recommendations.
|
|
|
|
## Context
|
|
- Optimization type: $1 (performance|security|quality|all - default: all)
|
|
- Target area: $2 (specific file, module, or component)
|
|
- Code complexity: !`find . -name "*.js" -o -name "*.ts" -o -name "*.py" | xargs wc -l | tail -1`
|
|
- Dependencies: @package.json
|
|
|
|
## Optimization Analysis
|
|
|
|
### 1. **Performance Optimization**
|
|
- Algorithm efficiency analysis
|
|
- Database query optimization
|
|
- Memory usage optimization
|
|
- Caching strategy implementation
|
|
- Bundle size and loading optimization
|
|
|
|
### 2. **Security Hardening**
|
|
- Vulnerability assessment and remediation
|
|
- Input validation and sanitization
|
|
- Authentication and authorization review
|
|
- Data protection and encryption
|
|
- Security headers and policies
|
|
|
|
### 3. **Code Quality Improvement**
|
|
- Code structure and organization
|
|
- Design pattern implementation
|
|
- Error handling and logging
|
|
- Documentation and comments
|
|
- Testing coverage and quality
|
|
|
|
### 4. **Best Practices Implementation**
|
|
- Coding standards compliance
|
|
- Dependency management
|
|
- Version control practices
|
|
- CI/CD pipeline optimization
|
|
- Monitoring and observability
|
|
|
|
## Optimization Metrics
|
|
- **Performance**: Response time, throughput, resource usage
|
|
- **Security**: Vulnerability count, compliance score
|
|
- **Quality**: Code complexity, maintainability index
|
|
- **Best Practices**: Standards compliance, test coverage
|
|
|
|
## Expected Outcome
|
|
- Comprehensive optimization report
|
|
- Prioritized improvement recommendations
|
|
- Performance impact analysis
|
|
- Implementation roadmap
|
|
|
|
## Optimization Priorities
|
|
1. **Critical**: Security vulnerabilities, performance bottlenecks
|
|
2. **High**: Code quality issues, maintainability problems
|
|
3. **Medium**: Best practice improvements, optimization opportunities
|
|
4. **Low**: Future enhancements, nice-to-have improvements
|
|
|
|
## Implementation Plan
|
|
- Immediate fixes for critical issues
|
|
- Short-term improvements (1-2 weeks)
|
|
- Medium-term optimizations (1-2 months)
|
|
- Long-term architectural improvements (3-6 months)
|