NEW Browse AI tools across categories — updated daily. See what's new →

Vercel React Best Practices

Use when writing, reviewing, or refactoring React or Next.js code, optimizing React performance, fixing re-render issues, reducing bundle size, eliminating waterfalls, or improving data fetching pa...

Version1.0.0
LicenseMIT
Token count~1,661
UpdatedJun 5, 2026

Install

Quick install

via npx skills · works with 57+ agents
npx skills add https://github.com/carmentacollective/carmenta
Or pick agent:
npx skills add carmentacollective/carmenta --agent claude-code
npx skills add carmentacollective/carmenta --agent cursor
npx skills add carmentacollective/carmenta --agent codex
npx skills add carmentacollective/carmenta --agent opencode
npx skills add carmentacollective/carmenta --agent github-copilot
npx skills add carmentacollective/carmenta --agent windsurf
More install options

Shorthand — useful for multi-skill repos:

npx skills add carmentacollective/carmenta

Manual — clone the repo and drop the folder into your agent's skills directory:

git clone https://github.com/carmentacollective/carmenta.git
cp -r carmenta ~/.claude/skills/
How to use: Once installed, ask your agent to "use the Vercel React Best Practices skill" or describe what you want (e.g. "Use when writing, reviewing, or refactoring React or Next.js code, optimizing Re"). Requires Node.js 18+.

Vercel React Best Practices

Use when writing, reviewing, or refactoring React or Next.js code, optimizing React performance, fixing re-render issues, reducing bundle size, eliminating waterfalls, or improving data fetching patterns

---
name: vercel-react-best-practices

prettier-ignore


description: "Use when writing, reviewing, or refactoring React or Next.js code, optimizing React performance, fixing re-render issues, reducing bundle size, eliminating waterfalls, or improving data fetching patterns"
version: 1.0.0
category: frontend
triggers:

  • "react"

  • "next.js"

  • "nextjs"

  • "react performance"

  • "bundle size"

  • "re-render"

  • "waterfall"

  • "server component"

  • "client component"

  • "suspense"

  • "data fetching"

  • "useMemo"

  • "useCallback"

  • "dynamic import"


source: vercel-labs/agent-skills
license: MIT
---

<objective>
React and Next.js performance optimization guidelines from Vercel Engineering. 57 rules
across 8 categories, prioritized by impact. Reference when writing, reviewing, or
refactoring React/Next.js code.
</objective>

<when-to-apply>


  • Writing new React components or Next.js pages

  • Implementing data fetching (client or server-side)

  • Reviewing code for performance issues

  • Refactoring existing React/Next.js code

  • Optimizing bundle size or load times


</when-to-apply>

<rules-by-priority>

1. Eliminating Waterfalls — CRITICAL

  • Defer await until needed — Move await into branches where actually used
  • Parallelize independent operations — Use Promise.all() instead of sequential
awaits
  • Dependency-based parallelization — Use better-all for partial dependencies
  • Start promises early in API routes — Start independent operations before awaiting
  • Strategic Suspense boundaries — Use Suspense to stream content progressively

2. Bundle Size Optimization — CRITICAL

  • Avoid barrel file imports — Import directly from source files; barrels add
200-800ms
  • Dynamic imports for heavy components — Use next/dynamic for large components
  • Defer non-critical third-party libs — Load analytics/logging after hydration
  • Conditional module loading — Load modules only when feature is activated
  • Preload on user intent — Preload heavy bundles on hover/focus

3. Server-Side Performance — HIGH

  • Authenticate server actions — Verify auth inside each Server Action, not just
middleware
  • React.cache() for request dedup — Per-request deduplication on the server
  • LRU cache for cross-request data — Share cached data across sequential requests
  • Minimize RSC serialization — Only pass fields the client actually uses
  • Parallel data fetching — Restructure components to parallelize server fetches
  • after() for non-blocking work — Schedule logging/analytics after response is sent

4. Client-Side Data Fetching — MEDIUM-HIGH

  • SWR for deduplication — Automatic request dedup, caching, and revalidation
  • Deduplicate global event listeners — Share listeners across component instances
  • Passive event listeners for scroll — Add { passive: true } to touch/wheel
  • Version localStorage data — Add version prefix, store only needed fields

