Investigates and fixes performance issues (slow responses, high memory, CPU spikes) using a measure-first methodology: profile before guessing, baseline before fixing, re-measure after changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-optimized:performance-investigationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Measure first. Guess never. Fix once.
Measure first. Guess never. Fix once.
Performance intuition is wrong more often than it's right. Developers consistently misidentify bottlenecks — optimizing the wrong function, caching the wrong query, parallelizing the wrong loop. This skill enforces a measurement-first approach that ensures you fix what's actually slow, not what feels slow.
Before changing anything, establish a quantitative baseline.
Define the metric. What specifically is slow? Be precise:
"It's slow" is not a metric. "GET /api/users takes 1200ms p95 with 100 concurrent connections" is.
Measure the current state. Run the measurement 3+ times to confirm it's stable and reproducible. For long-running measurements (>2 min each), 2 runs within 5% of each other is sufficient. Record:
Set a target (if the user hasn't). What would "fast enough" look like? This prevents infinite optimization — you stop when the target is met, not when you run out of ideas.
Baseline: GET /api/users → 1200ms p95 (100 concurrent, 10k users in DB)
Target: < 300ms p95
Method: wrk -t4 -c100 -d30s http://localhost:3000/api/users
Identify the actual bottleneck — not the guessed one.
Choose the right profiling tool for the stack. Prefer CLI-based tools that produce text output (Claude can read and analyze these directly). For GUI-only tools, ask the user to run them and share the output.
node --prof + node --prof-process (text output), clinic doctor --autocannon (generates HTML — ask user to share), 0x (flamegraph — ask user to describe hotspots)python -m cProfile -s cumulative script.py (text output), py-spy top --pid PID (text output)go test -bench . -cpuprofile cpu.prof + go tool pprof -text cpu.prof (text output)npx lighthouse URL --output json) or share DevTools Performance tab screenshotsEXPLAIN ANALYZE (text output — run directly), slow query logtime command, perf stat command (text output)Profile under realistic conditions. A profile with 10 items in the database tells you nothing about production with 10 million. Match the data size, concurrency, and environment as closely as possible. If no profiling infrastructure exists, add lightweight instrumentation (console.time/console.timeEnd, Date.now() deltas, or language-equivalent timing) at suspected boundaries — this is often enough to identify the bottleneck without setting up a full profiler.
Read the profile output. Identify the top 3 time/memory consumers. The bottleneck is the thing that takes the most wall-clock time (or memory, if that's the metric) — not the thing with the most calls, not the thing with the worst Big-O notation, not the thing that "looks inefficient." Distinguish between self time (time in the function itself) and total time (including callees) — the optimization target is usually the function with the highest self time.
State the bottleneck explicitly before proposing any fix:
"The profile shows 82% of time is spent in
serializeUser(), specifically the N+1 query loading user.permissions for each user in the list."
Propose a specific fix with a predicted improvement.
State the hypothesis: "Batch-loading permissions with a single IN query instead of N individual queries should reduce serialization time by ~80%, bringing p95 from 1200ms to ~300ms."
Sanity-check the hypothesis:
Identify risks: Could this fix introduce new problems? (Memory spikes from batch loading, cache staleness, increased complexity)
Apply one change, then measure again.
Implement the fix. One fix at a time — never bundle multiple optimizations. If you change three things and it's faster, you don't know which change helped (or if one made things worse and the other two compensated).
Re-measure using the exact same method from Phase 1. Same tool, same conditions, same data.
Compare to baseline:
Record the result:
Fix: Batch permissions query (N+1 → 1)
Before: 1200ms p95
After: 340ms p95
Improvement: 72%
Target (< 300ms): not met → continue
| Temptation | Why it fails |
|---|---|
| "Let me cache everything" | Caching adds complexity, staleness bugs, and memory pressure. Only cache what the profile says is slow. |
| "I'll parallelize it" | Parallelism helps CPU-bound work. If the bottleneck is I/O or a lock, parallelism makes it worse. |
| "This algorithm is O(n²), I should fix it" | Big-O matters at scale. If n is always 10, the constant factor dominates. Profile first. |
| "Pre-optimization: let me make this efficient from the start" | Write correct code first. Optimize only when measurement shows a problem. |
systematic-debugging — when performance degradation is actually a bug (infinite loop, memory leak from a logic error)test-driven-development — when the performance fix requires behavior changesrefactoring — when the fix is purely structural (reorganizing code for better locality, no behavior change)2plugins reuse this skill
First indexed Jul 9, 2026
npx claudepluginhub repozy/superpowers-optimized --plugin superpowers-optimizedProfiles system performance to identify bottlenecks using measurement before optimization — follows Brendan Gregg's USE Method and Google pprof methodology.
Systematic performance profiling and optimization. Use when performance issues are reported or suspected. Measure first, optimize second. Applies Pareto principle — find the 20% of code causing 80% of slowness, fix that, not the rest.
Profiles and optimizes performance with a mandatory baseline-first gate. Use when something is slow or you need to hit a latency/throughput target.