vercel-react-best-practices

Applies Vercel's performance optimization rules when writing or refactoring React and Next.js code.

Updated Apr 17, 2026
One-click install
npx skills add https://github.com/hpark0011/mirror --skill vercel-react-best-practices-hpark0011
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/hpark0011/mirror/tree/main/.agents/skills/vercel-react-best-practices
Command: npx skills add https://github.com/hpark0011/mirror --skill vercel-react-best-practices-hpark0011

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React and Next.js codebases often suffer from performance issues like data-fetching waterfalls, bloated bundles, unnecessary re-renders, and slow server responses. This Skill provides 45 prioritized, actionable rules from Vercel Engineering so AI agents and developers can consistently write and refactor performant React/Next.js code. ## Core Features & Use Cases - Waterfall Elimination: Parallelize independent async operations with Promise.all(), better-all, and strategic Suspense boundaries for 2-10× improvements. - Bundle Size Optimization: Avoid barrel file imports, use dynamic imports for heavy components, and defer non-critical third-party libraries. - Server & Client Performance: Apply React.cache() deduplication, LRU caching, SWR, and re-render optimization patterns. - Use Case: When reviewing a Next.js page that sequentially awaits user, posts, and comments fetches, the Skill directs you to combine them with Promise.all() and restructure components for parallel server-side data fetching. ## Quick Start Review my Next.js page component and apply the Vercel React best practices to eliminate data-fetching waterfalls and reduce bundle size.

Frequently Asked Questions about vercel-react-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I eliminate data fetching waterfalls in Next.js?▼

Execute independent async operations concurrently with Promise.all() instead of sequential awaits. For partial dependencies, use better-all to start each task at the earliest moment, and use Suspense boundaries so layout renders while data streams in.

How to reduce bundle size from barrel file imports?▼

Import directly from source files instead of barrel entry points, such as importing from lucide-react/dist/esm/icons/check rather than the package root. In Next.js 13.5+, configure experimental.optimizePackageImports to transform barrel imports automatically at build time.

When should I use React.cache() versus an LRU cache?▼

React.cache() deduplicates operations within a single request, ideal for auth checks and database queries in one render pass. Use an LRU cache like lru-cache for data shared across sequential requests, such as repeated user lookups within minutes.

Does SWR help with duplicate API requests in React?▼

Yes, SWR provides automatic request deduplication, caching, and revalidation across component instances. Multiple components calling useSWR with the same key share a single network request instead of each fetching independently.

Why does my React component re-render too often?▼

Common causes include subscribing to continuous values instead of derived booleans, wide effect dependencies on objects instead of primitives, and missing functional setState updates. Narrow dependencies to primitives and use useMemo or derived state to reduce render frequency.

When should I not use Suspense boundaries for data fetching?▼

Avoid Suspense when data drives layout decisions, when content is SEO-critical above the fold, when queries are small and fast, or when you want to prevent layout shift. The trade-off is faster initial paint versus potential content jumping.