Skip to content

laguagu/claude-code-nextjs-skills / skills/next-best-practices

next-best-practices

Verified

Next.js App Router best practices covering file conventions, RSC boundaries, async APIs, data patterns, hydration errors, metadata, route handlers, image/font optimization, and bundling. Use when writing or reviewing Next.js code to prevent hydration errors, RSC violations, data waterfalls, and configuration mistakes.

FileKindSize
SKILL.mdskill md6.5 KB
async-patterns.mdmarkdown788 B
bundling.mdmarkdown1.4 KB
data-patterns.mdmarkdown1.3 KB
debug-tricks.mdmarkdown872 B
directives.mdmarkdown785 B
error-handling.mdmarkdown1.4 KB
file-conventions.mdmarkdown1.1 KB
font.mdmarkdown821 B
functions.mdmarkdown911 B
hydration-error.mdmarkdown1.2 KB
image.mdmarkdown1.1 KB
metadata.mdmarkdown1.2 KB
parallel-routes.mdmarkdown1.1 KB
route-handlers.mdmarkdown1.2 KB
rsc-boundaries.mdmarkdown1.1 KB
runtime-selection.mdmarkdown849 B
scripts.mdmarkdown788 B
self-hosting.mdmarkdown1.7 KB
suspense-boundaries.mdmarkdown1.1 KB

hydration-error.md

View on GitHub
# Hydration diagnosis

Compare the initial server HTML and client render. Inspect the overlay/console
and the actual DOM; a recovered subtree can look usable while still reporting
a mismatch.

Common causes are browser storage during initial render, differing locale/time,
unstable random values, invalid nesting, and scripts/extensions mutating HTML.
On a prerendered page reached through a rewrite or Proxy, `usePathname()` can
read a different pathname on the client and cause a mismatch. Keep that
pathname-dependent UI small and give it a stable server fallback.
Resolve the specific mismatch through stable server/client data or a deliberate
client-only display boundary.

Do not make the whole route client-only or suppress warnings as a generic
repair. For browser-derived state, a mount gate or, with React 19.3 (vendored by
the App Router from Next.js 16.4), `use(browser())` under a Suspense boundary can
be appropriate; see the installed `02-guides/single-page-applications.md`. Either
way the server HTML holds only the fallback, so keep indexable content outside it
and check initial content/layout.

Read [hydration error guidance](https://nextjs.org/docs/messages/react-hydration-error).
Verify both direct production load and in-app navigation.
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall