# /react-best-practices: React and Next.js performance rules

Source: https://trendhub.net/skills/vercel-labs-agent-skills/react-best-practices
Skill folder: https://github.com/vercel-labs/agent-skills/tree/main/skills/react-best-practices
Pack: Vercel Agent Skills (https://trendhub.net/skills/vercel-labs-agent-skills)
Works with: Agent Skills-compatible agents

This skill gives an agent Vercel's catalog of React and Next.js performance rules, grouped into eight categories and ordered by impact. Request waterfalls and bundle size come first, micro-optimizations last. Each rule has its own file with an incorrect and a corrected code example, so the agent can apply or explain a specific fix.

## When to use it

- Writing a new React component or Next.js page
- Reviewing a pull request for performance regressions
- Reducing bundle size or slow page loads in an existing app

## How it works

1. **Match the task to a category**: The agent checks which of the eight rule groups, such as async, bundle or rerender, applies to the code at hand.
2. **Start with high-impact rules**: Critical categories like eliminating waterfalls and bundle optimization are considered before lower-priority JavaScript tweaks.
3. **Open the specific rule file**: For each relevant rule the agent reads its file under rules/ to see the wrong pattern and the preferred one.
4. **Apply or report the fix**: The agent rewrites the code or explains the change, citing the rule name.

## What it steers the agent away from

- Sequential awaits that could run in parallel
- Barrel imports and heavy modules that inflate the client bundle
- Unnecessary re-renders from unstable dependencies or components defined inside components

## What it can touch

Reference material only: Markdown rule files and a compiled AGENTS.md. It runs no scripts; any code changes are made by the agent in your project files.

## Pairs well with

- `/composition-patterns`
- `/react-view-transitions`
- `/vercel-optimize`
- `/web-design-guidelines`

## Questions

### Does it only apply to Next.js?

No. Many rules cover plain React and general JavaScript, while some, such as server actions and dynamic imports, are specific to Next.js.

### Can the agent read all rules at once?

Yes. Besides the per-rule files, the skill ships a compiled AGENTS.md with every rule expanded.
