performance-investigation
Skill146 starsChanged 7 months agoMITView on GitHub
MUST USE when investigating or fixing performance issues: slow responses, high memory usage, CPU spikes, throughput degradation, or optimization requests. Enforces measure-first methodology — profile before guessing, baseline before fixing, re-measure after every change. Distinct from systematic-debugging (which changes behavior to fix bugs) and brainstorming (which designs new features). Triggers on: "slow", "performance", "optimize", "speed up", "latency", "throughput", "memory leak", "high CPU", "profiling", "benchmark", "bottleneck", "takes too long", "response time", "why is this slow", "make it faster", "reduce memory", "loading time". Routed by using-superpowers, or invoke directly via /performance-investigation.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- cormacc/dotagentstheir own version, first seen Nov 8, 2026
- ericwang200608-beep/LANYANT-Skillstheir own version, first seen Nov 8, 2026
- itsofficialadi/boundifftheir own version, first seen Oct 25, 2026
- iamHrithikRaj/loomtheir own version, first seen Oct 20, 2026
- sveltejs/sveltetheir own version, first seen Oct 8, 2026
- adamentwistle/fable-skillstheir own version, first seen Sep 3, 2026
Used with
Projects with it also use security-review.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SentrySkillsecurity-review
Finds exploitable application security vulnerabilities in code changes. Use for Warden security scans, appsec review, OWASP-style checks, authentication or authorization bugs, injection, XSS, SSRF, path traversal, secrets, unsafe crypto, webhook verification, open redirects, or sensitive data exposure.
Also in 3 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- sveltejs/svelte★ 89ksame name
- microsoft/sre-agent★ 187same name
- adamentwistle/fable-skills★ 98same name
- ericwang200608-beep/LANYANT-Skills★ 2same name
- cormacc/dotagents★ 1same name
- motao123/dev-workflow-kit★ 1same name
- gclm/super-stack★ 0same name
- iamHrithikRaj/loom★ 0same name
- itsofficialadi/boundiff★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- brainstormingSkill
- claude-md-creatorSkill
- context-managementSkill
- deliberationSkill
- dependency-managementSkill
- dispatching-parallel-agentsSkill
- error-recoverySkill
- executing-plansSkill
- finishing-a-development-branchSkill
- frontend-designSkill
- premise-checkSkill
- receiving-code-reviewSkill
- refactoringSkill
- requesting-code-reviewSkill
- self-consistency-reasonerSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- token-efficiencySkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Before changing anything, establish a quantitative baseline.
- Distinctive: line 35
Measure the current state: Run the measurement 3+ times to confirm it's stable and reproducible.
- Distinctive: line 64
State the bottleneck explicitly: before proposing any fix:
- Distinctive: line 89
Target met?: Stop. Document the fix and the measurement.
- Distinctive: line 105
Never optimize without a measurement.
- Distinctive: line 106
Never optimize code that isn't the measured bottleneck.
- Distinctive: line 108
If the fix changes observable behavior (response shape, error handling, side effects), it's not just an optimization — route the behavior …
- Distinctive: line 109
Stop when the target is met.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Performance Investigation
Measure first. Guess never. Fix once.
Why This Exists
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.
Phase 1: Baseline
Before changing anything, establish a quantitative baseline.
Define the metric. What specifically is slow? Be precise:
- Response time for endpoint X under Y concurrent users
- Time to render component Z with N items
- Memory usage after processing M records
- Build time for the full project
"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:
- The metric value (with units)
- The measurement method (tool, command, conditions)
- The environment (machine, load, data size)
- 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/usersPhase 2: Profile
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.js:
node --prof+node --prof-process(text output),clinic doctor --autocannon(generates HTML — ask user to share),0x(flamegraph — ask user to describe hotspots) - Python:
python -m cProfile -s cumulative script.py(text output),py-spy top --pid PID(text output) - Go:
go test -bench . -cpuprofile cpu.prof+go tool pprof -text cpu.prof(text output) - Browser: Ask the user to run Lighthouse CLI (
npx lighthouse URL --output json) or share DevTools Performance tab screenshots - Database:
EXPLAIN ANALYZE(text output — run directly), slow query log - General:
time command,perf stat command(text output)
- Node.js:
- 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."
Phase 3: Hypothesize
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:
- Does it address the measured bottleneck (not a different one)?
- Is the predicted improvement realistic (not "10x faster" without evidence)?
- Does it change behavior? If yes, route through TDD — performance fixes must not break correctness.
- Identify risks: Could this fix introduce new problems? (Memory spikes from batch loading, cache staleness, increased complexity)
Phase 4: Fix and Re-measure
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:
- Target met? Stop. Document the fix and the measurement.
- Improved but not enough? Return to Phase 2 — profile again. The bottleneck has likely shifted to a different component.
- No improvement? The hypothesis was wrong. Revert the change and return to Phase 2 with fresh profiling.
- Regression? Revert immediately. Investigate why — the fix may have shifted load elsewhere.
- Record the result:
Fix: Batch permissions query (N+1 → 1) Before: 1200ms p95 After: 340ms p95 Improvement: 72% Target (< 300ms): not met → continue
Rules
- Never optimize without a measurement. "I think this is faster" is not evidence.
- Never optimize code that isn't the measured bottleneck. Optimizing a function that takes 2% of total time can never produce meaningful improvement regardless of how efficient you make it.
- One fix at a time. Bundle = can't attribute improvement.
- If the fix changes observable behavior (response shape, error handling, side effects), it's not just an optimization — route the behavior change through TDD.
- Stop when the target is met. Over-optimization is real cost with no real benefit.
Anti-Patterns
| 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. |
Related Skills
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)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

