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:
Writing new React components or Next.js pages
Implementing data fetching (client or server-side)
Reviewing code for performance issues
Refactoring existing React/Next.js code
Optimizing bundle size or load times
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
For the complete guide with all rules expanded: AGENTS.md
1---2name: vercel-react-best-practices-23description: 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:13- Writing new React components or Next.js pages14- Implementing data fetching (client or server-side)15- Reviewing code for performance issues16- Refactoring existing React/Next.js code17- Optimizing bundle size or load times1819## Rule Categories by Priority2021| Priority | Category | Impact | Prefix |22|----------|----------|--------|--------|23| 1 | Eliminating Waterfalls | CRITICAL | `async-` |24| 2 | Bundle Size Optimization | CRITICAL | `bundle-` |25| 3 | Server-Side Performance | HIGH | `server-` |26| 4 | Client-Side Data Fetching | MEDIUM-HIGH | `client-` |27| 5 | Re-render Optimization | MEDIUM | `rerender-` |28| 6 | Rendering Performance | MEDIUM | `rendering-` |29| 7 | JavaScript Performance | LOW-MEDIUM | `js-` |30| 8 | Advanced Patterns | LOW | `advanced-` |3132## Quick Reference3334### 1. Eliminating Waterfalls (CRITICAL)3536- `async-defer-await` - Move await into branches where actually used37- `async-parallel` - Use Promise.all() for independent operations38- `async-dependencies` - Use better-all for partial dependencies39- `async-api-routes` - Start promises early, await late in API routes40- `async-suspense-boundaries` - Use Suspense to stream content4142### 2. Bundle Size Optimization (CRITICAL)4344- `bundle-barrel-imports` - Import directly, avoid barrel files45- `bundle-dynamic-imports` - Use next/dynamic for heavy components46- `bundle-defer-third-party` - Load analytics/logging after hydration47- `bundle-conditional` - Load modules only when feature is activated48- `bundle-preload` - Preload on hover/focus for perceived speed4950### 3. Server-Side Performance (HIGH)5152- `server-cache-react` - Use React.cache() for per-request deduplication53- `server-cache-lru` - Use LRU cache for cross-request caching54- `server-serialization` - Minimize data passed to client components55- `server-parallel-fetching` - Restructure components to parallelize fetches56- `server-after-nonblocking` - Use after() for non-blocking operations5758### 4. Client-Side Data Fetching (MEDIUM-HIGH)5960- `client-swr-dedup` - Use SWR for automatic request deduplication61- `client-event-listeners` - Deduplicate global event listeners6263### 5. Re-render Optimization (MEDIUM)6465- `rerender-defer-reads` - Don't subscribe to state only used in callbacks66- `rerender-memo` - Extract expensive work into memoized components67- `rerender-dependencies` - Use primitive dependencies in effects68- `rerender-derived-state` - Subscribe to derived booleans, not raw values69- `rerender-functional-setstate` - Use functional setState for stable callbacks70- `rerender-lazy-state-init` - Pass function to useState for expensive values71- `rerender-transitions` - Use startTransition for non-urgent updates7273### 6. Rendering Performance (MEDIUM)7475- `rendering-animate-svg-wrapper` - Animate div wrapper, not SVG element76- `rendering-content-visibility` - Use content-visibility for long lists77- `rendering-hoist-jsx` - Extract static JSX outside components78- `rendering-svg-precision` - Reduce SVG coordinate precision79- `rendering-hydration-no-flicker` - Use inline script for client-only data80- `rendering-activity` - Use Activity component for show/hide81- `rendering-conditional-render` - Use ternary, not && for conditionals8283### 7. JavaScript Performance (LOW-MEDIUM)8485- `js-batch-dom-css` - Group CSS changes via classes or cssText86- `js-index-maps` - Build Map for repeated lookups87- `js-cache-property-access` - Cache object properties in loops88- `js-cache-function-results` - Cache function results in module-level Map89- `js-cache-storage` - Cache localStorage/sessionStorage reads90- `js-combine-iterations` - Combine multiple filter/map into one loop91- `js-length-check-first` - Check array length before expensive comparison92- `js-early-exit` - Return early from functions93- `js-hoist-regexp` - Hoist RegExp creation outside loops94- `js-min-max-loop` - Use loop for min/max instead of sort95- `js-set-map-lookups` - Use Set/Map for O(1) lookups96- `js-tosorted-immutable` - Use toSorted() for immutability9798### 8. Advanced Patterns (LOW)99100- `advanced-event-handler-refs` - Store event handlers in refs101- `advanced-use-latest` - useLatest for stable callback refs102103## How to Use104105Read individual rule files for detailed explanations and code examples:106107```108rules/async-parallel.md109rules/bundle-barrel-imports.md110rules/_sections.md111```112113Each rule file contains:114- Brief explanation of why it matters115- Incorrect code example with explanation116- Correct code example with explanation117- Additional context and references118119## Full Compiled Document120121For the complete guide with all rules expanded: `AGENTS.md`
Run npx skillmds@latest add jh941213/vercel-react-best-practices-2 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. 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.
jh941213 (@jh941213) published this skill. Their other Agent Skills are listed on their SkillMD profile.