Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
Refactoring existing React/Next.js code
Writing new React components or Next.js pages
Fixing visual instability or layout shift (CLS) issues
Preventing flickering when reading from localStorage or cookies
Handling hydration mismatches with client-only data
Optimizing font loading (FOIT/FOUT prevention)
Adding proper dimensions to images and dynamic content
Rule Categories by Priority
Priority
Category
Impact
Prefix
1
Eliminating Waterfalls
CRITICAL
async-
2
Bundle Size Optimization
CRITICAL
bundle-
3
Server-Side Performance
HIGH
server-
4
Client-Side Data Fetching
MEDIUM-HIGH
client-
5
Re-render Optimization
MEDIUM
rerender-
6
Rendering Performance
MEDIUM
rendering-
7
JavaScript Performance
LOW-MEDIUM
js-
8
Advanced Patterns
LOW
advanced-
Quick Reference
1. Eliminating Waterfalls (CRITICAL)
async-defer-await - Move await into branches where actually used
async-parallel - Use Promise.all() for independent operations
async-dependencies - Use better-all for partial dependencies
async-api-routes - Start promises early, await late in API routes
async-suspense-boundaries - Use Suspense to stream content
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: benchflow-ai-skillsbench-react-best-practices3description: Vercel React Best Practices4---56# Vercel React Best Practices78Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.910## When to Apply1112Reference these guidelines when:1314- Refactoring existing React/Next.js code15- Writing new React components or Next.js pages16- Fixing visual instability or layout shift (CLS) issues17- Preventing flickering when reading from localStorage or cookies18- Handling hydration mismatches with client-only data19- Optimizing font loading (FOIT/FOUT prevention)20- Adding proper dimensions to images and dynamic content2122## Rule Categories by Priority2324| Priority | Category | Impact | Prefix |25|----------|----------|--------|--------|26| 1 | Eliminating Waterfalls | CRITICAL | `async-` |27| 2 | Bundle Size Optimization | CRITICAL | `bundle-` |28| 3 | Server-Side Performance | HIGH | `server-` |29| 4 | Client-Side Data Fetching | MEDIUM-HIGH | `client-` |30| 5 | Re-render Optimization | MEDIUM | `rerender-` |31| 6 | Rendering Performance | MEDIUM | `rendering-` |32| 7 | JavaScript Performance | LOW-MEDIUM | `js-` |33| 8 | Advanced Patterns | LOW | `advanced-` |3435## Quick Reference3637### 1. Eliminating Waterfalls (CRITICAL)3839- `async-defer-await` - Move await into branches where actually used40- `async-parallel` - Use Promise.all() for independent operations41- `async-dependencies` - Use better-all for partial dependencies42- `async-api-routes` - Start promises early, await late in API routes43- `async-suspense-boundaries` - Use Suspense to stream content4445### 2. Bundle Size Optimization (CRITICAL)4647- `bundle-barrel-imports` - Import directly, avoid barrel files48- `bundle-dynamic-imports` - Use next/dynamic for heavy components49- `bundle-defer-third-party` - Load analytics/logging after hydration50- `bundle-conditional` - Load modules only when feature is activated51- `bundle-preload` - Preload on hover/focus for perceived speed5253### 3. Server-Side Performance (HIGH)5455- `server-cache-react` - Use React.cache() for per-request deduplication56- `server-cache-lru` - Use LRU cache for cross-request caching57- `server-serialization` - Minimize data passed to client components58- `server-parallel-fetching` - Restructure components to parallelize fetches59- `server-after-nonblocking` - Use after() for non-blocking operations6061### 4. Client-Side Data Fetching (MEDIUM-HIGH)6263- `client-swr-dedup` - Use SWR for automatic request deduplication64- `client-event-listeners` - Deduplicate global event listeners6566### 5. Re-render Optimization (MEDIUM)6768- `rerender-defer-reads` - Don't subscribe to state only used in callbacks69- `rerender-memo` - Extract expensive work into memoized components70- `rerender-dependencies` - Use primitive dependencies in effects71- `rerender-derived-state` - Subscribe to derived booleans, not raw values72- `rerender-functional-setstate` - Use functional setState for stable callbacks73- `rerender-lazy-state-init` - Pass function to useState for expensive values74- `rerender-transitions` - Use startTransition for non-urgent updates7576### 6. Rendering Performance (MEDIUM)7778- `rendering-animate-svg-wrapper` - Animate div wrapper, not SVG element79- `rendering-content-visibility` - Use content-visibility for long lists80- `rendering-hoist-jsx` - Extract static JSX outside components81- `rendering-svg-precision` - Reduce SVG coordinate precision82- `rendering-hydration-no-flicker` - Use inline script for client-only data83- `rendering-activity` - Use Activity component for show/hide84- `rendering-conditional-render` - Use ternary, not && for conditionals8586### 7. JavaScript Performance (LOW-MEDIUM)8788- `js-batch-dom-css` - Group CSS changes via classes or cssText89- `js-index-maps` - Build Map for repeated lookups90- `js-cache-property-access` - Cache object properties in loops91- `js-cache-function-results` - Cache function results in module-level Map92- `js-cache-storage` - Cache localStorage/sessionStorage reads93- `js-combine-iterations` - Combine multiple filter/map into one loop94- `js-length-check-first` - Check array length before expensive comparison95- `js-early-exit` - Return early from functions96- `js-hoist-regexp` - Hoist RegExp creation outside loops97- `js-min-max-loop` - Use loop for min/max instead of sort98- `js-set-map-lookups` - Use Set/Map for O(1) lookups99- `js-tosorted-immutable` - Use toSorted() for immutability100101### 8. Advanced Patterns (LOW)102103- `advanced-event-handler-refs` - Store event handlers in refs104- `advanced-use-latest` - useLatest for stable callback refs105106## How to Use107108Read individual rule files for detailed explanations and code examples:109110```111rules/async-parallel.md112rules/bundle-barrel-imports.md113rules/_sections.md114```115116Each rule file contains:117- Brief explanation of why it matters118- Incorrect code example with explanation119- Correct code example with explanation120- Additional context and references121122---123> Converted and distributed by [TomeVault](https://tomevault.io/claim/benchflow-ai) — claim your Tome and manage your conversions.124<!-- tomevault:4.0:skill_md:2026-04-11 -->
Run npx skillmds@latest add tomevault-io/benchflow-ai-skillsbench-react-best-practices in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Vercel React Best Practices It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.