vercel-react-best-practices

Applies 57 performance optimization rules when writing or refactoring React and Next.js code.

3|1|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/PALabs-v1/AI_friend --skill vercel-react-best-practices-palabs-v1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/PALabs-v1/AI_friend/tree/main/.agents/skills/vercel-react-best-practices
Command: npx skills add https://github.com/PALabs-v1/AI_friend --skill vercel-react-best-practices-palabs-v1

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React and Next.js codebases often suffer from slow load times, unnecessary re-renders, bloated bundles, and sequential data-fetching waterfalls. This Skill provides a structured, prioritized rule set from Vercel Engineering so AI agents and developers consistently apply proven performance patterns instead of guessing. ## Core Features & Use Cases - 57 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 by impact level from CRITICAL to LOW. - Incorrect vs. Correct Code Examples: Every rule includes side-by-side TypeScript/TSX examples showing the anti-pattern and the optimized implementation, plus impact metrics like 2-10x improvements from parallelizing fetches. - Use Case: When refactoring a Next.js page that loads slowly, apply the rules to convert sequential awaits into Promise.all() calls, replace barrel file imports with direct imports, add Suspense boundaries for streaming, and minimize RSC serialization payloads. ## Quick Start Review my Next.js page component and apply the Vercel React best practices rules 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?

Start independent async operations immediately and await them together with Promise.all(), or use better-all for partial dependency chains. In API routes, create promises before awaiting so auth, config, and data fetches run concurrently instead of sequentially.

How to reduce bundle size in a React Next.js app?

Import directly from source files instead of barrel files like lucide-react or @mui/material entry points, which can load thousands of unused modules. Use next/dynamic for heavy components and defer analytics libraries until after hydration.

Does React.cache() work across multiple requests?

No, React.cache() only deduplicates within a single request. For cross-request caching, use an LRU cache like the lru-cache package, which is especially effective with Vercel Fluid Compute where function instances are shared.

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.

Why does my React component re-render too often?

Common causes include subscribing to state only used in callbacks, missing memoization of expensive computations, and broad effect dependencies. Extract work into memoized components, use functional setState updates, and narrow effect dependencies to primitives.