agentleFS
robritacca-dotcomrobritacca-dotcom/rift-ds/.claude/skills/perf-audit/SKILL.md

perf-audit

Skill10 starsChanged 5 days agoMITView on GitHub

Measure what the website and the published package cost, find where the weight and the slow frames come from, fix them without changing a pixel, and lock each saving into a budget. Runs the route budget and size budget reports, the bundle breakdown, the lab timings and the pixel comparison. Use when asked to run the performance audit, make the site or a page faster, shrink a component or the package, or prove a change made things lighter. Never commits, pushes, or deploys.

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use a11y-audit, triage and 4 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.
  • renfei-designSkill

    a11y-audit

    Audit Figma designs for WCAG accessibility issues — color contrast, minimum font size, touch target sizing, and missing text alternatives. Use when asked to check accessibility, audit contrast ratios, find a11y issues, verify WCAG compliance, or review designs for accessibility problems. Scans nodes, analyzes offline, and annotates issues in Figma.

    Also in 4 projects that use this

  • Google CloudSkill

    triage

    Gather context on a change or bug and plan the implementation.

    Also in 5 projects that use this

  • HashiCorpSkill

    changelog

    Add a Changie change fragment (`.changes/<major>.x/unreleased/*.yaml`) for a GitHub Pull Request, commit, and push.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 5 projects that use this

  • NVIDIASkill

    research

    Before designing a feature, research how comparable libraries solve the problem, check best practices, known pitfalls, and upstream changes. Use when starting a new feature, investigating an unfamiliar area, or the user asks to research something.

    Also in 3 projects that use this

  • GoogleSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run when asked to "run the performance audit", make the site, a page or a component faster or smaller, or show what a change did to load …

    line 20
  2. Distinctive:

    Run the timings with nothing else heavy running, and say so in the report if that was not possible.

    line 41
  3. Distinctive:

    every existing caller moved onto it, not only the one that was measured.

    line 56
  4. Very specific:

    Run npm run verify. Report, per finding: what it was, the figure before and after, the primitive and the check that now hold it, and …

    line 78

“Common” is measured: kept by at least 6 in 10 of the 13 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.

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

perf-audit

Two budgets hold what the system costs, and both are enforced by the build: scripts/validate-size-budget.mjs for the published package and scripts/validate-route-budget.mjs for the website. Each script's doc block owns what it measures and its rules. This skill is the work between two readings of those budgets: find the weight, remove it, prove nothing visible changed, and lower the ceiling so the saving holds.

Never commit, push, or deploy. Fixes land in the working tree for the owner to review.

When invoked

Run when asked to "run the performance audit", make the site, a page or a component faster or smaller, or show what a change did to load cost. For a layout or visual question, responsive-sweep and design-qa are the right skills.

What it can and cannot see

It sees bytes (exactly, from the build) and load timings (approximately, from a throttled browser on this machine). It does not see how a real visitor's device behaves, and no timing here is a gate: timings move with the machine and its load, so compare only runs taken close together on the same machine, and treat a difference under a tenth as noise.

Instructions

1. Take the before

Build both halves from the tree under review, then record the baseline. Keep every output outside the repo, in the session's scratchpad.

npm run build:lib
npm --prefix website run build
node scripts/validate-size-budget.mjs --report
node scripts/validate-route-budget.mjs --report
node scripts/measure-perf.mjs --json <scratchpad>/perf-before.json
node scripts/compare-screens.mjs shoot <scratchpad>/screens-before

Run the timings with nothing else heavy running, and say so in the report if that was not possible. If another session is working in the same checkout, say so before building, since a build replaces its output.

2. Find where the weight is

  • A component or subpath: node scripts/validate-size-budget.mjs --why <entry> lists the modules in its bundle, largest first. Look for a module the entry only needs on a rare path (an editor behind a menu, data for one variant), and for a shared module drawn in by one small use.
  • A page: the route report separates scripts, stylesheets and the document. A heavy document is inline markup or serialised data; heavy scripts on a page that shows little are imports that could wait for the press or the scroll that needs them.
  • A slow frame: the lab timings give long-task time per route. Profile the page in the browser to name the work before changing anything.

State each finding with its figure and its file before fixing it. A guess about what is slow is a lead, not a finding.

3. Fix, and codify the pattern

A performance fix that is applied once comes back. When a finding names a pattern (work done before it is needed, a loop that never pauses, the same helper written twice), the fix is in three parts, landed together:

  1. the shared primitive or rule that makes the right way the easy way, in src/behaviors/ or the site's own shared code;
  2. every existing caller moved onto it, not only the one that was measured;
  3. a check that fails on the old way, written with the new-validator skill, with existing exceptions sanctioned in its table and each one given its reason.

design.md and CLAUDE.md state the rule in the same change.

4. Prove nothing visible changed

Rebuild, shoot again, and compare:

node scripts/compare-screens.mjs shoot <scratchpad>/screens-after
node scripts/compare-screens.mjs compare <scratchpad>/screens-before <scratchpad>/screens-after --diffs <scratchpad>/screens-diff

Open every picture it lists. A difference is either a regression to fix or an intended change the owner must be told about; never wave one through. A picture reported as only partly compared was not proven, so check that page by eye in both themes.

5. Take the after and lower the ceilings

Run the reports and timings from step 1 again (--compare <scratchpad>/perf-before.json prints each timing beside its earlier figure). Then lock the saving in: both budgets fail when a ceiling sits far above its measure, so lower each one this change moved, in scripts/size-budget.json by hand and in scripts/route-budget.json by hand or with --write when many routes moved. Refresh the published component sizes with node scripts/validate-size-budget.mjs --write when a component moved.

6. Verify and report

Run npm run verify. Report, per finding: what it was, the figure before and after, the primitive and the check that now hold it, and anything measured but left alone with the reason.

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.