Deep code optimization audit using parallel specialist agents. Each agent hunts for performance anti-patterns, inefficiencies, duplication, and suboptimal code using pattern-based detection (Grep/Glob) without reading the full source code first — avoiding anchoring bias.
With the --fix flag, it automatically implements fixes as parallel PRs in isolated git worktrees.
npx skills add frizynn/code-optimizerSpawns 14+ specialist agents simultaneously, each scanning your codebase for a different class of problem:
| Agent | Focus |
|---|---|
| Database & Queries | N+1 queries, SELECT *, missing indexes, ORM misuse |
| Memory & Resources | Memory leaks, unclosed resources, large allocations |
| Algorithmic Complexity | O(n^2) patterns, unnecessary iterations, wrong data structures |
| Concurrency & Async | Sequential awaits, blocking in async, race conditions |
| Bundle & Dependencies | Heavy imports, unused deps, duplicate libs |
| Dead Code & Redundancy | Unused exports, commented code, dead branches |
| I/O & Network | Sequential requests, missing batching, no dedup |
| Rendering & UI | React re-renders, missing virtualization, layout thrashing |
| Data Structures | Wrong structures, unnecessary copies, inefficient serialization |
| Error & Resilience | Missing timeouts, swallowed errors, no retries |
| Caching & Memoization | Missing memoization, cache without invalidation |
| Build & Compilation | Dev code in prod, missing optimization flags |
| Security-Performance | Crypto misuse, missing rate limiting, ReDoS |
| Simplification & Dedup | Duplicated functions, inline boilerplate, verbose patterns |
Optional agents (spawned when relevant): Logging & Observability, Config & Infrastructure.
/code-optimizer # Audit only — report findings
/code-optimizer --fix # Audit + implement all fixes as PRs
/code-optimizer --fix-critical # Only fix CRITICAL and HIGH severity
/code-optimizer --simplify # Only run simplification/dedup agent
/code-optimizer src/ # Limit scope to a specific directory
Node.js/TypeScript, Python, Go, Rust, Java, Ruby, and any project with Docker, SQL, or standard build tools (Webpack, Vite, etc.).
- Detect stack — scans for package.json, requirements.txt, go.mod, Cargo.toml, etc.
- Spawn agents — launches all specialist agents in parallel
- Pattern-based detection — each agent Greps/Globs for anti-patterns from its reference file, only reading code context to confirm findings
- Consolidate report — deduplicates, sorts by severity, groups by file
- Execute fixes (with
--fix) — groups findings into independent units, spawns fix agents in isolated worktrees, each opens a PR
A prioritized report with:
- Executive summary (findings by severity, top 3 highest-impact fixes)
- Detailed findings table grouped by file
- Improvement plan ordered from highest to lowest impact
MIT