Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:52:48 +08:00
commit b3f6bea5c2
30 changed files with 2440 additions and 0 deletions

72
commands/audit.md Normal file
View File

@@ -0,0 +1,72 @@
---
description: Perform comprehensive system audit and compliance check
argument-hint: [audit-type] [compliance-framework]
---
# System Audit Command
Perform comprehensive system audit and compliance check with detailed reporting and recommendations.
## Context
- Audit type: $1 (security|compliance|performance|all - default: all)
- Compliance framework: $2 (GDPR|HIPAA|SOC2|ISO27001|PCI-DSS - default: SOC2)
- System configuration: @config/
- Security policies: @security-policies/
## Audit Process
### 1. **Security Audit**
- Vulnerability assessment and penetration testing
- Access control and authentication review
- Data protection and encryption validation
- Network security and firewall configuration
- Incident response and monitoring capabilities
### 2. **Compliance Assessment**
- Regulatory compliance validation
- Policy adherence verification
- Documentation and evidence collection
- Gap analysis and remediation planning
- Risk assessment and mitigation strategies
### 3. **Performance Audit**
- System performance and scalability analysis
- Resource utilization and efficiency review
- Capacity planning and optimization opportunities
- Monitoring and alerting effectiveness
- Disaster recovery and business continuity
### 4. **Operational Audit**
- Process documentation and standardization
- Change management and version control
- Backup and recovery procedures
- Training and knowledge management
- Vendor and third-party risk assessment
## Compliance Frameworks
- **GDPR**: Data privacy and protection compliance
- **HIPAA**: Healthcare data security requirements
- **SOC 2**: Security, availability, and confidentiality
- **ISO 27001**: Information security management
- **PCI DSS**: Payment card industry security standards
## Expected Outcome
- Comprehensive audit report with findings
- Compliance status and gap analysis
- Risk assessment and prioritization
- Remediation roadmap and timeline
- Evidence documentation and artifacts
## Audit Findings
- **Critical**: Immediate action required
- **High**: Address within 30 days
- **Medium**: Address within 90 days
- **Low**: Address within 6 months
- **Informational**: Best practice recommendations
## Remediation Plan
- Immediate fixes for critical findings
- Short-term remediation (30 days)
- Medium-term improvements (90 days)
- Long-term strategic initiatives (6+ months)
- Ongoing monitoring and maintenance

66
commands/code-review.md Normal file
View File

@@ -0,0 +1,66 @@
---
description: Perform comprehensive code review with quality and security analysis
argument-hint: [review-type] [focus-area]
---
# Code Review Command
Perform comprehensive code review with quality, security, and best practices analysis.
## Context
- Review type: $1 (security|performance|quality|all - default: all)
- Focus area: $2 (specific module or component)
- Recent changes: !`git diff HEAD~1`
- Code metrics: !`find . -name "*.js" -o -name "*.ts" -o -name "*.py" | wc -l`
## Code Review Process
### 1. **Code Quality Analysis**
- Code structure and organization
- Design patterns and best practices
- Code readability and maintainability
- Documentation and comments quality
### 2. **Security Review**
- Vulnerability assessment
- Input validation and sanitization
- Authentication and authorization
- Data protection and privacy
### 3. **Performance Analysis**
- Algorithm efficiency
- Resource utilization
- Database query optimization
- Caching strategies
### 4. **Best Practices Validation**
- Coding standards compliance
- Error handling patterns
- Testing coverage and quality
- Version control practices
## Review Criteria
- **Security**: OWASP guidelines, secure coding practices
- **Performance**: Efficiency, scalability, resource usage
- **Quality**: Maintainability, readability, documentation
- **Standards**: Team coding standards, industry best practices
## Expected Outcome
- Comprehensive code review report
- Prioritized improvement recommendations
- Security vulnerability assessment
- Performance optimization suggestions
## Review Feedback
- **Critical Issues**: Immediate attention required
- **High Priority**: Should be addressed before merge
- **Medium Priority**: Address in next iteration
- **Low Priority**: Future improvement opportunities
## Approval Criteria
Code approved when:
- No critical security vulnerabilities
- Performance benchmarks met
- Code quality standards satisfied
- All tests passing
- Documentation complete

