vercel-react-best-practices

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

Updated Aug 21, 2025
One-click install
npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill vercel-react-best-practices-adithiya-s
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/Adithiya-S/AI-Study-Companion/tree/main/.agents/skills/react-best-practices/upstream
Command: npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill vercel-react-best-practices-adithiya-s

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 server-side waterfalls that are hard to spot during manual code review. This Skill gives an AI assistant a structured, prioritized rulebook of 64 performance guidelines from Vercel Engineering so generated and refactored code follows proven optimization patterns. ## Core Features & Use Cases - Prioritized Rule Catalog: 64 rules across 8 categories ranked by impact, from critical waterfall elimination and bundle size reduction to advanced patterns like useEffectEvent. - Incorrect vs. Correct Examples: Every rule includes concrete code comparisons showing the anti-pattern and the optimized implementation. - On-Demand Rule Files: Individual rule files under rules/ can be read for deep detail, while AGENTS.md provides the full compiled guide. - Use Case: When asking an AI to refactor a slow Next.js page, the Skill guides it to parallelize data fetching with Promise.all(), replace barrel imports with direct imports, add Suspense boundaries, and minimize RSC serialization. ## Quick Start Ask the AI to review your React component or Next.js page for performance issues using the Vercel React best practices guidelines.

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 optimize React and Next.js performance?

Start with the highest-impact rules: eliminate async waterfalls using Promise.all() and Suspense boundaries, then reduce bundle size by avoiding barrel file imports and lazy-loading heavy components with next/dynamic. The Skill organizes 64 rules by impact so you address critical issues first.

How to eliminate data fetching waterfalls in Next.js?

Start independent promises immediately and await them together with Promise.all(), or use better-all for partial dependency chains. In Server Components, restructure with component composition so sibling components fetch in parallel instead of sequentially.

Why are barrel file imports slow in React projects?

Barrel files re-export thousands of modules, costing 200-800ms per import and slowing builds since bundlers cannot tree-shake external packages. Import directly from source paths, or use Next.js 13.5+ optimizePackageImports to transform barrel imports automatically.

Does this guide cover React Server Components?

Yes, it includes server-side rules for RSC serialization minimization, per-request deduplication with React.cache(), cross-request LRU caching, and authenticating Server Actions like public API routes. These target Next.js App Router architectures specifically.

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.

What causes unnecessary re-renders in React components?

Common causes include defining components inside components, missing functional setState updates, broad effect dependencies, and subscribing to raw state instead of derived values. The Skill's re-render category provides 15 rules with memoization and transition patterns to fix these.