vercel-react-best-practices

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

Updated Jan 27, 2026
One-click install
npx skills add https://github.com/SmallAi-API/smaihub --skill vercel-react-best-practices-smallai-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/SmallAi-API/smaihub/tree/main/.agents/skills/vercel-react-best-practices
Command: npx skills add https://github.com/SmallAi-API/smaihub --skill vercel-react-best-practices-smallai-api

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 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 generate and refactor performant React/Next.js code. ## Core Features & Use Cases - 45 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. - Incorrect vs. Correct Code Examples: Every rule includes concrete TypeScript/TSX examples showing the anti-pattern and the optimized implementation, with impact metrics like 2-10x improvements from parallelization. - Modular Rule Files: Individual rule files under rules/ allow targeted reference, while AGENTS.md provides the full compiled guide. - Use Case: When refactoring a Next.js page that fetches user, config, and profile data sequentially, apply the async-parallel and async-dependencies rules to convert sequential awaits into Promise.all() or better-all patterns, cutting response latency. ## Quick Start Ask the agent to review your React component or Next.js page for performance issues using the Vercel best practices rules and suggest optimized code.

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

How to reduce bundle size from barrel file imports in React?

Import directly from source files instead of barrel entry points, such as importing from lucide-react/dist/esm/icons/check rather than the package root. In Next.js 13.5+, configure experimental.optimizePackageImports to transform barrel imports automatically at build time.

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

React.cache() deduplicates calls within a single request, ideal for auth checks and database queries in one render pass. Use an LRU cache like lru-cache for data shared across sequential requests, which works especially well with Vercel Fluid Compute.

Does this guide work with the React Compiler enabled?

Yes, but some manual optimizations become unnecessary. The React Compiler automatically hoists static JSX and optimizes re-renders, though functional setState updates are still recommended for correctness and to prevent stale closure bugs.

Why does my React component re-render too often?

Common causes include subscribing to continuous values instead of derived booleans, wide effect dependencies on objects instead of primitives, and reading state only used in callbacks. Use media query hooks, narrow dependencies, and defer state reads to the usage point.

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 layout shift from loading to content would harm the user experience.