54
commands/deploy.md Normal file
View File

@@ -0,0 +1,54 @@
---
description: Deploy application with comprehensive checks and validation
argument-hint: [environment] [service-name]
---
# Deployment Command
Deploy the application to the specified environment with comprehensive validation.
## Context
- Environment: $1 (default: production)
- Service: $2 (default: current service)
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -5`
- Build status: !`git status --porcelain`
## Deployment Process
1. **Pre-deployment Checks**
- Validate environment configuration
- Check service dependencies
- Verify security requirements
- Confirm deployment permissions
2. **Build and Test**
- Run automated tests
- Perform security scans
- Validate configuration
- Build deployment artifacts
3. **Deployment Execution**
- Deploy to target environment
- Verify service health
- Run smoke tests
- Monitor deployment metrics
4. **Post-deployment Validation**
- Health check validation
- Performance monitoring
- Error log analysis
- User acceptance testing
## Expected Outcome
- Successful deployment to $1 environment
- All health checks passing
- Performance metrics within acceptable ranges
- Zero critical errors in logs
## Rollback Plan
If deployment fails:
- Automatic rollback to previous version
- Restore database state if needed
- Notify stakeholders of issues
- Document failure reasons for analysis

64
commands/logs.md Normal file
View File

@@ -0,0 +1,64 @@
---
description: Analyze enterprise system logs for troubleshooting and monitoring
argument-hint: [service] [level] [timeframe]
---
# Enterprise Log Analysis
Analyze system logs for troubleshooting, monitoring, and security analysis.
## Context
- Recent system logs: !`journalctl --no-pager -n 100 --since "1 hour ago"`
- Application logs: !`tail -n 50 /var/log/application.log 2>/dev/null || echo "Application logs not found"`
- Error logs: !`grep -i error /var/log/syslog 2>/dev/null | tail -20 || echo "No recent errors found"`
- Security logs: !`grep -i "failed\|denied\|unauthorized" /var/log/auth.log 2>/dev/null | tail -10 || echo "No security events found"`
- Web server logs: !`tail -n 20 /var/log/nginx/access.log 2>/dev/null || tail -n 20 /var/log/apache2/access.log 2>/dev/null || echo "Web server logs not found"`
## Your task
Based on the log information above, provide a comprehensive log analysis including:
1. **Log Summary**
- Total log entries analyzed
- Log levels distribution (ERROR, WARN, INFO, DEBUG)
- Time range covered
- Key patterns and trends
2. **Error Analysis**
- Critical errors requiring immediate attention
- Warning patterns and trends
- Error frequency and impact assessment
- Root cause analysis for recurring issues
3. **Security Analysis**
- Failed authentication attempts
- Unauthorized access attempts
- Suspicious activity patterns
- Security event correlation
4. **Performance Analysis**
- Response time patterns
- Resource usage spikes
- Performance bottlenecks
- Capacity planning insights
5. **Recommendations**
- Immediate actions for critical issues
- Log monitoring improvements
- Alert configuration suggestions
- Troubleshooting guidance
## Arguments
- `service`: Specific service logs to analyze (optional)
- `level`: Log level filter (error, warn, info, debug, optional)
- `timeframe`: Time range for analysis (1h, 6h, 24h, 7d, optional)
## Usage Examples
```
/logs
/logs database error
/logs api warn 24h
/logs security 7d
```
Focus on enterprise-grade log analysis with actionable insights for system reliability, security, and performance optimization.

68
commands/monitor.md Normal file
View File

@@ -0,0 +1,68 @@
---
description: Monitor system health and performance metrics
argument-hint: [monitor-type] [time-range]
---
# System Monitoring Command
Monitor system health, performance metrics, and operational status with comprehensive analysis.
## Context
- Monitor type: $1 (health|performance|errors|all - default: all)
- Time range: $2 (1h|6h|24h|7d - default: 24h)
- System status: !`ps aux | head -10`
- Disk usage: !`df -h`
- Memory usage: !`free -h`
## Monitoring Analysis
### 1. **System Health Check**
- Service status and availability
- Resource utilization (CPU, memory, disk)
- Network connectivity and latency
- Database connection and performance
### 2. **Performance Metrics**
- Response times and throughput
- Error rates and success rates
- Queue depths and processing times
- Cache hit rates and efficiency
### 3. **Error Analysis**
- Error frequency and patterns
- Critical error identification
- Performance degradation detection
- Anomaly detection and alerting
### 4. **Operational Status**
- Deployment status and version
- Configuration validation
- Security posture assessment
- Compliance status check
## Monitoring Thresholds
- **CPU Usage**: < 80%
- **Memory Usage**: < 85%
- **Disk Usage**: < 90%
- **Response Time**: < 500ms (p95)
- **Error Rate**: < 1%
## Expected Outcome
- Comprehensive system health report
- Performance metrics and trends
- Error analysis and recommendations
- Operational status summary
## Alert Conditions
Immediate attention required for:
- Critical service failures
- Performance degradation > 50%
- Security incidents or breaches
- Resource exhaustion warnings
## Recommendations
Based on monitoring data:
- Performance optimization opportunities
- Capacity planning suggestions
- Infrastructure scaling recommendations
- Preventive maintenance actions

68
commands/optimize.md Normal file
View File

@@ -0,0 +1,68 @@
---
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)

View File

@@ -0,0 +1,65 @@
---
description: Execute performance testing and optimization analysis
argument-hint: [test-scenario] [load-level]
---
# Performance Testing Command
Execute comprehensive performance testing and optimization analysis with detailed metrics.
## Context
- Test scenario: $1 (load|stress|spike|endurance - default: load)
- Load level: $2 (light|medium|heavy|extreme - default: medium)
- Application endpoints: @src/routes
- Performance baseline: @performance-baseline.json
## Performance Testing Strategy
### 1. **Load Testing**
- Simulate normal user traffic
- Measure response times and throughput
- Validate system stability
- Identify performance bottlenecks
### 2. **Stress Testing**
- Push system beyond normal capacity
- Identify breaking points
- Test system recovery
- Validate error handling
### 3. **Performance Analysis**
- Response time analysis
- Throughput measurement
- Resource utilization monitoring
- Database performance assessment
### 4. **Optimization Recommendations**
- Performance bottleneck identification
- Scalability improvement suggestions
- Resource optimization strategies
- Caching implementation guidance
## Performance Metrics
- Response time (p50, p95, p99)
- Throughput (requests per second)
- Error rate and availability
- Resource utilization (CPU, memory, disk)
## Expected Outcome
- Detailed performance test report
- Performance metrics and benchmarks
- Bottleneck identification and analysis
- Actionable optimization recommendations
## Performance Thresholds
- Response time: < 200ms (p95)
- Throughput: > 1000 RPS
- Error rate: < 0.1%
- Availability: > 99.9%
## Failure Analysis
If performance targets not met:
- Root cause analysis
- Performance optimization plan
- Infrastructure scaling recommendations
- Code optimization suggestions

59
commands/security-scan.md Normal file
View File

@@ -0,0 +1,59 @@
---
description: Perform comprehensive security scan and vulnerability assessment
argument-hint: [scan-type] [severity-level]
---
# Security Scan Command
Perform comprehensive security scan and vulnerability assessment with detailed reporting.
## Context
- Scan type: $1 (dependencies|code|infrastructure|all - default: all)
- Severity level: $2 (low|medium|high|critical - default: medium)
- Current dependencies: @package.json
- Security configuration: @.securityrc
## Security Scan Process
### 1. **Dependency Scanning**
- Check for known vulnerabilities
- Validate license compliance
- Identify outdated packages
- Assess supply chain risks
### 2. **Code Analysis**
- Static Application Security Testing (SAST)
- Secret detection and credential scanning
- Code quality and security patterns
- OWASP Top 10 compliance check
### 3. **Infrastructure Security**
- Configuration security validation
- Network security assessment
- Access control verification
- Compliance framework validation
### 4. **Security Reporting**
- Vulnerability assessment report
- Risk prioritization and scoring
- Remediation recommendations
- Compliance status summary
## Security Standards
- OWASP Top 10 compliance
- Industry security best practices
- Regulatory compliance (GDPR, HIPAA, SOC 2)
- Internal security policies
## Expected Outcome
- Comprehensive security assessment report
- Prioritized vulnerability list
- Detailed remediation guidance
- Compliance status validation
## Critical Issues
If critical vulnerabilities found:
- Immediate notification to security team
- Emergency remediation plan
- Deployment halt recommendations
- Incident response procedures

56
commands/status.md Normal file
View File

@@ -0,0 +1,56 @@
---
description: Check enterprise system status and health metrics
argument-hint: [service] [environment]
---
# Enterprise System Status Check
Check the current status and health metrics of enterprise systems and services.
## Context
- Current system status: !`systemctl status --no-pager`
- Service health: !`curl -s http://localhost:8080/health || echo "Health endpoint not available"`
- Resource usage: !`top -bn1 | head -20`
- Disk usage: !`df -h`
- Memory usage: !`free -h`
- Network connectivity: !`ping -c 3 8.8.8.8 || echo "Network connectivity issues"`
## Your task
Based on the system status information above, provide a comprehensive status report including:
1. **System Health Overview**
- Overall system status (healthy/warning/critical)
- Key performance indicators
- Resource utilization summary
2. **Service Status**
- Critical services status
- Application health endpoints
- Database connectivity
- External service dependencies
3. **Performance Metrics**
- CPU, memory, and disk usage
- Network connectivity and latency
- Application response times
- Error rates and availability
4. **Recommendations**
- Immediate actions if issues detected
- Performance optimization suggestions
- Capacity planning recommendations
- Monitoring improvements
## Arguments
- `service`: Specific service to check (optional)
- `environment`: Environment to check (dev/staging/prod, optional)
## Usage Examples
```
/status
/status database
/status api prod
```
Focus on enterprise-grade monitoring and provide actionable insights for system reliability and performance.

