/superpowers-optimized:performance-investigationfrom superpowers-optimized
Enforces a measure-first methodology for investigating performance issues: slow responses, high memory, CPU spikes, throughput degradation. Profiles before guessing, baselines before fixing, re-measures after every change.
Ships in superpowers-optimized. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub repozy/superpowers-optimized --plugin superpowers-optimized24 skills in this plugin
/brainstormingUse when the user wants new features, behavior changes, refactoring with new capabilities, or architecture decisions and no approved design exists yet. Produces a design before any code is written — in the conversation for small changes, as an approved spec document for larger work. Triggers on: "build this", "add a feature", "I want to change", "how should we", "design", "architect", "new project", "refactor", "we need to add/build/create", "implement a new". Routed by using-superpowers, or invoke directly via /brainstorming.
/claude-md-creatorCreates minimal, high-signal CLAUDE.md and AGENTS.md context files based on empirical best practices. Invoke on /init command, "create CLAUDE.md", "update CLAUDE.md", "write AGENTS.md", or "set up Claude Code for this project". Also invoked by brainstorming when repo lacks a context file. tools: Read, Glob, Grep, Bash, Edit
/context-managementUse in long or noisy sessions to persist durable state across session boundaries via state.md. Also generates project-map.md when asked to map the project. Triggers on: user explicitly asks to "save state", "compress context", "map this project", "generate project map", "create project map", cross-session handoff needed, or repeated failures indicate context is getting stale.
/deliberationUse BEFORE brainstorming when facing a complex architectural, technology, or design decision where the options are not yet well-defined or the problem itself may need reframing. Assembles named stakeholder perspectives that each speak once without debate, then surfaces where they converge and where real tension remains — without forcing a premature choice. Triggers on: "should we use X or Y", "not sure which approach", "evaluate these options", "what are the trade-offs between", "help me think through this decision", "architecture decision", "technology choice". Routed by using-superpowers before brainstorming when the decision space is unclear.
/dependency-managementUse when updating, migrating, or auditing project dependencies: upgrading packages, fixing security vulnerabilities (CVEs), resolving breaking changes, migrating to new major versions, or auditing outdated dependencies. Enforces incremental updates with verification at each step. Distinct from systematic-debugging (which fixes application bugs) and refactoring (which restructures application code). Triggers on: "update dependencies", "upgrade packages", "npm update", "pip upgrade", "outdated", "vulnerability", "CVE", "security advisory", "breaking change", "migration guide", "dependency conflict", "peer dependency", "update to latest", "audit dependencies", "npm audit", "dependabot". Routed by using-superpowers, or invoke directly via /dependency-management.
/dispatching-parallel-agentsUse when 2+ tasks are independent and can run concurrently without file or state conflicts or sequential dependencies. Triggers on: "run these in parallel", "do these at the same time", plans with independent tasks, when subagent-driven-development identifies parallelizable work.
Other plugins' skills for the same job