agentleFS
khuynh22khuynh22/agent-dev-team/skills/performance-pass/SKILL.md

performance-pass

Skill9 starsChanged 2 months agoMITView on GitHub

Fixes measured slowness by setting a budget, profiling to find where time actually goes, changing one thing, and measuring again. Use for a latency regression, an N+1 query, memory growth, a slow build or test suite, or a Core Web Vitals miss. Refuses to optimize anything without a baseline number.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    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
  1. Distinctive:

    Before and after come from the same command, on the same data, on the same hardware.

    line 75

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Performance Pass

Measure, change one thing, measure again, keep the number. Without a baseline you are guessing, and guessing usually makes the code worse and the program no faster.

Standing reference: references/performance-checklist.md.

Process

  1. State the budget. Which metric, at which percentile, under what load. "p95 search latency under 200 ms at 50 requests per second." Without a target there is no way to know when to stop, and optimisation has no natural end.
  2. Measure the baseline. Warm up, discard the first runs, report p50 and p95. Save the command; it goes in the report and in the repository.
  3. Find where time actually goes. A profile, a query log, a trace, a counter. Not intuition. The bottleneck is almost never where it feels like it is, which is why this step exists.
  4. Work the order. Most real wins are in the first two:

    1. Work it does not need to do at all: redundant calls, work inside a loop that belongs outside it, recomputation of a stable value, over-fetching.
    2. Work done N times: N+1 queries and N+1 requests dominate real regressions. Count the queries in a test to prove it.
    3. Waiting: serial I/O that could be concurrent, a lock held across I/O, a missing timeout.
    4. The algorithm: a quadratic scan over a growing collection.
    5. Constant factors: allocation, copying, serialization.
  5. Change one thing. Measure again. Two changes at once and you have learned nothing about either.
  6. Name what you traded. Faster usually costs memory, complexity, or freshness. A cache without a stated invalidation rule is a bug that has not fired yet.
  7. Commit the benchmark so the claim is reproducible and the regression is caught rather than rediscovered.

Frontend specifics

Targets at the 75th percentile on real devices: LCP under 2.5 s, INP under 200 ms, CLS under 0.1. Measure on a throttled connection and a mid-tier device profile, not on your machine.

The usual causes: an unoptimized hero image or render-blocking resources for LCP; long tasks and heavy handlers for INP; images without dimensions and late-loading fonts for CLS.

Output

## Performance: <target>
- **Budget:** <metric, percentile, load>
- **Baseline:** p50 <n> / p95 <n> — command: `<cmd>`
- **Profile said:** <quoted, the top cost>
- **Change:** <one sentence>
- **After:** p50 <n> / p95 <n> — same command, same data
- **Traded away:** <memory, complexity, staleness>
- **Benchmark committed at:** <path>

Verification

  • Before and after come from the same command, on the same data, on the same hardware.
  • Numbers are absolute and include a percentile. A percentage alone hides that the baseline was 3 ms.
  • The full test suite still passes. A faster wrong answer is not a win.
  • The benchmark is in the repository.

Red flags

ThoughtReality
"This loop is obviously the problem"Profile it. It usually is not.
"It feels faster"Feels is not a percentile.
"I made five improvements"You now know the effect of none of them.
"3x faster on my fixture"A twelve-row fixture proves nothing about a twelve-million-row table.
"Caching fixed it"What invalidates it?
"The average improved"Averages hide the tail, and the tail is the user complaining.
"I'll optimize this while I'm in here"Without a budget and a baseline, that is churn.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.