Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 57 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-practices3description: Vercel engineering best practices for React/Next.js performance and architecture.4license: MIT5---67# Vercel React最佳实践89Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 57 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.1011## When to Apply1213Reference these guidelines when:14- Writing new React components or Next.js pages15- Implementing data fetching (client or server-side)16- Reviewing code for performance issues17- Refactoring existing React/Next.js code18- Optimizing bundle size or load times1920## Rule Categories by Priority2122| Priority | Category | Impact | Prefix |23|----------|----------|--------|--------|24| 1 | Eliminating Waterfalls | CRITICAL | `async-` |25| 2 | Bundle Size Optimization | CRITICAL | `bundle-` |26| 3 | Server-Side Performance | HIGH | `server-` |27| 4 | Client-Side Data Fetching | MEDIUM-HIGH | `client-` |28| 5 | Re-render Optimization | MEDIUM | `rerender-` |29| 6 | Rendering Performance | MEDIUM | `rendering-` |30| 7 | JavaScript Performance | LOW-MEDIUM | `js-` |31| 8 | Advanced Patterns | LOW | `advanced-` |3233## Quick Reference3435### 1. Eliminating Waterfalls (CRITICAL)3637- `async-defer-await` - Move await into branches where actually used38- `async-parallel` - Use Promise.all() for independent operations39- `async-dependencies` - Use better-all for partial dependencies40- `async-api-routes` - Start promises early, await late in API routes41- `async-suspense-boundaries` - Use Suspense to stream content4243### 2. Bundle Size Optimization (CRITICAL)4445- `bundle-barrel-imports` - Import directly, avoid barrel files46- `bundle-dynamic-imports` - Use next/dynamic for heavy components47- `bundle-defer-third-party` - Load analytics/logging after hydration48- `bundle-conditional` - Load modules only when feature is activated49- `bundle-preload` - Preload on hover/focus for perceived speed5051### 3. Server-Side Performance (HIGH)5253- `server-auth-actions` - Authenticate server actions like API routes54- `server-cache-react` - Use React.cache() for per-request deduplication55- `server-cache-lru` - Use LRU cache for cross-request caching56- `server-dedup-props` - Avoid duplicate serialization in RSC props57- `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 listeners65- `client-passive-event-listeners` - Use passive listeners for scroll66- `client-localstorage-schema` - Version and minimize localStorage data6768### 5. Re-render Optimization (MEDIUM)6970- `rerender-defer-reads` - Don't subscribe to state only used in callbacks71- `rerender-memo` - Extract expensive work into memoized components72- `rerender-memo-with-default-value` - Hoist default non-primitive props73- `rerender-dependencies` - Use primitive dependencies in effects74- `rerender-derived-state` - Subscribe to derived booleans, not raw values75- `rerender-derived-state-no-effect` - Derive state during render, not effects76- `rerender-functional-setstate` - Use functional setState for stable callbacks77- `rerender-lazy-state-init` - Pass function to useState for expensive values78- `rerender-simple-expression-in-memo` - Avoid memo for simple primitives79- `rerender-move-effect-to-event` - Put interaction logic in event handlers80- `rerender-transitions` - Use startTransition for non-urgent updates81- `rerender-use-ref-transient-values` - Use refs for transient frequent values8283### 6. Rendering Performance (MEDIUM)8485- `rendering-animate-svg-wrapper` - Animate div wrapper, not SVG element86- `rendering-content-visibility` - Use content-visibility for long lists87- `rendering-hoist-jsx` - Extract static JSX outside components88- `rendering-svg-precision` - Reduce SVG coordinate precision89- `rendering-hydration-no-flicker` - Use inline script for client-only data90- `rendering-hydration-suppress-warning` - Suppress expected mismatches91- `rendering-activity` - Use Activity component for show/hide92- `rendering-conditional-render` - Use ternary, not && for conditionals93- `rendering-usetransition-loading` - Prefer useTransition for loading state9495### 7. JavaScript Performance (LOW-MEDIUM)9697- `js-batch-dom-css` - Group CSS changes via classes or cssText98- `js-index-maps` - Build Map for repeated lookups99- `js-cache-property-access` - Cache object properties in loops100- `js-cache-function-results` - Cache function results in module-level Map101- `js-cache-storage` - Cache localStorage/sessionStorage reads102- `js-combine-iterations` - Combine multiple filter/map into one loop103- `js-length-check-first` - Check array length before expensive comparison104- `js-early-exit` - Return early from functions105- `js-hoist-regexp` - Hoist RegExp creation outside loops106- `js-min-max-loop` - Use loop for min/max instead of sort107- `js-set-map-lookups` - Use Set/Map for O(1) lookups108- `js-tosorted-immutable` - Use toSorted() for immutability109110### 8. Advanced Patterns (LOW)111112- `advanced-event-handler-refs` - Store event handlers in refs113- `advanced-init-once` - Initialize app once per app load114- `advanced-use-latest` - useLatest for stable callback refs115116## How to Use117118Read individual rule files for detailed explanations and code examples:119120```121rules/async-parallel.md122rules/bundle-barrel-imports.md123```124125Each rule file contains:126- Brief explanation of why it matters127- Incorrect code example with explanation128- Correct code example with explanation129- Additional context and references130131## Full Compiled Document132133For the complete guide with all rules expanded: `AGENTS.md`
Run npx skillmds@latest add makerjackie/vercel-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 engineering best practices for React/Next.js performance and architecture. 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. This skill is licensed under MIT.
makerjackie (@makerjackie) published this skill. Their other Agent Skills are listed on their SkillMD profile.