vercel-react-best-practices

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

Updated Nov 30, 2025
One-click install
npx skills add https://github.com/Amakaflow/amakaflow-dev-workspace --skill vercel-react-best-practices-amakaflow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/Amakaflow/amakaflow-dev-workspace/tree/main/.claude/skills/vercel-react-best-practices
Command: npx skills add https://github.com/Amakaflow/amakaflow-dev-workspace --skill vercel-react-best-practices-amakaflow

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, impact-prioritized rule set so AI-assisted code generation and review consistently follows proven performance patterns. ## 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. - Incorrect vs. Correct Code Examples: Each rule file shows a concrete anti-pattern alongside the optimized implementation with explanations and impact metrics. - Quick-Reference IDs: Rules are tagged with prefixes like async-, bundle-, and server- for fast lookup during code review. - Use Case: When refactoring a Next.js page that fetches user, posts, and comments sequentially, apply the async-parallel rule to convert the calls into a single Promise.all() and cut three round trips down to one. ## Quick Start Ask the assistant to review your React component or Next.js page against the Vercel performance rules and suggest concrete 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 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, for example lucide-react/dist/esm/icons/check instead of the package root. In Next.js 13.5+, enable optimizePackageImports in next.config.js 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 when data must persist across sequential requests, such as repeated user lookups over several minutes.

Does this guide apply to plain React apps without Next.js?

Many rules are framework-agnostic, including re-render optimization, JavaScript performance, and client-side data fetching patterns. Next.js-specific rules cover Server Components, Server Actions, next/dynamic, and the after() API.

Why does my React app re-render too often?

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

What are the limitations of tree-shaking for barrel imports?

Tree-shaking fails when libraries are marked external, since bundlers cannot optimize them, and bundling them slows builds significantly. Direct source imports or Next.js optimizePackageImports avoid loading thousands of unused modules entirely.