/agent-skills:perf-passfrom agent-skills
Profile the finished version of a feature and make it faster or smaller with measured evidence. Measures a baseline, analyzes the implementation's contract (inputs and outputs) and then its structure, designs a simpler and faster solution alongside targeted fixes, tries them side by side, and picks the fastest option that meets the size goal, preferring the simplest structure. Runtime speed and memory for libraries, engines, servers and tools; bundle size and load cost for web apps. Use this skill when a feature is functionally done and before its PR is opened, when the user asks to profile, optimize, speed up, shrink or benchmark something, or when a change touches a hot path or the shipped bundle, even if they do not say "performance".
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A feature that works is the right moment to make it fast or small: the behavior is pinned down by tests, and the code is still fresh. This skill turns "make it faster" into a short, measured search. Known practices (references/principles.md, plus a file per language) are applied without a proof of their own, so measuring goes to the choices that trade one cost for another. It first pins down what the code must do, then how it does it, and looks for a simpler structure that does the same with less work. Every claim gets a number, every option gets tried against the same harness, and the result is the fastest option that meets the size goal, with the simplest structure among equals, not the first idea that helped.
Skip it for changes with no measurable cost (docs, config, one-off scripts), and say so.
python3 <skill>/scripts/bench.py --dir base=<path> --dir a=<path> [--dir b=<path>] \
--runs 10 --warmup 2 [--metric '<regex>' --higher-is-better] -- <command>
python3 <skills>/pr-review/scripts/size_diff.py <base> <candidate> --glob 'dist/**/*.js'
bench.py interleaves runs across checkouts so machine load hits every side equally, and marks a change as real only when it is larger than the noise. Use pr-author's wt.py (or plain git worktree) to give each candidate its own checkout.
The two rarely conflict when the fix is structural. A simpler structure does less work and has less code, so it tends to be both faster and smaller. That is why steps 3 to 5 look for a simpler structure before they look for local tweaks.
Ask the user only when the speed metric is unclear and it changes the answer.
Measure before changing anything. Use what the repo has first: bench/, vitest bench, cargo bench, go test -bench, pytest-benchmark, a size-limit config. If there is nothing, write the smallest benchmark that runs the feature on realistic input: realistic size and shape, not a toy. Keep it in the repo if the repo has a place for benchmarks, so the next change can be measured too.
Record the baseline with bench.py (speed) and, when there is a size goal, a production build plus size_diff.py. Note the machine and the command. Then profile: a CPU profile, an allocation profile, or a bundle analysis. Write down the top three or four costs with their share. See references/measuring.md for tools per stack.
Before reading how the code works, pin down what it must do. Write it in a few lines:
The contract is the yardstick for every option. An option is valid if it keeps the contract and passes the tests, however different its insides are.
Now describe how the current code meets that contract: its stages and passes over the data, the intermediate data it builds (copies, arrays, maps, strings), its layers and abstractions, its dependencies. Map each top cost from the profile to the stage that causes it.
Then compare the structure to the contract. Look for:
Also check the code against references/principles.md and the language file it names (references/principles-js-ts.md for .js and .ts). Note each principle it breaks, with its id and the line. A language with no file yet gets the general principles only.
Design the simplest structure that turns the contract's inputs into its outputs: the fewest stages, passes and intermediate structures, the right data structure for each access. Write it from the contract, not as edits to the current code, and follow every principle that applies, from the general file and the language file. This is option A, the structural rewrite.
A change that only applies a listed principle is not a candidate to compare. It goes into option A, or into the current code when A keeps its structure, and cites the principle id.
Then write the candidates that a principle cannot settle (see "When a principle is not enough" in references/principles.md, and references/strategies.md): caches, workers, laziness, splitting, bit packing, a dependency swap, engine-specific tricks. For each option, write:
Drop the ones whose best case is too small to matter. Keep up to three to try. When every change is principle-backed, there is nothing to try side by side: go to step 7 with option A alone.
Only the candidates from step 5 that a principle cannot settle are tried here. Build each option in its own worktree from the same base. Run the tests in each. An option that breaks behavior is out. Measure all of them in one bench.py run against the baseline, and when there is a size goal, one size_diff.py per option against the same base build. When two options are independent and both help, also try them combined.
Rank in this order:
A faster option that misses the size goal is not dropped right away. First look for a simpler form of it that keeps the gain and meets the goal, for example by dropping a dependency for a few lines of code or splitting the heavy part into a lazy chunk. If none exists, report the trade to the user with both numbers and let them pick.
Apply the chosen option on the feature branch, rerun the tests, and measure it once against the baseline with the same harness (bench.py, and size_diff.py when there is a size goal). This one run covers the principle-backed changes too. If it shows no real gain, the principles were applied off the hot path: keep the change when it is simpler or smaller, and do not claim a speed gain.
Report a table, and put the same numbers in the PR's Cost section:
Speed: render 1,000 rows. Size goal: no larger than baseline (48.2 kB gzip initial)
Contract: rows in, DOM out; callers read only the visible rows
Baseline: 41.2 ms median (10 runs), 3 passes over the rows
| Option | Speed | Change | Size | Structure | Verdict |
| ---------------------------------- | -------- | ------ | --------- | ----------------------- | -------------------- |
| A: one pass, render visible rows (W3, D2, D4) | 5.8 ms | -86% | -1.1 kB | 1 pass, -60 lines | chosen |
| B: virtualize with a library | 6.1 ms | -85% | +9 kB | 3 passes, new dep | misses size goal; A matches it |
| C: memoize cell formatting | 39.8 ms | -3% | +0.4 kB | cache invalidation | within noise |
Rejected options are worth keeping. Write the measured ones into the PR description and, when the repo keeps decision records or a nested CLAUDE.md near the code, one line there ("virtualizing the row list with a library was measured at -85% render time for +9 kB gzip; a one-pass render of visible rows got the same speed for -1.1 kB"), so nobody tries them again without new information.
evals/report-hotspot/case.yaml (opens in a new tab)evals/report-hotspot/files/setup.sh (opens in a new tab)evals/report-hotspot/graders/01-baseline.md (opens in a new tab)evals/report-hotspot/graders/02-hotspots.md (opens in a new tab)evals/report-hotspot/graders/03-options.md (opens in a new tab)evals/report-hotspot/graders/04-compared.md (opens in a new tab)evals/report-hotspot/graders/05-chosen-gain.md (opens in a new tab)evals/report-hotspot/graders/06-same-output.md (opens in a new tab)evals/report-hotspot/graders/07-report-table.md (opens in a new tab)evals/report-hotspot/graders/08-main-untouched.md (opens in a new tab)evals/report-hotspot/graders/09-contract-structure.md (opens in a new tab)evals/report-hotspot/place-files.sh (opens in a new tab)evals/report-hotspot/prompt.md (opens in a new tab)references/measuring.md (opens in a new tab)references/principles-js-ts.md (opens in a new tab)references/principles.md (opens in a new tab)references/strategies.md (opens in a new tab)scripts/bench.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lxsmnsyc/agent-skills --plugin agent-skills17 skills in this plugin
/changesetsWrite the changeset for a change in a repo that releases with changesets (a `.changeset/` folder exists). The bump level follows one question, whether the thing existed before: patch for changed behavior, minor for something new, major only with the maintainer's approval. Use this skill whenever finishing a change, opening a pull request or reviewing one in such a repo, even when nobody asks for a changeset, and when the user asks about bump levels or changelog entries./docs-siteMethod for planning, writing and maintaining a documentation site for a library, CLI, framework, API or app. Splits the site by what the reader needs (learn, do a task, understand, look up) into getting started, guides, concepts and reference, plus examples, troubleshooting, migration and a glossary. Gives each page type a fixed template, including the feature page (what it is, why, how it works, usage, options, limits, related) and the API reference entry. Covers navigation, code examples that run, keeping docs in step with the code, versioned docs and pages agents can read. Includes page templates, a checker script for page structure, links, orphan pages and code fences, and a review checklist. Use this skill whenever writing, restructuring, auditing or reviewing documentation, a docs site, a docs page, a README that has grown into docs, API reference, a getting started page, a migration guide or the docs part of the website/ folder, even if the user does not say "docs site". Load plain-writing with it.Other plugins' skills for the same job