Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Optimize React?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sickn33-optimize-react)
---
name: optimize-react
description: "Measure one slow React or Next.js route, trace its delay, fix the cause and compare before and after medians."
category: frontend
risk: critical
source: https://github.com/Heyvhuang/copybook-skills/blob/6897765df660b852aa2e472037e9b7fc387b9aab/plugins/skills/skills/optimize-react/SKILL.md
source_repo: Heyvhuang/copybook-skills
source_type: community
date_added: "2026-12-02"
author: Copybook and the Vercel Engineering contributors
tags: [react, nextjs, performance, profiling]
license: MIT
license_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:
| Evidence | First change to try |
| --- | --- |
| Requests run in series | Start 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 screen | Check 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 repeats | Check 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 slow | Use 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
```text
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](https://github.com/Heyvhuang/copybook-skills/blob/6897765df660b852aa2e472037e9b7fc387b9aab/plugins/skills/skills/optimize-react/example.md) 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](https://github.com/Heyvhuang/copybook-skills/blob/6897765df660b852aa2e472037e9b7fc387b9aab/plugins/skills/skills/optimize-react/SKILL.md) is a rewrite of Vercel's MIT skill. The [published change record](https://github.com/Heyvhuang/copybook-skills/blob/6897765df660b852aa2e472037e9b7fc387b9aab/plugins/skills/skills/optimize-react/CHANGES.md) pins the original version and explains the rewrite. [LICENSE](LICENSE) retains the permission notice.