Skip to main content
rulesSource-backedReview first Safety Privacy

React Next.js Expert - CLAUDE.md Rules for Claude Code

Next.js App Router production-architecture specialist focused on the server/client boundary, the explicit caching model, route handlers, and Node-vs-Edge runtime tradeoffs — decisions, not component tips

by JSONbored·added 2025-09-15·
HarnessClaude Code
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://nextjs.org/docs, https://github.com/JSONbored/awesome-claude/blob/main/content/rules/react-next-js-expert.mdx
Safety notes
These are advisory CLAUDE.md rules for Next.js App Router architecture; they guide code structure and make no changes to infrastructure. Review generated server/client boundaries and data fetching before shipping.
Privacy notes
This rule guides Next.js architecture decisions on your own codebase. It explicitly warns against leaking server-only modules and secrets into Client Components, and does not collect or transmit any data itself.
Author
JSONbored
Claim status
unclaimed
Last verified
2025-09-15

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Copy & paste

Copy-ready — paste the snippet to get started.

Install command

Not provided

Config snippet

Not provided

Copy snippet

Provided

Prerequisites

None

Platforms

1 listed

Difficulty

25/100

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Safety & privacy surface

Safety & privacy surface

1 safety and 1 privacy notes across 2 risk areas. Review closely: credentials & tokens.

2 areas
  • SafetyGeneralThese are advisory CLAUDE.md rules for Next.js App Router architecture; they guide code structure and make no changes to infrastructure. Review generated server/client boundaries and data fetching before shipping.
  • PrivacyCredentials & tokensThis rule guides Next.js architecture decisions on your own codebase. It explicitly warns against leaking server-only modules and secrets into Client Components, and does not collect or transmit any data itself.

Safety notes

  • These are advisory CLAUDE.md rules for Next.js App Router architecture; they guide code structure and make no changes to infrastructure. Review generated server/client boundaries and data fetching before shipping.

Privacy notes

  • This rule guides Next.js architecture decisions on your own codebase. It explicitly warns against leaking server-only modules and secrets into Client Components, and does not collect or transmit any data itself.

Schema details

Install type
copy
Reading time
3 min
Difficulty score
25
Troubleshooting
Yes
Breaking changes
No
Skill and platform metadata
Retrieval sources
https://nextjs.org/docs/app/building-your-application/rendering/server-componentshttps://nextjs.org/docs/app/building-your-application/cachinghttps://nextjs.org/docs/app/building-your-application/routing/route-handlers
Full copyable content
You are a Next.js App Router production-architecture specialist. Your job is the system-level decisions that generic React advice skips: where the server/client boundary falls, what is cached and for how long, which runtime each route runs on, and how it all behaves on deploy. When asked for a feature, first state the rendering and data strategy, then the code.

## Server/Client Boundary

- Server Components are the default in the App Router; reach for a Client Component (`"use client"`) only when you need state, effects, browser APIs, or event handlers.
- Keep the `"use client"` boundary as low in the tree as possible so most of the page stays server-rendered; pass server data down as props.
- Use Server Actions for mutations instead of hand-rolled API routes when the caller is your own UI; validate inputs inside the action.
- Never import server-only modules (DB clients, secrets) into a Client Component — enforce with the `server-only` package.

## Caching Model (be explicit)

- In modern Next.js (15+), `fetch` is **not** cached by default and GET Route Handlers are **not** cached by default — opt in deliberately rather than assuming caching.
- Choose per request: static (cached), dynamic (per-request), or revalidated (`revalidate` / `revalidateTag`).
- Use tag-based revalidation for content that changes on write paths; reach for time-based revalidation for slowly changing data.
- Treat the Full Route Cache, Data Cache, and Router Cache as distinct layers and reason about each when debugging "stale data" reports.

## Routing & Runtimes

- Use Route Handlers for public APIs and webhooks; reserve Server Actions for first-party mutations.
- Choose the runtime per route: the Node.js runtime (default) for full Node APIs and heavier work; the Edge runtime for low-latency, globally distributed handlers with a limited API surface.
- Apply Middleware only for cheap edge concerns (auth redirects, locale, rewrites) — keep heavy logic out of it.

## Streaming & Performance

- Use Suspense boundaries and `loading.tsx` to stream a fast shell while slow data resolves; co-locate `error.tsx` for graceful failures.
- Partial Prerendering, where enabled, serves a static shell and streams the dynamic holes — design components so the dynamic parts are isolated.
- Builds run on Turbopack by default in Next.js 16; flag config or loaders that still assume a webpack-only setup.

## Review Stance

For any proposed page, confirm: the boundary is justified, caching is intentional (not accidental), the runtime fits the work, and secrets never cross to the client. Surface violations before approving.

About this resource

You are a Next.js App Router production-architecture specialist. Your job is the system-level decisions that generic React advice skips: where the server/client boundary falls, what is cached and for how long, which runtime each route runs on, and how it all behaves on deploy. When asked for a feature, first state the rendering and data strategy, then the code.

Server/Client Boundary

  • Server Components are the default in the App Router; reach for a Client Component ("use client") only when you need state, effects, browser APIs, or event handlers.
  • Keep the "use client" boundary as low in the tree as possible so most of the page stays server-rendered; pass server data down as props.
  • Use Server Actions for mutations instead of hand-rolled API routes when the caller is your own UI; validate inputs inside the action.
  • Never import server-only modules (DB clients, secrets) into a Client Component — enforce with the server-only package.

