# next-best-practices

A skill that hands your agent a set of Next.js rules: file conventions, RSC boundaries, async APIs, metadata, error handling. Useful whenever it writes or reviews Next.js code.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 383 installs · ★ 643
- Author: pedronauck
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/pedronauck/skills/tree/HEAD/skills/curated/next-best-practices/SKILL.md
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/skills/next-best-practices

## What it does

The skill kicks in while the agent writes or reviews Next.js code, and tells it what the framework expects. It ships as a bundle of reference files. One covers project layout and the special files, plus dynamic, catch-all and grouped route segments, parallel and intercepting routes, and the middleware rename in v16.

Another set deals with React Server Components: spotting an async client component, non-serializable props, exceptions thrown from Server Actions. Async patterns for Next.js 15+ get their own file — `params`, `searchParams`, `cookies()` and `headers()` are all async now, and a codemod handles the migration. Runtime choice is short: Node.js unless Edge actually fits.

Error handling has a file of its own (`error.tsx`, `global-error.tsx`, `not-found.tsx`, `redirect`, `notFound`, `forbidden`, `unauthorized`). Data patterns explain when to reach for a Server Component, a Server Action or a route handler, and how to avoid waterfalls with `Promise.all` and Suspense. The rest covers metadata and OG images through `next/og`, `next/image` and `next/font`, bundling, scripts, hydration errors, Suspense boundaries, and self-hosting with `output: 'standalone'`. You do not invoke it yourself — it is marked `user-invocable: false` and loads on its own when the context fits.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill next-best-practices -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/next-best-practices/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/next-best-practices/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill next-best-practices -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/next-best-practices/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill next-best-practices -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/next-best-practices/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install pedronauck/skills next-best-practices
```

2. **Manually: put the files in place**
- File: `.github/skills/next-best-practices/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill next-best-practices -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/pedronauck/skills --path skills/curated/next-best-practices
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/next-best-practices/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill next-best-practices -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/pedronauck/skills/tree/HEAD/skills/curated/next-best-practices/SKILL.md

## When to use it
- catch an async client component before it breaks the build
- move a project to async `params` and `cookies()` on Next.js 15+
- decide between a route handler and a Server Action
- kill a request waterfall with `Promise.all` and Suspense
- set up OG images and metadata without hand-written tags

## Example prompts
- Check this component for RSC boundary violations and tell me what's wrong
- Rewrite this page for async `params` and `searchParams`
- Why am I getting a hydration error in this component?

## Similar
- [frontend-design](https://affpapa.org/en/nevibecode/skills/frontend-design.md) — skill · 1025790 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs
- [hyperframes](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes.md) — skill · 1200000 installs
- [hyperframes-cli](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes-cli.md) — skill · 1300000 installs
- [webapp-testing](https://affpapa.org/en/nevibecode/skills/webapp-testing.md) — skill · 186758 installs

From the same set: [pedronauck/skills](https://affpapa.org/en/nevibecode/by/pedronauck/skills.md) — 18 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
