From dmj
Use when something is slow or might be ("it feels slow", "is this fast enough"), or when a choice affects speed: a slow endpoint, an N+1 query, nested loops over large input, a heavy bundle, picking a stack, database, framework, data structure, or algorithm, adding a hot-path dependency, or reviewing code for performance.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dmj:enforcing-performance-budgetsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Performance is a gate, not an afterthought. An unenforced budget is a wish. Regressions block merges.
Performance is a gate, not an afterthought. An unenforced budget is a wish. Regressions block merges.
Target O(1); else justify the lowest achievable in a comment at the call site: O(log n) > O(n) > O(n log n). O(n^2) or worse requires written justification next to the code, naming the input bound that keeps it safe. No silent quadratics on unbounded input.
Profile before optimizing; the bottleneck is rarely where intuition points. No optimization lands without a before/after measurement. A guess is not evidence; a flame graph is.
Every budget written and machine-checked. From these floors, adjust per project, always commit the number:
| Budget | Floor | Gate |
|---|---|---|
| p95 API latency | < 200ms | load test |
| LCP | < 2.5s | Lighthouse CI |
| INP | < 200ms | Lighthouse CI |
| CLS | < 0.1 | Lighthouse CI |
| JS bundle | < 200KB gzip | bundlesize / size-limit |
Confirm current Core Web Vitals thresholds at invocation (fetch web.dev; limits evolve, INP replaced FID). Lighthouse budget.json and bundlesize assert at error so a breach fails the build.
Origin is the last resort, not the default:
Fastest-fit by measured evidence, not fashion. Probe current independent benchmarks at decision time; ties break on your workload, not a marketing chart.
Load-test at peak times a safety factor; soak to catch leaks and GC stalls. The bar: a graph that flatlines under normal plus moderate attack load.
Run a dedicated performance lens as a fresh-context teammate in every review panel (never same-context self-review). Two implementations plausible: race them as parallel spikes in disposable worktrees (dmj:using-git-worktrees); the benchmark decides. Coordinate via TeamCreate + Agent (team_name, name); TeamCreate unavailable: race as native parallel Agent calls.
| Excuse | Reality |
|---|---|
| "Optimize later, ship now" | Later is a rewrite under production load. Budget now. |
| "n is small here" | Inputs grow; the bound is not in the code. Write it or fix it. |
| "It feels fast on my machine" | Your machine is not p95 on 3G. Measure the tail. |
Handoff: budgets into dmj:writing-plans; enforce the perf lens via dmj:requesting-code-review.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub divyamohan1993/dmjcustomizations --plugin dmj