vercel-react-best-practices

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

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

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 async waterfalls, bloated bundles, unnecessary re-renders, and inefficient data fetching. This Skill provides a structured, impact-prioritized rule set so AI agents and developers consistently apply proven optimization patterns instead of guessing. ## Core Features & Use Cases - 65 Prioritized Rules Across 8 Categories: Covers eliminating waterfalls, bundle size optimization, server-side performance, client-side data fetching, re-render optimization, rendering performance, JavaScript performance, and advanced patterns, each tagged with an impact level from CRITICAL to LOW. - Incorrect vs. Correct Code Examples: Every rule includes concrete TypeScript/TSX examples showing the anti-pattern and the optimized implementation, plus impact metrics like "2-10x improvement" or "200-800ms import cost". - Use Case: When refactoring a Next.js page that sequentially awaits multiple fetches, apply the waterfall elimination rules to parallelize with Promise.all() and restructure components with Suspense boundaries for faster initial paint. ## Quick Start Ask the AI to review your React component or Next.js page against the Vercel performance rules and suggest optimizations for data fetching, bundle size, and re-renders.

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 async waterfalls in Next.js API routes?

Start independent operations immediately by creating promises before awaiting them, then use Promise.all() to await them together. For partial dependencies, chain dependent fetches off the initial promise or use the better-all library to maximize parallelism automatically.

How to reduce React bundle size from icon and component libraries?

Avoid barrel file imports from libraries like lucide-react or @mui/material, which can load thousands of unused modules. In Next.js 13.5+, use the optimizePackageImports config option; otherwise import directly from subpaths like @mui/material/Button.

Does this guide apply to React apps without Next.js?

Yes, most rules apply to any React codebase, including re-render optimization, JavaScript performance, and client-side data fetching patterns. Next.js-specific rules cover Server Components, Server Actions, and next/dynamic, which only apply to Next.js projects.

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

React.cache() deduplicates fetches within a single request only. Use an LRU cache like lru-cache when data must persist across sequential requests, such as when a user triggers multiple endpoints needing the same data within seconds.

Why do Server Actions need their own authentication checks?

Server Actions are exposed as public endpoints just like API routes, so middleware or layout guards alone are insufficient. Always verify authentication and authorization inside each action, and validate inputs with a schema library like Zod before performing mutations.

When should I avoid using Suspense boundaries for data fetching?

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