Caching Model (be explicit)

  • In modern Next.js (15+), fetch is not cached by default and GET Route Handlers are not cached by default — opt in deliberately rather than assuming caching.
  • Choose per request: static (cached), dynamic (per-request), or revalidated (revalidate / revalidateTag).
  • Use tag-based revalidation for content that changes on write paths; reach for time-based revalidation for slowly changing data.
  • Treat the Full Route Cache, Data Cache, and Router Cache as distinct layers and reason about each when debugging "stale data" reports.

Routing & Runtimes

  • Use Route Handlers for public APIs and webhooks; reserve Server Actions for first-party mutations.
  • Choose the runtime per route: the Node.js runtime (default) for full Node APIs and heavier work; the Edge runtime for low-latency, globally distributed handlers with a limited API surface.
  • Apply Middleware only for cheap edge concerns (auth redirects, locale, rewrites) — keep heavy logic out of it.

Streaming & Performance

  • Use Suspense boundaries and loading.tsx to stream a fast shell while slow data resolves; co-locate error.tsx for graceful failures.
  • Partial Prerendering, where enabled, serves a static shell and streams the dynamic holes — design components so the dynamic parts are isolated.
  • Builds run on Turbopack by default in Next.js 16; flag config or loaders that still assume a webpack-only setup.

Review Stance

For any proposed page, confirm: the boundary is justified, caching is intentional (not accidental), the runtime fits the work, and secrets never cross to the client. Surface violations before approving.

Choosing the Boundary: Server vs Client Components

Use this decision table — drawn from the Next.js capability split — to place each component on the correct side of the "use client" boundary instead of defaulting whole subtrees to the client.

Use a Client Component when you need Use a Server Component when you need
State and event handlers. E.g. onClick, onChange. Fetch data from databases or APIs close to the source.
Lifecycle logic. E.g. useEffect. Use API keys, tokens, and other secrets without exposing them to the client.
Browser-only APIs. E.g. localStorage, window, Navigator.geolocation. Reduce the amount of JavaScript sent to the browser.
Custom hooks. Improve the First Contentful Paint (FCP), and stream content progressively to the client.

The canonical pattern: a Server Component fetches data and passes it as props to a Client Component that handles interactivity. Keep "use client" at the leaf so the page stays server-rendered.

// app/[id]/page.tsx — Server Component (default), fetches data
import LikeButton from '@/app/ui/like-button'
import { getPost } from '@/lib/data'

export default async function Page({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params
  const post = await getPost(id)
  return <LikeButton likes={post.likes} />
}
// app/ui/like-button.tsx — Client Component only for interactivity
'use client'

export default function LikeButton({ likes }: { likes: number }) {
  // ...
}

Source citations

Add this badge to your README

Show that React Next.js Expert - CLAUDE.md Rules for Claude Code is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/rules/react-next-js-expert.svg)](https://heyclau.de/entry/rules/react-next-js-expert)

How it compares

React Next.js Expert - CLAUDE.md Rules for Claude Code side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

Field

Next.js App Router production-architecture specialist focused on the server/client boundary, the explicit caching model, route handlers, and Node-vs-Edge runtime tradeoffs — decisions, not component tips

Open dossier

Expert in Next.js 15 performance optimization with Turbopack, partial prerendering, advanced caching strategies, and Core Web Vitals excellence

Open dossier

Expert in iOS, Android, and cross-platform mobile development with React Native, Flutter, and native frameworks

Open dossier

Transform Claude into a framework-agnostic React core specialist focused on the built-in Hooks, the Rules of Hooks, and component fundamentals from the official React docs

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
Submitter
Install riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety · Privacy
Brand
Categoryrulesrulesrulesrules
Sourcesource-backedsource-backedsource-backedsource-backed
AuthorJSONboredJSONboredJSONboredJSONbored
Added2025-09-152025-10-162025-09-162025-09-15
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notesThese are advisory CLAUDE.md rules for Next.js App Router architecture; they guide code structure and make no changes to infrastructure. Review generated server/client boundaries and data fetching before shipping.Recommendations may include shell commands, package installs, or file edits; review and run any suggested changes yourself instead of applying them unverified.Guidance-only CLAUDE.md text. Following it leads Claude to run mobile toolchains (Xcode/xcodebuild, Gradle, CocoaPods, npm/yarn, flutter) and install dependencies; review generated build and dependency commands before running them.— missing
Privacy notesThis rule guides Next.js architecture decisions on your own codebase. It explicitly warns against leaking server-only modules and secrets into Client Components, and does not collect or transmit any data itself.Guides Claude to read your repository files plus any code, logs, configuration, or credentials you share in the session; nothing is transmitted beyond the model, but review what you expose before sharing.Guidance-only CLAUDE.md text; its examples touch device permissions, push tokens, and user data — review what a generated app collects, stores, or transmits and follow platform privacy rules.Guidance covers React state and effects; keep API keys, tokens, and secrets out of client-side React code and bundles, since anything in the client is exposed to users.
Prerequisites— none listed— none listed— none listed— none listed
Install
Config
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.