← LeaderboardThe Skill Leaderboard

optimize-react

Measure one slow React or Next.js route, trace its delay, fix the cause and compare before and after medians.

Published by sickn33 ↗sickn33/agentic-awesome-skills

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: optimize-reactdescription: "Measure one slow React or Next.js route, trace its delay, fix the cause and compare before and after medians."category: frontendrisk: criticalsource: https://github.com/Heyvhuang/copybook-skills/blob/6897765df660b852aa2e472037e9b7fc387b9aab/plugins/skills/skills/optimize-react/SKILL.mdsource_repo: Heyvhuang/copybook-skillssource_type: communitydate_added: "2026-12-02"author: Copybook and the Vercel Engineering contributorstags: [react, nextjs, performance, profiling]license: MITlicense_source: https://github.com/Heyvhuang/copybook-skills/blob/6897765df660b852aa2e472037e9b7fc387b9aab/plugins/skills/skills/optimize-react/LICENSE

Speed up React

When to Use

Use when a React or Next.js route loads slowly, an interaction lags, or a request waterfall or large first-load bundle delays what the user sees. For a hotspot inside a single React component, use react-component-performance.

Prerequisites

Use a local production build or a fixed, authorized preview, a representative fixture and an available timer, React Profiler or browser trace. For a server timing, use a local route and record the point at which the response is measured.

1. Measure one milestone

Pick one route or action and a user-visible milestone, such as the product list appearing. Use a production build or a fixed preview. Record the build, device profile, fixture, cache state, and measurement method. Run at least three samples per version and record the median.

2. Follow the delay to its cause

Follow the measured delay to its cause:

EvidenceFirst change to try
Requests run in seriesStart independent reads together and await them at their point of use. Keep auth checks and real data dependencies in order. With streaming, put slow secondary content behind its own Suspense boundary.
Too much script on the first screenCheck which imports actually ship. Split large secondary features at their point of use and defer optional third-party scripts. Compare transferred JS and check the delayed feature still opens.
Server work repeatsCheck for duplicate reads and large serialized props. Deduplicate within the request where possible. Check user and tenant boundaries before sharing a cache across requests.
Typing or clicking feels slowUse the React Profiler or a browser trace to find expensive commits or long tasks. Remove unnecessary derived-state effects or narrow subscriptions before adding memoization.

3. Fix the main cause and measure again

When the user requests a fix, change the main cause within the requested scope. For a diagnosis request, report the measured cause and proposed change. Run the same measurement again, with the same fixture and cache policy. Check that the original content, permissions, and interactions still work. Report the before/after median, sample count, what changed, and any remaining bottleneck.

Example

User request: Find why the workshop schedule page loads slowly and fix the main cause.
Inputs: A local production build and a fixture with one workshop session and room.
Expected result: Both still appear in the HTML. Repeat loopback timings under the same conditions and report the two medians.

The published worked example records a prior test by Copybook and its actual timings.

Limitations

A slow route can have several independent causes. A timing from the server describes its response, and browser loading requires a browser measurement. A median of three runs is a starting point for a stable fixture. Collect more samples when variance obscures the result.

Safety and side effects

Use fixture data for traces and timings. Keep project code and data local. A requested fix can change files and run tests within the project. Ask before contacting a new external service, spending money or deploying. Preserve authentication and tenant boundaries when changing request order or caching.

Sources

Copybook's published skill is a rewrite of Vercel's MIT skill. The published change record pins the original version and explains the rewrite. LICENSE retains the permission notice.