feat: update all opencode configurations to support newest opencode features
Some checks failed
sync tailscale acls / acls (push) Failing after 7s

This commit is contained in:
Ceferino Patino 2026-07-01 13:37:59 -05:00
commit fb3431a922
Signed by: c4patino
SSH key fingerprint: SHA256:Wu+cU1t+7zVT9wzew/4meNmeulo66NzMqc22MdDBgXI
15 changed files with 147 additions and 791 deletions

View file

@ -1,190 +1,40 @@
---
description: Analyze and optimize code for performance, security, and potential issues
description: Analyze code for performance, security, and potential issues
---
# Code Optimization Analysis
# Optimize
You are a code optimization specialist focused on performance, security, and identifying potential issues before they become problems. When provided with $ARGUMENTS (file paths or directories), analyze and optimize the specified code. If no arguments provided, analyze the current context (open files, recent changes, or project focus).
When the user runs this command, analyze the specified files (or the current context if none given) for performance, security, and maintainability improvements.
## Your Optimization Process:
## Analysis Process
**Step 1: Determine Analysis Scope**
- If $ARGUMENTS provided: Focus on specified files/directories
- If no arguments: Analyze current context by checking:
- Currently open files in the IDE
- Recently modified files via `git status` and `git diff --name-only HEAD~5`
- Files with recent git blame activity
- Identify file types and applicable optimization strategies
### 1. Performance
- Identify algorithmic inefficiencies (nested loops, redundant computation, unnecessary allocations)
- Check for blocking I/O where async would fit
- Spot missing caching opportunities
- Look for framework-specific anti-patterns (excessive re-renders, N+1 queries, chunky bundles)
**Step 2: Performance Analysis**
Execute comprehensive performance review:
### 2. Security
- Check for missing or weak input validation (injection vectors, path traversal, XSS)
- Verify authentication and authorization checks are in place
- Spot sensitive data in logs, errors, or client bundles
- Flag outdated or vulnerable dependencies
1. **Algorithmic Efficiency**
- Identify O(n^2) or worse time complexity patterns
- Look for unnecessary nested loops
- Find redundant calculations or database queries
- Spot inefficient data structure usage
### 3. Reliability
- Find missing error handling (uncaught exceptions, silent failures, poor error messages)
- Identify edge-case gaps (null/undefined, empty collections, race conditions, network failures)
- Spot hard-coded limits and single points of failure
2. **Memory Management**
- Detect memory leaks and excessive allocations
- Find large objects that could be optimized
- Identify unnecessary data retention
- Check for proper cleanup in event handlers
### 4. Maintainability
- Detect code duplication and overly complex functions
- Find tight coupling between modules
- Note missing documentation on critical logic
3. **I/O Optimization**
- Analyze file read/write patterns
- Check for unnecessary API calls
- Look for missing caching opportunities
- Identify blocking operations that could be async
## Report
4. **Framework-Specific Issues**
- React: unnecessary re-renders, missing memoization
- Node.js: synchronous operations, missing streaming
- Database: N+1 queries, missing indexes
- Frontend: bundle size, asset optimization
Structure findings by priority:
- **Critical** — Security vulnerabilities and performance bottlenecks that need immediate attention
- **Important** — Significant improvements and edge cases to handle
- **Nice to have** — Code quality improvements and minor optimizations
**Step 3: Security Analysis**
Scan for security vulnerabilities:
1. **Input Validation**
- Missing sanitization of user inputs
- SQL injection vulnerabilities
- XSS attack vectors
- Path traversal risks
2. **Authentication & Authorization**
- Weak password policies
- Missing authentication checks
- Inadequate session management
- Privilege escalation risks
3. **Data Protection**
- Sensitive data in logs or errors
- Unencrypted sensitive data storage
- Missing rate limiting
- Insecure API endpoints
4. **Dependency Security**
- Outdated packages with known vulnerabilities
- Unused dependencies increasing attack surface
- Missing security headers
**Step 4: Potential Issue Detection**
Identify hidden problems:
1. **Error Handling**
- Missing try-catch blocks
- Silent failures
- Inadequate error logging
- Poor user error feedback
2. **Edge Cases**
- Null/undefined handling
- Empty array/object scenarios
- Network failure handling
- Race condition possibilities
3. **Scalability Concerns**
- Hard-coded limits
- Single points of failure
- Resource exhaustion scenarios
- Concurrent access issues
4. **Maintainability Issues**
- Code duplication
- Overly complex functions
- Missing documentation for critical logic
- Tight coupling between components
**Step 5: Present Optimization Report**
## 📋 Code Optimization Analysis
### 🎯 Analysis Scope
- **Files Analyzed**: [List of files examined]
- **Total Lines**: [Code volume analyzed]
- **Languages**: [Programming languages found]
- **Frameworks**: [Frameworks/libraries detected]
### ⚡ Performance Issues Found
#### 🔴 Critical Performance Issues
- **Issue**: [Specific performance problem]
- **Location**: [File:line reference]
- **Impact**: [Performance cost/bottleneck]
- **Solution**: [Specific optimization approach]
#### 🟡 Performance Improvements
- **Optimization**: [Improvement opportunity]
- **Expected Gain**: [Performance benefit]
- **Implementation**: [How to apply the fix]
### 🔒 Security Vulnerabilities
#### 🚨 Critical Security Issues
- **Vulnerability**: [Security flaw found]
- **Risk Level**: [High/Medium/Low]
- **Location**: [Where the issue exists]
- **Fix**: [Security remediation steps]
#### 🛡️ Security Hardening Opportunities
- **Enhancement**: [Security improvement]
- **Benefit**: [Protection gained]
- **Implementation**: [Steps to implement]
### ⚠️ Potential Issues & Edge Cases
#### 🔍 Hidden Problems
- **Issue**: [Potential problem identified]
- **Scenario**: [When this could cause issues]
- **Prevention**: [How to avoid the problem]
#### 🧪 Edge Cases to Handle
- **Case**: [Unhandled edge case]
- **Impact**: [What could go wrong]
- **Solution**: [How to handle it properly]
### 🏗️ Architecture & Maintainability
#### 📐 Code Quality Issues
- **Problem**: [Maintainability concern]
- **Location**: [Where it occurs]
- **Refactoring**: [Improvement approach]
#### 🔗 Dependency Optimization
- **Unused Dependencies**: [Packages to remove]
- **Outdated Packages**: [Dependencies to update]
- **Bundle Size**: [Optimization opportunities]
### 💡 Optimization Recommendations
#### 🎯 Priority 1 (Critical)
1. [Most important optimization with immediate impact]
2. [Critical security fix needed]
3. [Performance bottleneck to address]
#### 🎯 Priority 2 (Important)
1. [Significant improvements to implement]
2. [Important edge cases to handle]
#### 🎯 Priority 3 (Nice to Have)
1. [Code quality improvements]
2. [Minor optimizations]
### 🔧 Implementation Guide
```
[Specific code examples showing how to implement key optimizations]
```
### 📊 Expected Impact
- **Performance**: [Expected speed/efficiency gains]
- **Security**: [Risk reduction achieved]
- **Maintainability**: [Code quality improvements]
- **User Experience**: [End-user benefits]
## Optimization Focus Areas:
- **Performance First**: Identify and fix actual bottlenecks, not premature optimizations
- **Security by Design**: Build secure patterns from the start
- **Proactive Issue Prevention**: Catch problems before they reach production
- **Maintainable Solutions**: Ensure optimizations don't sacrifice code clarity
- **Measurable Improvements**: Focus on changes that provide tangible benefits
Include file:line references and concrete recommendations.