react-best-practices

Applies 57 performance optimization rules to React and Next.js code.

Updated Jun 14, 2026
One-click install
npx skills add https://github.com/ironkid90-s/lucky5-v7 --skill react-best-practices-ironkid90-s
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/ironkid90-s/lucky5-v7/tree/main/.ptah/skills/react-best-practices
Command: npx skills add https://github.com/ironkid90-s/lucky5-v7 --skill react-best-practices-ironkid90-s

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React and Next.js applications often suffer from slow load times, unnecessary re-renders, bloated bundles, and async waterfalls that degrade user experience. This Skill provides a structured, prioritized rule set so AI agents and developers can systematically identify and fix performance issues during code generation, review, and refactoring. ## 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 micro-optimizations, and advanced patterns, each tagged with an impact level from CRITICAL to LOW. - 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 or 200-800ms import cost reductions. - Use Case: When reviewing a Next.js page that fetches user, posts, and comments sequentially, apply the async-parallel rule to rewrite the fetches with Promise.all(), cutting three network round trips down to one. ## Quick Start Ask the AI to review your React component or Next.js page for performance issues using the react-best-practices guidelines and apply the highest-impact fixes first.

Frequently Asked Questions about 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?

Import directly from source files instead of barrel entry points, for example 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 when data must persist across sequential requests, such as repeated user actions hitting multiple endpoints.

Does this guide cover Next.js Server Actions security?

Yes, the server-auth-actions rule requires authenticating and authorizing inside every Server Action, treating them as public endpoints. It also recommends validating input with schemas like zod before performing mutations.

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 states harms the user experience.