5. Re-render Optimization — MEDIUM

  • Derive state during render — Compute from props/state instead of storing in state
  • Defer state reads — Don't subscribe to state only used in callbacks
  • Extract to memoized components — Extract expensive work for early returns
  • Hoist default non-primitive props — Use stable defaults for memoized components
  • Primitive effect dependencies — Specify primitives, not objects
  • Subscribe to derived booleans — Not continuous raw values
  • Functional setState — Use functional form to prevent stale closures
  • Lazy state initialization — Pass function to useState for expensive values
  • Skip useMemo for simple expressions — Overhead exceeds simple primitive
expressions
  • Event handlers over effects — Put interaction logic in handlers, not state+effect
  • useTransition for non-urgent updates — Mark frequent updates as transitions
  • useRef for transient values — Store frequently-changing non-rendering values in
refs

6. Rendering Performance — MEDIUM

  • Animate div wrapper, not SVG — Wrap SVG in div for hardware-accelerated animation
  • content-visibility for long lists — Defer off-screen rendering
  • Hoist static JSX — Extract static JSX outside components
  • Reduce SVG precision — Use SVGO with --precision=1
  • Inline script for hydration — Prevent flicker with pre-hydration DOM updates
  • suppressHydrationWarning — For intentional server/client differences
  • Activity component for show/hide — Preserve state/DOM for expensive components
  • Ternary over && — Prevent rendering falsy values like 0
  • useTransition over manual loading states — Replace useState loading patterns

7. JavaScript Performance — LOW-MEDIUM

  • Batch DOM/CSS writes — Group changes via classes or cssText
  • Build index Maps — Convert arrays to Maps for O(1) lookups
  • Cache property access in loops — Cache deep lookups outside loops
  • Cache function results — Module-level Maps for memoization
  • Cache storage API calls — localStorage/sessionStorage reads are synchronous
  • Combine array iterations — Single loop instead of chained filter/map
  • Length check before comparison — Check array lengths first
  • Early return — Return immediately when result is determined
  • Hoist RegExp — Don't create RegExp inside render
  • Loop for min/max — O(n) pass instead of O(n log n) sort
  • Set/Map for lookups — O(1) membership checks
  • toSorted() for immutability — Avoid mutation bugs

8. Advanced Patterns — LOW

  • Initialize once per app — Module-level guards prevent re-initialization
  • Store event handlers in refs — Stable subscriptions without re-runs
  • useEffectEvent — Access latest values without dependency array changes

</rules-by-priority>

<key-takeaways>


  1. Waterfalls are the #1 killer — eliminating sequential awaits provides the largest gains

  2. Bundle size matters — barrel imports can cost 200-800ms per library

  3. Parallelize RSC fetching and minimize serialization

  4. Deduplicate with React.cache(), SWR, and request batching

  5. Use Suspense boundaries, memoization, and transitions strategically

  6. Prefer toSorted(), functional setState, and derived state for immutability


</key-takeaways>

---

Source: https://github.com/carmentacollective/carmenta
Author: carmentacollective
Discovered via: skillsdirectory.com
Genre: ai-agents

SKILL.md source

---
name: Vercel React Best Practices
description: Use when writing, reviewing, or refactoring React or Next.js code, optimizing React performance, fixing re-render issues, reducing bundle size, eliminating waterfalls, or improving data fetching pa...
---

# Vercel React Best Practices

Use when writing, reviewing, or refactoring React or Next.js code, optimizing React performance, fixing re-render issues, reducing bundle size, eliminating waterfalls, or improving data fetching patterns

---
name: vercel-react-best-practices
# prettier-ignore
description: "Use when writing, reviewing, or refactoring React or Next.js code, optimizing React performance, fixing re-render issues, reducing bundle size, eliminating waterfalls, or improving data fetching patterns"
version: 1.0.0
category: frontend
triggers:
  - "react"
  - "next.js"
  - "nextjs"
  - "react performance"
  - "bundle size"
  - "re-render"
  - "waterfall"
  - "server component"
  - "client component"
  - "suspense"
  - "data fetching"
  - "useMemo"
  - "useCallback"
  - "dynamic import"
