Skip to content
Back to skills

React Best Practices

ASecurity

React and Next.js performance guidelines from Vercel Engineering. Use when writing, reviewing, or refactoring React components, hooks, client data fetching, rendering behavior, bundle imports, async request flows, or Next.js pages and server code.

  • 94 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 24, 2026
developmentjavascriptgojavareactnextjsexpressrefactoringgitperformance

Works with

  • cli

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned September 24, 2026

npx -y skills add mxyhi/token_proxy --skill react-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Best Practices?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mxyhi-react-best-practices/badge)](https://www.skillsdirectory.com/skills/mxyhi-react-best-practices)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: react-best-practices
description: React and Next.js performance guidelines from Vercel Engineering. Use when writing, reviewing, or refactoring React components, hooks, client data fetching, rendering behavior, bundle imports, async request flows, or Next.js pages and server code.
license: MIT
metadata:
  source: "https://github.com/vercel-labs/agent-skills/tree/main/skills/react-best-practices"
  source_commit: "180115660cfb8a86b808f117475a01f54caf3bc5"
  upstream_name: "vercel-react-best-practices"
  version: "1.0.0"
---

# React Best Practices

Use this skill to apply Vercel Engineering's React and Next.js performance rules without loading the full 70-rule guide up front.

For this repository, treat React 19 + Vite + Tauri as the default app context. Next.js, RSC, and server-action rules apply only when editing Next.js code or reference projects.

## Workflow

1. Classify the task by performance surface.
2. Read only the matching rule files under `references/rules`.
3. Apply the smallest code change that matches the rule and the local code style.
4. Verify with the nearest test, typecheck, build, or browser check.

Do not apply rules mechanically. Prefer evidence from the current component, data flow, and user interaction path.

## Rule Groups

Read `references/rules/_sections.md` when you need the category index.

| Priority | Group | Read When |
| --- | --- | --- |
| 1 | `async-*` | Removing async waterfalls, parallelizing independent work, delaying awaits until needed |
| 2 | `bundle-*` | Reducing client bundle cost, dynamic imports, direct imports, third-party loading |
| 3 | `server-*` | Next.js server code, RSC serialization, server caching, server fetch parallelism |
| 4 | `client-*` | Client data fetching, SWR-style dedupe, browser storage, global event listeners |
| 5 | `rerender-*` | Hooks, props, memoization, derived state, callback stability, frequent updates |
| 6 | `rendering-*` | DOM/rendering cost, hydration behavior, content visibility, script/resource hints |
| 7 | `js-*` | Hot JavaScript paths, repeated lookups, loops, storage reads, layout thrashing |
| 8 | `advanced-*` | Effect events, latest refs, app initialization, stable callback refs |

## High-Signal Defaults

- Start with `async-*` and `bundle-*` when performance problems are broad or user-visible.
- For React component changes, check `rerender-derived-state-no-effect.md`, `rerender-move-effect-to-event.md`, and `rerender-no-inline-components.md` early.
- Use event handlers for user actions. Use `useEffect` only to synchronize with external systems.
- Avoid adding `useMemo` or `memo` for cheap primitive calculations. Read `rerender-simple-expression-in-memo.md` first.
- For lists and repeated lookups, check `js-index-maps.md`, `js-set-map-lookups.md`, and `rendering-content-visibility.md`.
- For this Tauri/Vite app, skip Next.js-only fixes unless the edited file is in a Next.js reference or the user asks for Next.js guidance.

## Source Layout

Detailed rules are copied from Vercel's `agent-skills` repository into:

```text
references/rules/<rule-name>.md
```

Each rule file contains rationale, incorrect examples, correct examples, and caveats. Load the specific rule file before making a non-trivial React performance change.

Files in this skill

  • SKILL.md3.2 KB
  • agents/openai.yaml202 B
  • references/rules/_sections.md1.5 KB
  • references/rules/advanced-effect-event-deps.md1.8 KB
  • references/rules/advanced-event-handler-refs.md1.4 KB
  • references/rules/advanced-init-once.md958 B
  • references/rules/advanced-use-latest.md1 KB
  • references/rules/async-api-routes.md1.1 KB
  • references/rules/async-cheap-condition-before-await.md1.2 KB
  • references/rules/async-defer-await.md2.1 KB
  • references/rules/async-dependencies.md1.3 KB
  • references/rules/async-parallel.md654 B
  • references/rules/async-suspense-boundaries.md2.4 KB
  • references/rules/bundle-analyzable-paths.md2.3 KB
  • references/rules/bundle-barrel-imports.md2.7 KB
  • references/rules/bundle-conditional.md949 B
  • references/rules/bundle-defer-third-party.md920 B
  • references/rules/bundle-dynamic-imports.md791 B
  • references/rules/bundle-preload.md1.1 KB
  • references/rules/client-event-listeners.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.