- No raw strings in JSX. Every user-visible string must use
t()from next-intl. No hardcoded text. - No oversized files. Components: 150 lines max. Pages: 300 lines max. Extract to
_components/orfeatures/if larger. - No page without
generateMetadata+ OG. Every page exportsgenerateMetadatawith title, description, OG image, hreflang alternates. - No inline fetch. All data fetching goes through
src/lib/api/client. Never callfetch()directly. Never use an ORM. - No
'use client'on pages or layouts. Only leaf components incomponents/ui/,components/features/, or_components/may be client components. - All params/searchParams/cookies/headers are async. Always
await params,await searchParams,await cookies(),await headers(). Sync access is removed in v16.
Next.js 16 App Router
MANDATORY FIRST RESPONSE PROTOCOL
Before writing ANY code, you MUST complete this checklist:
- Read
references/stack.mdto understand locked decisions (runtime, bundler, config) - Identify the task type from the routing table below
- Read the matching reference file(s) — they contain the patterns, code examples, and anti-patterns
- Only then begin implementation
Writing code without reading the reference = wrong patterns, wasted time, rework.
Routing Table
| Task | Read |
|---|---|
| Starting a session / understanding the stack | references/stack.md |
| Creating or modifying files, folder conventions | references/folder-structure.md |
| Navigation, dynamic routes, proxy.ts, parallel routes | references/routing.md |
| Creating a new page or layout | references/page-checklist.md |
| Creating or editing a component | references/component-anatomy.md |
| Adding data fetching (reads) | references/api-client-pattern.md |
| Adding mutations (writes), forms | references/server-actions.md |
| Making caching decisions | references/caching-strategy.md |
| Adding/editing user-facing text, translations, or RTL | references/i18n-conventions.md |
| Error boundaries, recovery, not-found | references/error-handling.md |
| Structured logging, log levels, PII rules | references/logging.md |
| Analytics events, provider adapters | references/tracking.md |
| Unit tests (Vitest) | references/testing-unit.md |
| End-to-end tests (Playwright) | references/testing-e2e.md |
| Authentication, sessions, protected routes | references/auth.md |
| Security hardening, CSP, headers, XSS prevention | references/security.md |
| SEO, OG tags, structured data, sitemaps | references/seo.md |
| Accessibility (ARIA, keyboard, focus, reduced motion) | references/accessibility.md |
| Markdown mirrors, llms.txt, machine-readable content | references/machine-readable.md |
Multiple tasks? Read multiple files. The references are self-contained — no need to consult external docs.
Quick Rules
These repeat the critical guardrails for context-window resilience:
- All
params,searchParams,cookies(),headers()are async — alwaysawait. - All data fetching goes through the API client — never inline fetch, never ORM.
- All visible strings use
t()— no hardcoded text. - All Tailwind uses logical properties —
ps-,pe-,ms-,me-,text-start,text-end. cacheComponents: truerequired innext.config.tsfor'use cache'to work.