From nexus-agents
Guides measure-first optimization with profiling to identify and fix performance bottlenecks, regressions, and Core Web Vitals issues.
How this skill is triggered — by the user, by Claude, or both
Slash command
/nexus-agents:performance-optimizationThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!--
Skip when:
"Premature optimization is the root of all evil." Don't optimize before you have evidence. The cost of complexity is permanent; the cost of waiting for evidence is one more profile run.
node --prof, clinic.js, browser DevTools Performance, pprof for memory.| Pattern | Symptom | Fix |
|---|---|---|
| N+1 queries | One query per record in a loop | Single batched query with IN clause or proper join |
| Unbounded data | Fetching all rows when 50 would do | Pagination + cursor-based limits |
| Synchronous I/O in hot path | readFileSync, execSync per request | Async + worker pool, or cache the result |
| Unnecessary serialization | JSON-parse-and-stringify the same blob multiple times | Pass through, or hash-cache by input |
| Cache miss patterns | Read-only data fetched on every render/request | TTL cache or memoization (with size bound) |
| Bundle size growth | First-paint regression after a feature add | Dynamic import for heavy features, code splitting at route boundaries |
| Re-render storms (React/Svelte/etc.) | Component renders 100x for one state change | Stable references, key-based memoization, lift state up |
| Excuse | Counter |
|---|---|
| "I'll add the optimization while I'm in here" | Optimization without a profile is gambling. The added complexity is permanent; the win may be zero or negative. |
| "Big-O says it's faster" | Big-O is asymptotic. For your actual n, the constant factors and cache effects often dominate. Measure. |
| "JavaScript engines optimize this" | Modern engines optimize hot loops, not your data flow. Don't assume — profile. |
| "It's a tiny win but free" | Free in code, expensive in review and bisect. Many "tiny wins" together obscure the actual hot path. |
| "Premature optimization is fine if it's clean" | The dichotomy isn't "messy vs clean optimization." It's "with evidence vs without." Without evidence, even clean optimization is premature. |
| "We'll measure in production" | You won't. Production has too much noise. Build a representative reproduction first. |
useMemo / React.memo / signal() everywhere as a precautionpnpm lint && pnpm typecheck && pnpm testnpx claudepluginhub nexus-substrate/nexus-agentsOptimizes application performance via measure-identify-fix-verify workflow. Use for Core Web Vitals, load times, regressions, or profiling bottlenecks.
Use when performance is a concern - sluggish pages, slow queries, bloated bundles, high-latency APIs, or whenever someone says "optimize" or "make it faster"
Measures and optimizes performance with data-driven profiling, identifying bottlenecks like N+1 queries, missing indexes, and synchronous I/O. Triggers on performance, speed, latency, profiling, or benchmark keywords.