performance-optimization

Installation
SKILL.md

Performance is system behavior delivering correct results under a defined workload, not clever micro-optimizations or gratuitous concurrency. Establish the workload contract and locate the dominant constraint empirically before mutating code; unmeasured optimization trades simplicity for superstition.

Match rigor to scope: a review identifies causal risks and the smallest measurement that settles them without inventing load; a diagnosis isolates the limiting factor with discriminating evidence; an implementation proves a material, reproducible win while preserving correctness.

Lock the workload and correctness contract first

Specify who waits, workload arrival shape, data cardinality, concurrency, hardware/environment bounds, and the metric that actually matters — end-to-end tail latency (p95/p99), sustained throughput, peak memory/allocation rate, query/network amplification, cold-start time, or cost per unit work. Reject proxy averages and idle micro-benchmarks when user pain lives in tails, bursts, or end-to-end queueing.

Capture a reproducible baseline on representative data volume and concurrency before changing code (reusing existing traces, EXPLAIN ANALYZE plans, or benchmarks when valid). Fold correctness invariants — consistency, freshness, ordering, auth scoping, error semantics, and resource ceilings — into the contract up front; skipping required work is a bug, not a speedup.

Isolate the real bottleneck on the critical path

Trace the end-to-end request or data path to separate CPU work, I/O round-trips, serialization cost, lock/pool contention, GC pressure, and downstream saturation. Use tools that discriminate between competing hypotheses — flamegraphs, execution plans, distributed traces, runtime counters, or a targeted reproducer — rather than guessing from static code shape.

Inspect saturation curves before local hotspots: shaving microseconds off a helper achieves nothing when a serial waterfall, N+1 query fan-out, or saturated connection pool dominates wall time, and raising worker counts past downstream capacity amplifies contention and tail latency.

Apply the highest-leverage structural lever

Attack waste in descending order of leverage, guided by the measured constraint:

Installs
12
GitHub Stars
2
First Seen
Aug 31, 2026