vercel-react-best-practices

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

7|1|Updated Mar 29, 2024
One-click install
npx skills add https://github.com/aBgAmeuR/harmony --skill vercel-react-best-practices-abgameur
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/aBgAmeuR/harmony/tree/main/.agents/skills/vercel-react-best-practices
Command: npx skills add https://github.com/aBgAmeuR/harmony --skill vercel-react-best-practices-abgameur

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React and Next.js codebases often suffer from performance issues like data-fetching waterfalls, bloated bundles, and unnecessary re-renders that are hard to spot during development and code review. ## Core Features & Use Cases - 70 Prioritized Performance Rules: Covers 8 categories from eliminating async waterfalls (CRITICAL) to advanced hook patterns (LOW), each with incorrect vs. correct code examples. - Structured Rule Files: Individual rule files organized by prefix (async-, bundle-, server-, client-, rerender-, rendering-, js-, advanced-) for targeted lookups during code generation or review. - Use Case: When refactoring a Next.js page that fetches data sequentially, apply the async-parallel and async-suspense-boundaries rules to convert sequential awaits into parallel Promise.all calls with streaming Suspense boundaries. ## Quick Start Review my Next.js page component using the vercel-react-best-practices skill and fix any data-fetching waterfalls or bundle size issues.

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?

Use Promise.all() for independent async operations and start promises early before awaiting them in API routes. For partial dependencies, use the better-all library, and apply Suspense boundaries so layout renders while data streams in.

How to reduce bundle size from barrel file imports?

Import directly from source files instead of barrel entry points, or use Next.js 13.5+ optimizePackageImports config to transform imports automatically. Barrel files in libraries like lucide-react or @mui/material can add 200-800ms import cost.

Does this skill work with React Server Components?

Yes, it includes server-side rules covering RSC serialization deduplication, React.cache() per-request deduplication, avoiding shared module state, and authenticating Server Actions like public API routes.

When should I not use Suspense boundaries for data fetching?

Avoid Suspense when data is critical for layout decisions, SEO-critical above the fold, or when queries are small and fast. The trade-off is faster initial paint versus potential layout shift.

What is the difference between useMemo and useDeferredValue for performance?

useMemo caches computed values but should be avoided for simple primitive expressions, while useDeferredValue defers expensive derived renders to keep inputs responsive. The rerender- rules cover when each applies.