frontend-perf-impact-scan
Skill7 starsChanged 4 months agoMITView on GitHub
The frontend counterpart to `pr-impact-scan`. Before you PR a change to a React / Next.js / SPA codebase, enumerate the concrete performance regressions the diff introduces. New heavy imports, client-bundle bloat from server-to-client migration, list rendering without virtualization or keys, images without dimensions (CLS), fonts without preload (LCP), RSC network waterfalls, and hydration-mismatch risk. Produces a ranked list of blockers vs nits with file:line citations. Triggers include "perf review this PR", "will this ship slow", "check bundle impact", "frontend impact scan", "why did LCP regress".
In this repository14 other files it gives its agents.
- ai-tell-cleanupSkill
- branch-guardSkill
- jvm-memory-leak-reviewSkill
- kotlin-coroutine-reviewSkill
- nestjs-provider-reviewSkill
- nextjs-app-router-reviewSkill
- parallel-devSkill
- parallel-dispatchSkill
- parallel-prSkill
- pr-impact-scanSkill
- react-hooks-reviewSkill
- review-loopSkill
- reviewSkill
- spring-kafka-listener-reviewSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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
- Distinctive: line 15
Read git diff for the PR. For every added or modified file, extract:
- Distinctive: line 22
If the diff exceeds ~800 changed lines, request a scope split before scanning.
- Distinctive: line 31
Do not lump everything as "consider optimizing".
≈ “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.
Files
frontend-perf-impact-scan
Reasons about a frontend diff the way pr-impact-scan reasons about symbol callers. The goal: before you open a PR, know every user-observable perf regression the change adds and decide whether to ship, mitigate, or split.
Runs after the code is written and before the PR is opened. Not a lint rule replacement, not a Lighthouse replacement. Complementary.
Phase 1: Enumerate the diff
Read git diff for the PR. For every added or modified file, extract:
- New import statements (from and to).
- New JSX elements at the render root of any exported component.
- New effect / state declarations.
- New async operations (
fetch,await, Promises). - File-level markers that flip runtime mode:
"use client",export const dynamic,export const revalidate.
If the diff exceeds ~800 changed lines, request a scope split before scanning. Perf review on large PRs misses more than it catches.
Phase 2: Score each impact
Categorize every finding into one of:
- Blocker: user-visible regression on the golden path. Do not ship until mitigated.
- Watch: likely regression on edge cases (slow network, large list, low-end device). Ship with awareness.
- Nit: cost is measurable but marginal.
Do not lump everything as "consider optimizing". Ranking is the point.
Phase 3: Concrete checks
Bundle size
- Any new import from a heavy library (
moment,lodash,date-fnsfull import,chart.js,three, wholefirebase). Suggest a lighter alternative or a subpath import (lodash/get) or a dynamic import boundary. - Any component newly marked
"use client"that pulls large server-only modules through its imports. That code now ships to the browser. - Any newly imported file that transitively brings in an entire icon set or an entire style system.
Render cost
.map()over a list of unknown or unbounded size with no virtualization (react-window,TanStack Virtual) and no explicit maximum length..map()wherekey={index}is used and items can reorder or delete.- Newly added state that lives above a heavy subtree, causing re-renders on every keystroke.
- New inline object / array / function props to memoized children.
Layout stability (CLS)
<img>ornext/imagewithoutwidthandheight(orfillwith a sized parent).- Newly rendered late-arriving content that pushes existing content down (ads, chat widgets, notification bars).
- Skeletons whose dimensions do not match the loaded content.
Largest Contentful Paint (LCP)
- Hero image / hero video newly added without
priority(NextImage) or preload hints. - Custom font newly added without
font-display: swapor Next'snext/fonthandling. - New render-blocking third-party script added to
<head>.
Network waterfalls (RSC / App Router)
- Sequential
awaitin a server component that could bePromise.all. - A server component whose data fetch depends on the result of a client-side query, forcing a round-trip.
- Missing
preloadhints for critical resources referenced by the primary render path.
Hydration mismatch risk
- Server-rendered output that depends on
Date.now(),Math.random(),window,localStorage, or the user's locale without a stable fallback. - Conditional rendering based on
typeof window !== "undefined"at the top level of a component that also renders on the server.
Phase 4: Report
Group findings by category and rank Blocker first, Nit last. For each finding, include:
- File and line.
- One-sentence description of the regression.
- Concrete mitigation (not "consider optimizing"). Name the API, the library, or the code shape that fixes it.
At the end, one line of overall verdict: "ship", "ship with the two Watch items filed", or "mitigate blockers first".
When NOT to trigger
- Backend-only diffs.
- Config-only diffs.
- Refactors that provably do not change render output or bundle graph.
- PRs with a scope one heavy import wide that the user already flagged as a spike / prototype.
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
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.

