vercel-react-best-practices

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

2|1|Updated Apr 17, 2025
One-click install
npx skills add https://github.com/abraham-yusuf/pernikahan-web --skill vercel-react-best-practices-abraham-yusuf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/abraham-yusuf/pernikahan-web/tree/main/.agents/skills/vercel-react-best-practices
Command: npx skills add https://github.com/abraham-yusuf/pernikahan-web --skill vercel-react-best-practices-abraham-yusuf

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, data-fetching waterfalls, bloated bundles, and unnecessary re-renders. This Skill gives AI agents and developers a prioritized, rule-based checklist from Vercel Engineering to systematically find and fix these performance problems. ## Core Features & Use Cases - 62 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 from CRITICAL to LOW. - Incorrect vs. Correct Code Examples: Every rule includes concrete TypeScript/TSX examples showing the wrong pattern and the optimized fix, ready to apply during code review or refactoring. - Use Case: When reviewing a Next.js page that fetches user, posts, and comments sequentially, apply the async-parallel rule to rewrite the fetches with Promise.all(), cutting three round trips down to one. ## Quick Start Ask the agent to review your React component or Next.js page against the Vercel performance rules and refactor any waterfall, bundle, or re-render issues it finds.

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 promises immediately and await them together with Promise.all(), or use better-all for partial dependencies. In components, restructure with composition so sibling Server Components fetch in parallel instead of sequentially.

How to reduce bundle size from icon and component libraries?

Import directly from source files instead of barrel files, such as importing from lucide-react/dist/esm/icons/check rather than the package root. On Next.js 13.5+, enable optimizePackageImports in next.config.js to transform barrel imports automatically.

Do Next.js Server Actions need authentication checks?

Yes, Server Actions are publicly exposed endpoints and must verify authentication and authorization inside each action. Do not rely on middleware or layout guards alone, since actions can be invoked directly like API routes.

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

React.cache() deduplicates calls within a single request, ideal for auth and database queries during one render. Use an LRU cache like lru-cache when data must persist across sequential requests, such as repeated user actions hitting multiple endpoints.

Why does my React component re-render too often?

Common causes include defining components inside components, missing memoization of expensive work, broad effect dependencies, and subscribing to raw state instead of derived values. The re-render rules cover functional setState, lazy initialization, transitions, and extracting memoized components.

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, or when queries are small and fast. The trade-off is faster initial paint versus potential layout shift when content loads.