source: vercel-labs/agent-skills
license: MIT
---

<objective>
React and Next.js performance optimization guidelines from Vercel Engineering. 57 rules
across 8 categories, prioritized by impact. Reference when writing, reviewing, or
refactoring React/Next.js code.
</objective>

<when-to-apply>
- Writing new React components or Next.js pages
- Implementing data fetching (client or server-side)
- Reviewing code for performance issues
- Refactoring existing React/Next.js code
- Optimizing bundle size or load times
</when-to-apply>

<rules-by-priority>

## 1. Eliminating Waterfalls — CRITICAL

- **Defer await until needed** — Move await into branches where actually used
- **Parallelize independent operations** — Use Promise.all() instead of sequential
  awaits
- **Dependency-based parallelization** — Use better-all for partial dependencies
- **Start promises early in API routes** — Start independent operations before awaiting
- **Strategic Suspense boundaries** — Use Suspense to stream content progressively

## 2. Bundle Size Optimization — CRITICAL

- **Avoid barrel file imports** — Import directly from source files; barrels add
  200-800ms
- **Dynamic imports for heavy components** — Use next/dynamic for large components
- **Defer non-critical third-party libs** — Load analytics/logging after hydration
- **Conditional module loading** — Load modules only when feature is activated
- **Preload on user intent** — Preload heavy bundles on hover/focus

## 3. Server-Side Performance — HIGH

- **Authenticate server actions** — Verify auth inside each Server Action, not just
  middleware
- **React.cache() for request dedup** — Per-request deduplication on the server
- **LRU cache for cross-request data** — Share cached data across sequential requests
- **Minimize RSC serialization** — Only pass fields the client actually uses
- **Parallel data fetching** — Restructure components to parallelize server fetches
- **after() for non-blocking work** — Schedule logging/analytics after response is sent

## 4. Client-Side Data Fetching — MEDIUM-HIGH

- **SWR for deduplication** — Automatic request dedup, caching, and revalidation
- **Deduplicate global event listeners** — Share listeners across component instances
- **Passive event listeners for scroll** — Add `{ passive: true }` to touch/wheel
- **Version localStorage data** — Add version prefix, store only needed fields

## 5. Re-render Optimization — MEDIUM

- **Derive state during render** — Compute from props/state instead of storing in state
- **Defer state reads** — Don't subscribe to state only used in callbacks
- **Extract to memoized components** — Extract expensive work for early returns
- **Hoist default non-primitive props** — Use stable defaults for memoized components
- **Primitive effect dependencies** — Specify primitives, not objects
- **Subscribe to derived booleans** — Not continuous raw values
- **Functional setState** — Use functional form to prevent stale closures
- **Lazy state initialization** — Pass function to useState for expensive values
- **Skip useMemo for simple expressions** — Overhead exceeds simple primitive
  expressions
- **Event handlers over effects** — Put interaction logic in handlers, not state+effect
- **useTransition for non-urgent updates** — Mark frequent updates as transitions
- **useRef for transient values** — Store frequently-changing non-rendering values in
  refs

## 6. Rendering Performance — MEDIUM

- **Animate div wrapper, not SVG** — Wrap SVG in div for hardware-accelerated animation
- **content-visibility for long lists** — Defer off-screen rendering
- **Hoist static JSX** — Extract static JSX outside components
- **Reduce SVG precision** — Use SVGO with `--precision=1`
- **Inline script for hydration** — Prevent flicker with pre-hydration DOM updates
- **suppressHydrationWarning** — For intentional server/client differences
- **Activity component for show/hide** — Preserve state/DOM for expensive components
- **Ternary over &&** — Prevent rendering falsy values like 0
- **useTransition over manual loading states** — Replace useState loading patterns

## 7. JavaScript Performance — LOW-MEDIUM

