Agent skill Frontend
React Best Practices
Improve React and Next.js interfaces by addressing rendering, request waterfalls, bundle size and data fetching.
Install the skill
Run the command from your project root with Node.js and npm.
npx skills@latest add vercel-labs/agent-skills --skill vercel-react-best-practices --agent claude-code --yesCheck this file in your project.claude/skills/vercel-react-best-practices/SKILL.md
Other ways to install
Choose an assistant interactively
npx skills@latest add vercel-labs/agent-skills --skill vercel-react-best-practicesSelect your assistant and choose the project installation scope.
Official instructions
The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. Use a React or Next.js project with a reproducible slowdown. Check the versions in package.json before following framework-specific rules.
View operation manualWhat this skill helps with
- Reduce request waterfalls and unnecessary client work.
- Review rendering behavior, data fetching and bundle size.
- Prioritize React and Next.js improvements by their impact.
Good for
- Slow dashboards and content pages
- React and Next.js performance refactors
- Project support
- React applications and Next.js routes
- Highest-priority areas
- Request waterfalls and bundle size
- Rules
- Individual rule files with explanations and examples
- Verification
- Runtime traces, browser measurements, and functional checks
- Skill name
vercel-react-best-practices- Repository
vercel-labs/agent-skills
Give the assistant a slowdown it can reproduce
A broad request
Use vercel-react-best-practices to speed up my React app.
The route, interaction, and baseline help the assistant identify the bottleneck users experience.
A measurable request
- Name the slow route or interaction and give the steps to reproduce it.
- Capture a baseline and match the bottleneck to a relevant rule.
- Make a scoped change and repeat the same checks.
Operation manual
Use the skill to trace a slow dashboard or profile a lagging search input. Choose a fix and compare the same interaction before and after.
Start with a dashboard that loads account-scoped data and an optional chart. Choose the fix that matches your baseline and finish with the same verification.
Trace the route and capture a baseline
Locate the route, trace where its data and JavaScript come from, and record the conditions for a repeatable comparison.
- Use the browser Network panel to check browser requests and JavaScript chunks. Use server timings or traces for waits within a server render.
- Keep the account, filters, build mode, and cache conditions consistent when comparing runs.
Prompt · Step 1Use the installed vercel-react-best-practices skill to review [dashboard URL or route file]. Ask me which route to review if it is unclear. Confirm the React and Next.js versions and find the layout, page, data loaders, and client components on this route. Check the session and data dependencies as you trace the code. Record a baseline from the project's existing tooling if it can run. Capture request order, transferred JavaScript, and when the dashboard becomes usable. Use available server timings or traces for waits inside the server. If a measurement is unavailable, mark it as unmeasured and point to the relevant code. Identify the most consequential improvement supported by the evidence. Include the file locations, the applicable skill rule, the user behavior to preserve, and how to verify the change. Show me the diagnosis before editing.Remove a verified request waterfall
Start independent operations together after any shared prerequisites have completed.
- A summary query and an activity query can run together once their shared account or authorization checks succeed.
- If one request uses an ID produced by another, keep that dependency and check whether other work can start sooner.
Prompt · Step 2Use vercel-react-best-practices and the approved diagnosis to fix [confirmed request waterfall]. Inspect the actual dependencies and honor the route's account scope, permissions, caching, and error handling. Apply the skill's async-parallel rule where operations are independent. For work with partial dependencies, identify when each operation can start. Use the project's existing request and error-handling patterns. Keep the edit to this route and its loaders. Show the old and new request order and name the checks that confirm the dashboard still renders the same data and handles a failed request.rules/async-parallel.md rules/async-dependencies.mdCheck what the route loads on first view
If the baseline shows a heavy initial client chunk, trace imports from the route to the owning component.
- Check whether the current build actually includes code from a broad import before changing it.
- An optional detail panel opened by a button is a candidate for lazy loading. Verify how it loads when opened.
Prompt · Step 3Use vercel-react-best-practices to investigate [heavy dashboard component or client chunk] on [dashboard route]. Trace the import to its file, and check whether the component is needed in the first view. Apply bundle-barrel-imports or bundle-dynamic-imports when the measured build and the project's package exports or rendering boundaries support it. If the code is needed only for a later interaction, preserve access to that interaction and provide a suitable loading state. Keep the scope to this component and show the change in initial transferred JavaScript if the project can be measured. Verify that the optional component still opens and behaves correctly.rules/bundle-barrel-imports.md rules/bundle-dynamic-imports.mdCompare performance and verify behavior
Repeat the baseline and make sure users can still work with the correct data and states.
- Repeat the same route, account, filters, and measurement conditions.
- Check that account-scoped data, loading, empty, and error states still work.
- Verify that any deferred panel opens, loads, and can be used.
Prompt · Step 4Use vercel-react-best-practices to verify the approved change on [dashboard route]. Repeat the baseline with the same account, filters, build mode, and cache conditions. Compare the request sequence and JavaScript transfers that are relevant to the fix. Check data and permissions, the loading and empty states, the error path, and any interactions touched by the patch. Run the relevant checks supported by this project. Report measured differences, behavior checks, and anything still unmeasured.
Look up a specific performance problem
Ask the assistant to read the matching rule file in the installed skill and verify it against the current code.
Independent server requests run one after anotherasync-
- Command or reference
rules/async-parallel.md · rules/async-dependencies.md- Examples
- Trace which data each request needs and mark where any independent operations can start.
A component adds JavaScript to the first viewbundle-
- Command or reference
rules/bundle-barrel-imports.md · rules/bundle-dynamic-imports.md- Examples
- Check whether an optional chart can load when the user opens it.
A component renders repeatedly during interactionrerender-
- Command or reference
rules/rerender-derived-state.md- Examples
- If a toolbar only needs to know whether the page has crossed a scroll threshold, check how often it updates.
Typing lags while local results renderuseDeferredValue
- Command or reference
rules/rerender-use-deferred-value.md- Examples
- Profile a local search list and check whether results can update later while the input stays responsive.
Troubleshooting and FAQ
The browser shows one request. Can the server still have a waterfall?
Yes. A Next.js route can wait on several server-side operations before sending a response. Read the loaders and compare server timings or traces where available.
Can I run every request in parallel?
Start only independent work together. Keep authorization and data prerequisites in order, and verify the combined behavior when a request fails.
How should I report the result without a reproducible measurement?
Report the code paths that changed and which functional checks passed. Mark load time and bundle impact as unmeasured until you can compare equivalent runs.