performance-profiler
Skill12 starsChanged 5 months agoMITView on GitHub
Systematically finds and fixes performance bottlenecks by measuring first, profiling hot paths, reducing algorithmic and I/O cost, and verifying gains with before/after benchmarks. Use this skill when code, an endpoint, a page, a query, or a job is "slow", "laggy", "timing out", "using too much CPU/memory", or "doesn't scale"; when asked to optimize, speed up, profile, or benchmark something; when chasing high latency / low throughput, p99 spikes, memory leaks, N+1 queries, or excessive allocations; or before/after a perf-sensitive change to prove it actually helped. Covers Python, Node/JS, Go, Java, SQL, and HTTP/web frontends.
We split this skill into the rules it gives an agent
9 rules. 0 are common, 8 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Follow this loop. Do not skip steps — especially step 1 and step 6.
- Very specific: line 51
Profile to find the hot path: Use a real profiler (not scattered print timers) to attribute cost.
- Distinctive: line 73
Do less work: Remove redundant computation, dead code, needless copies, logging in hot loops.
- Distinctive: line 95
CPU-bound vs I/O-bound first: If wall time >> CPU time, you are waiting on I/O (disk, network, DB, locks) — chase step 3/4, not micro-CPU …
- Distinctive: line 111
Run benchmarks multiple times.
- Distinctive: line 112
Keep correctness tests green throughout — a fast wrong answer is worthless.
- Distinctive: line 113
Commit the baseline numbers and the proof of improvement alongside the change.
- Distinctive: line 114
Prefer eliminating work over doing the same work faster.
- Distinctive: line 115
Add a regression benchmark to CI for anything you fought hard to speed up.
“Common” is measured: kept by at least 6 in 10 of the 7 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 Profiler
Overview
Make slow things fast — correctly and provably. This skill enforces a measure-driven loop: never optimize on a hunch, always profile to find the real hot path, fix the biggest contributor first, then re-measure to confirm the win and guard against regressions.
Keywords: performance, profiling, optimization, bottleneck, latency, throughput, p99, slow, benchmark, flamegraph, CPU profile, memory leak, allocations, N+1 query, caching, big-O, complexity, hot path, regression.
The cardinal rule: measure first. Most "obvious" optimizations target the wrong code. Profilers routinely show that 90% of time sits in a place nobody suspected.
Workflow
Follow this loop. Do not skip steps — especially step 1 and step 6.
- Define the goal and a metric. Pick ONE primary metric and a target: wall-clock latency (p50/p95/p99), throughput (req/s, rows/s), CPU time, peak memory (RSS), or allocations. Write down the current value and the target. "Make it faster" is not a goal; "cut p95 from 800ms to under 200ms" is.
- Reproduce reliably. Build a repeatable scenario with representative data volume. A bottleneck at 10 rows may vanish at 10M and vice-versa. Disable noise: warm caches, JIT warmup, fixed input, quiet machine, multiple runs.
- Measure the baseline. Time/benchmark the whole operation before touching
anything. Save the numbers. Use
scripts/bench.pyfor a quick statistically sane wall-clock benchmark of a Python callable or shell command. - Profile to find the hot path. Use a real profiler (not scattered print
timers) to attribute cost. Find the function/line/query consuming the most
time or memory. See
references/profiling-tools.mdfor the right tool per language and how to read its output. - Diagnose and fix the top contributor. Apply the cheapest effective fix from the optimization hierarchy (see below). Change ONE thing at a time so each change's impact is attributable.
- Re-measure and verify. Re-run the exact baseline benchmark. Confirm the metric improved and correctness is unchanged. Quantify: "p95 800ms → 180ms, -77%". If no improvement, revert and re-profile.
- Repeat or stop. Return to step 4 for the next hot path, or stop when the target is met. Add a regression guard (a benchmark assertion or CI check) so the win doesn't rot.
Optimization hierarchy
Apply fixes in this order — cheapest/highest-leverage first. Most wins come from the top three.
- Do less work. Remove redundant computation, dead code, needless copies, logging in hot loops. Cache or memoize pure, repeated results. Hoist invariants out of loops. Compute lazily / short-circuit.
- Reduce algorithmic complexity. Replace O(n²) with O(n log n) or O(n):
use a hash set/map for membership and lookups, sort once instead of
repeatedly scanning, use the right data structure. See
references/complexity-cheatsheet.md. - Fix I/O and data access. Batch round-trips, eliminate N+1 queries, add the right index, select only needed columns, stream instead of buffering, use connection pooling, paginate. I/O usually dwarfs CPU.
- Parallelize / concurrency. Overlap independent I/O (async), use a worker pool for CPU-bound work, vectorize (NumPy/SIMD). Only after single-thread work is minimized — parallelizing a bad algorithm just burns more cores.
- Reduce allocations / memory pressure. Reuse buffers, avoid intermediate collections, use generators/iterators, pick compact representations, cut GC churn.
- Lower-level / micro-optimizations. Compiled extensions, better serializer, tuned runtime flags, JIT-friendly code. Last resort — small payoff, high maintenance cost.
Decision framework
- CPU-bound vs I/O-bound first. If wall time >> CPU time, you are waiting on I/O (disk, network, DB, locks) — chase step 3/4, not micro-CPU tuning. If wall time ≈ CPU time, attack the algorithm (step 1/2).
- Latency vs throughput. Caching and batching help throughput; they may not help a single cold request's latency. Optimize for the metric you committed to.
- Tail vs average. p99 spikes are usually GC pauses, lock contention, cold caches, or a slow dependency — not the average path. Profile the slow requests specifically.
- Amdahl's law. Speeding a section that's 5% of runtime can yield at most a 5% gain. Always spend effort proportional to a section's share of total cost.
Best Practices
- Profile in a configuration that resembles production (data size, build flags, release/optimized mode — never profile a debug build and extrapolate).
- Change one variable per measurement; keep a running log of (change → metric).
- Run benchmarks multiple times; report median and spread, not a single run.
- Keep correctness tests green throughout — a fast wrong answer is worthless.
- Commit the baseline numbers and the proof of improvement alongside the change.
- Prefer eliminating work over doing the same work faster.
- Add a regression benchmark to CI for anything you fought hard to speed up.
Common Pitfalls
- Optimizing without profiling — fixing code that isn't the bottleneck.
- Premature optimization — complicating code for gains the user never feels.
- Micro-benchmark lies — measuring a case the optimizer elides, or one with unrepresentative data/caching, then shipping a non-win.
- Benchmarking debug builds or with profiler overhead included.
- Single-run conclusions — noise mistaken for signal.
- Premature parallelism — adding threads/async over an O(n²) core.
- Cache without invalidation strategy — turns a speed bug into a correctness bug.
- Ignoring the tail — celebrating a better mean while p99 still times out.
Supporting files
references/profiling-tools.md— per-language profiler commands (Python, Node/JS, Go, Java, SQL, web/browser), what each measures, and how to read flamegraphs and call trees.references/complexity-cheatsheet.md— big-O of common operations and data structures, plus the canonical "swap this for that" optimization patterns (N+1 fix, set-membership, memoization, batching).scripts/bench.py— runnable benchmark harness: times a Python expression or a shell command over N runs and reports min/median/mean/stdev with a clean comparison mode for before/after.examples/optimize-n-plus-one.md— full worked example taking a slow endpoint from 1.9s to 60ms through the whole loop (measure → profile → fix → verify).
Other versions19 projects use a version of this.
Word for word · 2
- jaskirat1616/grok-skills★ 22100% same
- JayRHa/AgentSkills★ 12100% same
Edited · 0
None found.
Wrote their own version · 17
- OneWave-AI/claude-skills★ 378same name
- mar-antaya/my-claude-skills★ 148same name
- Vinix24/vnx-orchestration★ 63same name
- Hassaan146/claude-skills★ 18same name
- k1lgor/virtual-company★ 4same name
- DeRuiChen258/RL_Infra_skills-openAI★ 3same name
- csiddhant796-blip/claude-skills-collection★ 2same name
- Hussain-Elfalah/Agentic-Skills★ 2same name
- miptah21/skills★ 2same name
- salmandev/everything-gemini★ 2same name
7 more not listed
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 repository75 other files it gives its agents.
- 0-templateSkill
- ab-test-analyzerSkill
- adr-authorSkill
- api-designerSkill
- api-docs-writerSkill
- aws-cost-optimizerSkill
- bash-script-hardeningSkill
- blog-post-writerSkill
- book-summarizerSkill
- changelog-keeperSkill
- chart-chooserSkill
- code-reviewerSkill
- competitive-analysisSkill
- concept-explainerSkill
- cover-letter-writerSkill
- cron-schedulerSkill
- data-pipeline-architectSkill
- debug-detectiveSkill
- decision-matrixSkill
- dependency-upgraderSkill
- dockerfile-proSkill
- email-composerSkill
- error-handling-patternsSkill
- event-plannerSkill
- flashcard-generatorSkill
- gdpr-data-mapperSkill
- gift-advisorSkill
- github-actions-builderSkill
- git-workflowSkill
- habit-builderSkill
- incident-postmortemSkill
- interview-prepSkill
- job-description-writerSkill
- json-schema-authorSkill
- kubernetes-manifest-authorSkill
- language-tutorSkill
- meal-plan-builderSkill
- meeting-summarizerSkill
- mermaid-diagram-builderSkill
- nginx-config-proSkill
- observability-setupSkill
- okr-writerSkill
- pandas-data-cleaningSkill
- people-dataSkill
- personal-budget-plannerSkill
- presentation-builderSkill
- project-plannerSkill
- prompt-engineerSkill
- proofreaderSkill
- public-speaking-coachSkill
- rag-pipeline-designerSkill
- readme-generatorSkill
- refactoring-guideSkill
- regex-architectSkill
- release-notes-writerSkill
- resume-writerSkill
- salary-negotiatorSkill
- secrets-managerSkill
- secure-code-reviewSkill
- secure-password-policySkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

