vercel-react-best-practices

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

Updated Dec 9, 2025
One-click install
npx skills add https://github.com/Aki2022/skills --skill vercel-react-best-practices-aki2022
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/Aki2022/skills/tree/main/vercel-react-best-practices
Command: npx skills add https://github.com/Aki2022/skills --skill vercel-react-best-practices-aki2022

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React and Next.js codebases often suffer from performance issues like data-fetching waterfalls, bloated bundles, unnecessary re-renders, and slow server responses. This Skill provides 70 prioritized, example-driven rules from Vercel Engineering so AI agents and developers consistently apply proven optimization patterns during code generation, review, and refactoring. ## Core Features & Use Cases - 70 Prioritized Rules Across 8 Categories: Covers eliminating waterfalls (CRITICAL), bundle size optimization (CRITICAL), server-side performance, client-side data fetching, re-render optimization, rendering performance, JavaScript performance, and advanced patterns. - Incorrect vs. Correct Code Examples: Every rule includes concrete TypeScript/TSX examples showing the anti-pattern and the optimized implementation, plus impact metrics (e.g., 2-10x improvement, 200-800ms import cost). - Structured Rule Files: Individual rule files in rules/ with frontmatter (title, impact, tags) and a compiled AGENTS.md for the complete guide. - Use Case: When refactoring a Next.js page that sequentially awaits fetchUser(), fetchPosts(), and fetchComments(), the Skill directs you to parallelize with Promise.all(), cutting three round trips to one. ## Quick Start Ask the AI to review your React or Next.js component for performance issues using the Vercel React best practices rules.

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?

Execute independent async operations concurrently with Promise.all() instead of sequential awaits, and start promises early in API routes before awaiting them. For partial dependencies, use better-all or chain promises so each task starts at the earliest possible moment.

How to reduce bundle size from barrel file imports?

Avoid importing from barrel files like 'lucide-react' or '@mui/material' entry points, which can load thousands of modules and cost 200-800ms per cold start. In Next.js 13.5+, use optimizePackageImports; otherwise import directly from source paths like '@mui/material/Button'.

Does this guide cover React Server Components performance?

Yes, it includes server-side rules for RSC such as minimizing serialization at RSC boundaries, per-request deduplication with React.cache(), avoiding shared module state for request data, and authenticating Server Actions like public API routes.

When should I use Suspense boundaries in React?

Use Suspense boundaries to render wrapper UI immediately while data streams in, rather than awaiting data in async components before returning JSX. Avoid it for SEO-critical above-the-fold content, layout-determining data, or when layout shift is unacceptable.

Why do React components re-render unnecessarily?

Common causes include defining components inside components, subscribing to raw state instead of derived booleans, and putting interaction logic in effects instead of event handlers. The rules recommend functional setState, lazy state initialization, useDeferredValue, and extracting memoized components.

What are the limitations of these optimization rules?

Rules are prioritized by impact, and low-impact micro-optimizations like caching property access only matter in hot paths. Some patterns have explicit exceptions, such as skipping cheap-condition-first ordering when the condition is expensive or side effects require fixed order.