next-best-practices — Claude Code skill: Next.js rules
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.
npx skills add pedronauck/skills --skill next-best-practices -a claude-codeWhat next-best-practices 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.
What it helps with
- catch an async client component before it breaks the build
- move a project to async
paramsandcookies()on Next.js 15+ - decide between a route handler and a Server Action
- kill a request waterfall with
Promise.alland Suspense - set up OG images and metadata without hand-written tags
Example prompts for the agent
- Check this component for RSC boundary violations and tell me what's wrong
- Rewrite this page for async
paramsandsearchParams - Why am I getting a hydration error in this component?
How to install next-best-practices
1Skills CLI (Vercel)
npx skills add pedronauck/skills --skill next-best-practices -a claude-code2Manually: put the files in place
~/.claude/skills/next-best-practices/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/next-best-practices/
1Skills CLI (Vercel)
npx skills add pedronauck/skills --skill next-best-practices -a codex2Manually: put the files in place
.agents/skills/next-best-practices/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add pedronauck/skills --skill next-best-practices -a cursor2Manually: put the files in place
.cursor/skills/next-best-practices/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install pedronauck/skills next-best-practices2Manually: put the files in place
.github/skills/next-best-practices/SKILL.md1Skills CLI (Vercel)
npx skills add pedronauck/skills --skill next-best-practices -a gemini-cli2Platform CLI
gemini skills install https://github.com/pedronauck/skills --path skills/curated/next-best-practicesManually: put the files in place
.devin/skills/next-best-practices/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add pedronauck/skills --skill next-best-practices -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about next-best-practices
How do I install next-best-practices in Claude Code?
Run npx skills add pedronauck/skills --skill next-best-practices -a claude-code. The skill file lands at ~/.claude/skills/next-best-practices/SKILL.md.
What does next-best-practices do?
It gives the agent rules for writing and reviewing Next.js code: file conventions, RSC boundaries, async APIs, metadata, error handling, image and font optimization, bundling.
Can I invoke this skill manually?
No. It is marked user-invocable: false, so it fires on its own when the agent is working with Next.js code.