59
commands/test.md Normal file
View File

@@ -0,0 +1,59 @@
---
description: Run comprehensive test suite with detailed reporting
argument-hint: [test-type] [coverage-threshold]
---
# Test Execution Command
Execute comprehensive test suite with detailed reporting and coverage analysis.
## Context
- Test type: $1 (unit|integration|e2e|all - default: all)
- Coverage threshold: $2 (default: 80%)
- Current test files: !`find . -name "*test*" -o -name "*spec*" | head -10`
- Test configuration: @package.json
## Test Execution Strategy
### 1. **Unit Tests**
- Run isolated component tests
- Validate business logic
- Check error handling
- Measure code coverage
### 2. **Integration Tests**
- Test component interactions
- Validate API endpoints
- Check database operations
- Test external service integrations
### 3. **End-to-End Tests**
- Full user workflow testing
- Cross-browser compatibility
- Performance validation
- Accessibility compliance
### 4. **Test Reporting**
- Generate detailed test reports
- Coverage analysis and visualization
- Performance metrics
- Failure analysis and recommendations
## Quality Gates
- All tests must pass
- Coverage must meet $2% threshold
- No critical security vulnerabilities
- Performance benchmarks within limits
## Expected Outcome
- Complete test execution report
- Coverage analysis with recommendations
- Performance metrics and benchmarks
- Actionable feedback for improvements
## Failure Handling
If tests fail:
- Detailed failure analysis
- Root cause identification
- Suggested fixes and improvements
- Priority-based remediation plan