- **Batch DOM/CSS writes** — Group changes via classes or cssText
- **Build index Maps** — Convert arrays to Maps for O(1) lookups
- **Cache property access in loops** — Cache deep lookups outside loops
- **Cache function results** — Module-level Maps for memoization
- **Cache storage API calls** — localStorage/sessionStorage reads are synchronous
- **Combine array iterations** — Single loop instead of chained filter/map
- **Length check before comparison** — Check array lengths first
- **Early return** — Return immediately when result is determined
- **Hoist RegExp** — Don't create RegExp inside render
- **Loop for min/max** — O(n) pass instead of O(n log n) sort
- **Set/Map for lookups** — O(1) membership checks
- **toSorted() for immutability** — Avoid mutation bugs

## 8. Advanced Patterns — LOW

- **Initialize once per app** — Module-level guards prevent re-initialization
- **Store event handlers in refs** — Stable subscriptions without re-runs
- **useEffectEvent** — Access latest values without dependency array changes

</rules-by-priority>

<key-takeaways>
1. Waterfalls are the #1 killer — eliminating sequential awaits provides the largest gains
2. Bundle size matters — barrel imports can cost 200-800ms per library
3. Parallelize RSC fetching and minimize serialization
4. Deduplicate with React.cache(), SWR, and request batching
5. Use Suspense boundaries, memoization, and transitions strategically
6. Prefer toSorted(), functional setState, and derived state for immutability
</key-takeaways>


---

**Source**: https://github.com/carmentacollective/carmenta
**Author**: carmentacollective
**Discovered via**: skillsdirectory.com
**Genre**: ai-agents

Related skills 6

running-claude-code-via-litellm-copilot

★ Featured

Use when routing Claude Code through a local LiteLLM proxy to GitHub Copilot, reducing direct Anthropic spend, configuring ANTHROPIC_BASE_URL or ANTHROPIC_MODEL overrides, or troubleshooting Copilot proxy setup failures such as model-not-found, no localhost traffic, or GitHub 401/403 auth errors.

xixu-me 155k
AI & ML

skills-cli

★ Featured

Use when users ask to discover, install, list, check, update, remove, back up, restore, sync, or initialize Agent Skills, mention `bunx skills`, `npx skills`, `skills.sh`, or `skills-lock.json`, ask "find a skill for X", or want help extending agent capabilities with installable skills.

xixu-me 155k
AI & ML

repo-intake-and-plan

★ Featured

Narrow RigorPilot helper for README-first deep learning repo reproduction. Use when the task is specifically to scan a repository, read the README and common project files, extract documented commands, classify inference, evaluation, and training candidates, and return the smallest trustworthy reproduction plan to the main orchestrator. Do not use for environment setup, asset download, command execution, final reporting, paper lookup, or end-to-end orchestration.

lllllllama 127k
AI & ML

image-to-video

★ Featured

Animate any still image on RunComfy — this skill is a smart router that matches the user's intent to the right i2v model in the RunComfy catalog. Picks HappyHorse 1.0 I2V (Arena #1, native audio, identity preservation) for general animations, Wan 2.7 with `audio_url` for custom-voiceover lip-sync, or Seedance 2.0 Pro for multi-modal animation from image + reference video + reference audio. Bundles each model's documented prompting patterns so the caller gets sharper output without burning ite...

agentspace-so 121k
AI & ML

video-edit

★ Featured

Edit existing video on RunComfy — this skill is a smart router that matches the user's intent to the right edit model in the RunComfy catalog. Picks Wan 2.7 Edit-Video (general restyle / background swap / packaging swap, identity + motion preservation), Kling 2.6 Pro Motion Control (transfer precise motion from a reference video to a target character), or Lucy Edit Restyle (lightweight identity-stable restyle / outfit swap). Bundles each model's documented prompting patterns so the skill gets...

agentspace-so 121k
AI & ML

nano-banana-2

★ Featured

Generate images with Google Nano Banana 2 (Gemini-family flash-tier text-to-image) on RunComfy — bundled with the model's documented prompting patterns so the skill gets sharper output than naive prompting against the same model. Documents Nano Banana 2's strengths (rapid iteration, in-image typography rendering, predictable framing, optional web-grounded context), the resolution-tier pricing, the safety-tolerance dial, and when to route to Nano Banana Pro / GPT Image 2 / Flux 2 / Seedream in...

agentspace-so 121k
AI & ML