code-optimizer

📁 luongnv89/skills 📅 9 days ago
21
总安装量
6
周安装量
#17480
全站排名
安装命令
npx skills add https://github.com/luongnv89/skills --skill code-optimizer

Agent 安装分布

claude-code 6
codex 6
opencode 6
openclaw 3
windsurf 3

Skill 文档

Code Optimization

Analyze code for performance issues following this priority order:

Analysis Priorities

  1. Performance bottlenecks – O(n²) operations, inefficient loops, unnecessary iterations
  2. Memory leaks – unreleased resources, circular references, growing collections
  3. Algorithm improvements – better algorithms or data structures for the use case
  4. Caching opportunities – repeated computations, redundant I/O, memoization candidates
  5. Concurrency issues – race conditions, deadlocks, thread safety problems

Workflow

  1. Read the target code file(s)
  2. Identify language and framework context
  3. Analyze for each priority category
  4. Report findings with severity and fixes

Response Format

For each issue found:

### [Severity] Issue Title
**Location**: file:line_number
**Category**: Performance | Memory | Algorithm | Caching | Concurrency

**Problem**: Brief explanation of the issue

**Impact**: Why this matters (performance cost, resource usage, etc.)

**Fix**:
[Code example showing the optimized version]

Severity Levels

  • Critical: Causes crashes, severe memory leaks, or O(n³)+ complexity
  • High: Significant performance impact (O(n²), blocking operations, resource exhaustion)
  • Medium: Noticeable impact under load (redundant operations, suboptimal algorithms)
  • Low: Minor improvements (micro-optimizations, style improvements with perf benefit)

Language-Specific Checks

JavaScript/TypeScript

  • Array methods inside loops (map/filter/find in forEach)
  • Missing async/await causing blocking
  • Event listener leaks
  • Unbounded arrays/objects

Python

  • List comprehensions vs generator expressions for large data
  • Global interpreter lock considerations
  • Context manager usage for resources
  • N+1 query patterns

General

  • Premature optimization warnings (only flag if genuinely impactful)
  • Database query patterns (N+1, missing indexes)
  • I/O in hot paths