vercel-react-best-practices

Optimize React and Next.js performance with parallel async and caching patterns.

30|2|Updated Mar 3, 2022
One-click install
npx skills add https://github.com/lie5860/ak-guess --skill vercel-react-best-practices-lie5860
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-react-best-practices
Source: https://github.com/lie5860/ak-guess/tree/main/.agents/skills/react-best-practices
Command: npx skills add https://github.com/lie5860/ak-guess --skill vercel-react-best-practices-lie5860

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps identify and eliminate common performance pitfalls in React and Next.js projects, such as server-side waterfalls, oversized bundles, inefficient data fetching, and excessive client serialization, enabling faster initial paint and lower Time to Interactive.

Core Features & Use Cases

  • Eliminate Waterfalls: Patterns and examples to start independent async work early and use Promise.all / better-all for parallelization.
  • Bundle Size Optimization: Recommendations for avoiding barrel imports, deferring non-critical libraries, dynamic imports, and intent-based preloading.
  • Server & Rendering Best Practices: Guidance on hoisting static I/O to module level, per-request and cross-request caching strategies, minimizing RSC serialization, and using Suspense boundaries.
  • Use Case: Use these rules to review a Next.js app, reduce cold-start times, and produce prioritized refactors for API routes, server actions, and client components.

Quick Start

Ask the skill to analyze a React/Next.js page or API route and produce prioritized refactor suggestions to eliminate waterfalls and reduce bundle size.

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 fix server-side data fetching waterfalls in Next.js?

Eliminate Next.js data fetching waterfalls by starting independent async work early and using Promise.all or better-all for parallelization. This pattern prevents sequential blocking, allowing multiple requests to resolve concurrently and improving initial paint performance.

What is the best way to reduce React bundle size caused by barrel imports?

Reduce React bundle size by avoiding barrel imports, deferring non-critical libraries, and using dynamic imports. Intent-based preloading further ensures that only necessary code is shipped to the client, lowering Time to Interactive.

How does React.cache improve cross-request rendering performance?

React.cache improves cross-request rendering performance by memoizing expensive data fetches and computations. Combined with LRU caching strategies and module-level I/O hoisting, it prevents redundant work during server rendering and minimizes overhead.

Can I use dynamic imports to optimize client components in React?

Yes, you can optimize React client components using dynamic and conditional imports. This defers loading non-critical libraries until they are needed, directly reducing the initial bundle size and improving the application's Time to Interactive.