performance-profiling
Skill8 starsChanged 9 days agoMITView on GitHub
Finds and fixes backend and application performance problems by measuring first - define the target metric, reproduce under realistic load, profile CPU, memory, I/O and locks, fix the biggest bottleneck, re-measure, and add a regression guard. Use when code or a service is slow, p95 or p99 latency is high, CPU or memory usage is too high, throughput is too low, startup is slow, or the user asks to optimize, profile or benchmark. Not for page-load tuning (use web-performance) or tuning a single SQL query (use sql-optimization).
25 other projects use a version of this.
Adopted by
Most recently taken up by
- Wade-DevCode/awesome-coding-skills-cntheir own version, first seen Nov 8, 2026
- ChariereFiedler/ronce-racinetheir own version, first seen Nov 1, 2026
- HeshamFS/materials-simulation-skillstheir own version, first seen Nov 1, 2026
- conorluddy/xclaude-plugintheir own version, first seen Oct 25, 2026
- troskater/flowdeck-claudetheir own version, first seen Oct 25, 2026
- sid-lakhani/agents-configtheir own version, first seen Oct 20, 2026
Used with
Projects with it also use intelligent-routing, bash-linux and 10 more.
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.
SKB3002Skillintelligent-routing
Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
Also in 5 projects that use this
xenitV1Skillbash-linux
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
Also in 6 projects that use this
xenitV1Skillred-team-tactics
Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.
Also in 6 projects that use this
SKB3002Skillnextjs-react-expert
React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.
Also in 3 projects that use this
- +8 more from xenitV1
Other versions25 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 25
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- LiberatedPixelCup/Universal-LPC-Spritesheet-Character-Generator★ 1.9ksame name
- conorluddy/xclaude-plugin★ 186same name
- xenitV1/Antigravity-Workflows★ 130same name
- HeshamFS/materials-simulation-skills★ 83same name
- nahid-sparktales/agent-dispatcher★ 59same name
- VoDaiLocz/kilo-kit-mcp★ 28same name
- ChariereFiedler/ronce-racine★ 9same name
- soumatheusgomes/agentville★ 9same name
15 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 repository60 other files it gives its agents.
- api-designSkill
- auth-implementationSkill
- background-jobsSkill
- building-agentsSkill
- caching-strategiesSkill
- ci-cd-pipelinesSkill
- cloud-cost-optimizationSkill
- codebase-onboardingSkill
- code-review-changesSkill
- concurrency-patternsSkill
- database-migrationsSkill
- database-schema-designSkill
- database-testingSkill
- data-pipelinesSkill
- data-privacy-retentionSkill
- dependency-upgradesSkill
- design-docsSkill
- design-systemsSkill
- dockerfilesSkill
- domain-driven-designSkill
- event-driven-architectureSkill
- file-storage-uploadsSkill
- frontend-securitySkill
- git-workflowSkill
- graphql-apisSkill
- grpc-servicesSkill
- incident-responseSkill
- infrastructure-as-codeSkill
- internationalizationSkill
- kubernetes-deploymentsSkill
- large-scale-migrationsSkill
- legacy-refactoringSkill
- llm-evalsSkill
- llm-integrationSkill
- mcp-serversSkill
- micro-frontendsSkill
- ml-experimentsSkill
- monorepo-managementSkill
- nosql-designSkill
- observabilitySkill
- orm-patternsSkill
- postgres-operationsSkill
- rag-systemsSkill
- react-patternsSkill
- realtime-apisSkill
- resilience-patternsSkill
- root-cause-debuggingSkill
- search-integrationSkill
- security-auditSkill
- seo-and-ssrSkill
- sql-optimizationSkill
- system-designSkill
- test-strategySkill
- threat-modelingSkill
- typescript-patternsSkill
- unit-testingSkill
- verify-before-doneSkill
- web-accessibilitySkill
- web-performanceSkill
- writing-skillsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 12 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
12
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 9
Never optimize what you have not measured.
- Distinctive: line 19
Not for: browser page-load and rendering (web-performance), a single slow SQL query (sql-optimization), or capacity planning without a …
- Distinctive: line 26
Find what bounds you: before opening a profiler: CPU, memory/GC, I/O, locks, or a downstream dependency.
- Distinctive: line 62
Look for wide plateaus near the top: that is self time worth optimizing.
- Distinctive: line 85
Use a real harness, not a stopwatch loop:
- Distinctive: line 98
Run many iterations and several processes.
- Distinctive: line 101
Use realistic inputs. Sorted, tiny, or always-cached data gives misleading results.
- Distinctive: line 102
Keep the machine quiet: no other heavy processes, power plugged in, same hardware for before and after.
- Distinctive: line 107
Use a load generator such as k6, wrk2, vegeta, hey or Locust against a staging environment.
- Very specific: line 108
Prefer open-model (fixed arrival rate) load, e.g.
- Distinctive: line 113
Do not run load tests against production or shared environments without explicit confirmation from the user.
- Distinctive: line 114
Ask before attaching a profiler to a production process.
- Distinctive: line 115
Never trade correctness for speed silently (skipping validation, weakening consistency, unbounded caches).
“Common” is measured: kept by at least 6 in 10 of the 14 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 Profiling
Never optimize what you have not measured. Profile, fix the largest bottleneck, measure again under the same conditions. A change without a before/after number is a guess.
When to use
- A request, job, function or command is slower than it should be.
- Tail latency (p95/p99) is high or spiky, even if the average looks fine.
- CPU, memory, GC time, or cloud cost is too high.
- Throughput tops out before hardware does.
- The user asks to "make it faster", profile, or benchmark something.
Not for: browser page-load and rendering (web-performance), a single slow SQL query (sql-optimization), or capacity planning without a concrete bottleneck.
Workflow
- State the problem as a number. Metric, current value, target, conditions. Example: "p99 of
POST /ordersis 1.8 s at 300 req/s on staging; target under 400 ms." If the user gives no target, propose one and confirm it. - Pick the right metric (table below). Use percentiles, never the mean, for latency.
- Reproduce in a production-like setup. Release/optimized build, realistic data volume and shape, same config and dependency versions, no debugger attached, JIT warmed up. Record a baseline over several runs and note the spread.
- Find what bounds you before opening a profiler: CPU, memory/GC, I/O, locks, or a downstream dependency. Use traces or APM first if they exist: is the time even spent in this process?
- Profile with the right tool for the bound and the stack. See references/profilers.md. Prefer low-overhead sampling profilers.
- Form one hypothesis and make one change. Fix the widest bar in the profile first. Leave code that takes 1% of time alone.
- Re-measure under identical conditions. Compare distributions (several runs), not single numbers. Confirm the profile changed the way you expected.
- Check correctness. Tests pass; output is identical; no new race conditions or stale-cache bugs.
- Add a regression guard (benchmark in CI, load test, or alert) so the win stays.
- Report a before/after table, what changed, why it helped, and any trade-offs (memory for speed, staleness for speed, complexity).
Choose the metric
| Goal | Measure | Notes |
| User-facing latency | p50, p95, p99 (and max) per endpoint | Mean hides tail problems. |
| Throughput | Requests or items per second at a fixed latency SLO and error rate | Throughput without a latency bound is meaningless. |
| Memory | RSS, live heap after GC, allocation rate, GC pause time | Steady growth over hours suggests a leak. |
| Startup | Time to ready / first successful request | Measure cold and warm separately. |
| Batch / CLI | Wall-clock time and cost per item | Use hyperfine for command-line comparisons. |
| Cost | CPU-seconds or dollars per request | Useful when latency is already fine. |
Find the bound
| Symptom | Likely bound | Next step |
| CPU near 100% of available cores; latency grows with load | CPU | CPU sampling profiler, flame graph |
| CPU low but latency high | Waiting: I/O, locks, downstream calls, pool exhaustion | Traces, wall-clock/off-CPU profile, thread dump, pool metrics |
| Memory grows steadily and never drops | Leak or unbounded cache/queue | Compare two heap snapshots taken minutes apart |
| High GC time, frequent pauses | Allocation pressure | Allocation profiler |
| Periodic latency spikes | GC pauses, scheduled jobs, cache expiry stampede, noisy neighbour | Correlate spike times with GC logs, cron, cache TTLs |
| Only p99 is bad | Contention, GC, cold caches, retries, one slow dependency | Look at slowest traces, not averages |
| Node.js latency rises for all requests at once | Event-loop blocking | Event-loop delay metric, CPU profile |
| .NET or Java requests queue while CPU is low | Thread pool starvation from blocking calls in async code | Thread-pool queue length, thread dump |
Reading a flame graph
- Width is the share of samples (time). The x-axis is not time order.
- The y-axis is stack depth; the top edge is where the CPU actually was.
- Look for wide plateaus near the top: that is self time worth optimizing.
- A CPU profile only shows on-CPU time. If the process waits (I/O, locks), use a wall-clock or off-CPU mode, or traces.
- Compare a before and after flame graph of the same workload to confirm the fix.
Common wins (check in this order)
| Problem | How to spot it | Fix |
| N+1 queries | Many near-identical queries per request in logs or a trace waterfall | Batch, join, eager-load, or a data loader |
| Missing index or bad query plan | Slow query log, DB time dominates traces | See sql-optimization |
| Chatty network | Many sequential calls in one trace | Batch requests, run independent calls in parallel, cache |
| Blocking I/O on a hot path | Event-loop lag (Node), thread-pool starvation (.NET/Java), sync calls inside async code | Use async APIs end to end; move CPU work to workers |
| Serialization overhead | JSON encode/decode wide in the profile | Smaller payloads, avoid serializing twice, faster serializer |
| Allocations in hot loops | Allocation profile, high GC time | Preallocate, reuse buffers, avoid boxing and repeated string concatenation |
| Lock contention | Threads blocked, low CPU, wide lock frames in wall-clock profile | Shrink critical sections, shard state, use concurrent data structures |
| Repeated expensive work | Same computation or remote call with same inputs | Memoize or cache with a size bound, TTL and invalidation; prevent stampedes |
| Wrong algorithm or data structure | Nested loops over large inputs, linear lookups in a loop | Hash maps/sets, sorting once, indexing |
| Logging on the hot path | Formatting or I/O of logs visible in the profile | Lower level, check level before formatting, sample |
| Pool sizing | Time spent waiting for a connection or worker | Right-size the pool; never above what the database can serve |
| Regex backtracking | One regex dominates CPU on certain inputs | Anchor and simplify the pattern, or use a linear-time engine |
Benchmarking properly
Use a real harness, not a stopwatch loop:
Stack Harness Java/Kotlin JMH C#/.NET BenchmarkDotNet (add [MemoryDiagnoser]for allocations)Python pyperf,pytest-benchmark, orpython -m timeitfor one-linersGo go test -bench=. -benchmem -count=10, compare runs withbenchstatRust criterionJS/TS tinybenchormitataAny CLI hyperfine --warmup 3 'old-cmd' 'new-cmd'- Warm up before measuring (JIT, caches, connection pools).
- Run many iterations and several processes; report median and spread. Treat differences inside the noise as no difference.
- Benchmark optimized builds only (
--release,-c Release, productionNODE_ENV). - Guard against dead-code elimination and constant folding: consume results (JMH
Blackhole, return values). - Use realistic inputs. Sorted, tiny, or always-cached data gives misleading results.
- Keep the machine quiet: no other heavy processes, power plugged in, same hardware for before and after.
- A microbenchmark proves a local speedup; only an end-to-end measurement proves user impact.
Load testing
- Use a load generator such as k6, wrk2, vegeta, hey or Locust against a staging environment.
- Prefer open-model (fixed arrival rate) load, e.g. k6's
constant-arrival-rateexecutor or wrk2's-R. Closed-loop tools that wait for each response under-report latency when the system slows down (coordinated omission). - Ramp up gradually and record where latency or errors break the SLO; that is the real capacity.
Safety
- Do not run load tests against production or shared environments without explicit confirmation from the user.
- Ask before attaching a profiler to a production process. Prefer low-overhead samplers. Heap dumps can pause the process and contain secrets and personal data: treat dump files as sensitive and never commit or share them.
- Never trade correctness for speed silently (skipping validation, weakening consistency, unbounded caches). Call out every such trade-off.
Anti-patterns
- Optimizing by intuition — the real bottleneck is rarely where you guess. Profile first.
- Reporting the mean — averages hide the tail users feel.
- Benchmarking debug builds or cold JITs — numbers will not transfer.
- Changing several things at once — you cannot tell which change helped or hurt.
- Micro-optimizing a function that is 1% of the profile — no visible effect, more complexity.
- Caching without bounds or invalidation — trades a latency problem for a memory or correctness problem.
- Tiny test data — hides N+1s, missing indexes and O(n²) code.
- Declaring victory on one run — noise can exceed the improvement.
Done when
- Before and after numbers exist for the target metric under the same conditions, over several runs.
- The target is met, or the report explains what limits further gains.
- A new profile shows the bottleneck moved or shrank.
- Tests pass and behaviour is unchanged.
- A regression guard (benchmark, load test, or alert) is in place.
- Trade-offs are written down in the PR or a code comment.
References
- references/profilers.md — read when choosing or running a profiler, heap analyzer, tracer or load generator for a specific language or OS.
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.

