vercel-react-best-practices

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

Updated Sep 1, 2021
One-click install
npx skills add https://github.com/WP-Coaching/pellegrims.coach --skill vercel-react-best-practices-wp-coaching
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/WP-Coaching/pellegrims.coach/tree/main/.agents/skills/vercel-react-best-practices
Command: npx skills add https://github.com/WP-Coaching/pellegrims.coach --skill vercel-react-best-practices-wp-coaching

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, oversized bundles, and data-fetching waterfalls that are hard to spot during development. This Skill provides a structured, prioritized rule set from Vercel Engineering so AI agents and developers can consistently apply proven performance patterns when writing, reviewing, or refactoring code. ## 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 concrete before-and-after TypeScript/TSX snippets with explanations, making it directly actionable for automated refactoring and code review. - Use Case: When building a Next.js page that fetches user data, config, and posts, apply the waterfall rules to parallelize requests with Promise.all(), add Suspense boundaries for streaming, and use React.cache() to deduplicate authentication queries within a request. ## Quick Start Ask the AI to review your React component or Next.js page against the Vercel performance best practices and suggest specific optimizations.

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 components, restructure with composition so sibling components fetch in parallel instead of sequentially.

How to reduce bundle size in a Next.js application?

Import directly from source files instead of barrel files like lucide-react or @mui/material entry points, or enable optimizePackageImports in next.config.js. Use next/dynamic to lazy-load heavy components not needed on initial render.

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

React.cache() deduplicates calls within a single request, ideal for authentication 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.

Does this guide work with React Server Components?

Yes, several rules specifically address RSC concerns, including minimizing serialization at server-client boundaries, avoiding duplicate serialization in props, and parallel data fetching through component composition in the App Router.

Why does my React component re-render too often?

Common causes include subscribing to state only used in callbacks, missing memoization of expensive work, and broad effect dependencies. The re-render rules recommend deriving state during render, using functional setState, and extracting memoized components.

When should I not use Suspense boundaries for data fetching?

Avoid Suspense when data is critical for 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.