vercel-react-best-practices

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

Updated Aug 15, 2025
One-click install
npx skills add https://github.com/yehezkieldio/topaz --skill vercel-react-best-practices-yehezkieldio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/yehezkieldio/topaz/tree/main/v3-tether/.agents/skills/vercel-react-best-practices
Command: npx skills add https://github.com/yehezkieldio/topaz --skill vercel-react-best-practices-yehezkieldio

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, and bloated bundles because developers miss established performance patterns. This Skill provides a structured, prioritized rule set from Vercel Engineering so AI agents and developers consistently apply proven optimizations. ## Core Features & Use Cases - 70 Prioritized Rules Across 8 Categories: Covers eliminating async waterfalls, bundle size optimization, server-side performance, client-side data fetching, re-render optimization, rendering performance, JavaScript micro-optimizations, and advanced patterns. - Incorrect vs. Correct Code Examples: Each rule includes concrete TypeScript/TSX examples showing the wrong pattern and the fixed version, with impact metrics like 2-10x improvements from parallelization. - Use Case: When refactoring a Next.js page that fetches user, posts, and comments sequentially, the Skill directs you to wrap independent calls in Promise.all() and add Suspense boundaries so the layout renders immediately while data streams in. ## Quick Start Review my Next.js page component using the vercel-react-best-practices skill and fix any performance issues such as sequential awaits or barrel file imports.

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 async waterfalls in Next.js API routes?

Start independent operations immediately without awaiting them, then await the promises later. Use Promise.all() for fully independent calls, or the better-all library for operations with partial dependencies, achieving 2-10x improvements.

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

Avoid importing from barrel files like lucide-react or @mui/material entry points, which can load thousands of modules. In Next.js 13.5+, use optimizePackageImports in next.config.js; otherwise import directly from subpaths like @mui/material/Button.

When should I use Suspense boundaries in React Server Components?

Use Suspense when only part of the page needs async data, so the layout renders immediately while data streams in. Avoid it for SEO-critical above-the-fold content, layout-determining data, or very fast queries where overhead is not worth it.

Does this guide cover Next.js Server Actions security?

Yes, it requires authenticating Server Actions like public API routes. Always verify session and authorization inside each action rather than relying on middleware or layout guards, and validate inputs with schemas like zod before mutations.

Why does my React component re-render too often?

Common causes include defining components inside components, missing memoization of expensive work, broad effect dependencies, and subscribing to raw state instead of derived values. The re-render optimization rules cover useMemo, useTransition, useDeferredValue, and functional setState fixes.

What are the limitations of these React performance rules?

Rules are prioritized by impact, so LOW-level JavaScript micro-optimizations only matter in hot paths. Some patterns involve trade-offs, such as Suspense causing layout shift, and localStorage caching requiring invalidation when storage changes externally.