Every page.tsx MUST have HydrationBoundary - Without it, streaming breaks and loading.tsx won't animate. Readreferences/templates.md for the correct pattern.
Client components return skeleton, never null - On hard refresh, !data must show a skeleton, not null (which causes flash).
Query pattern: keys.ts + server.ts + client.ts - Same keys, different fetchers. This enables SSR prefetch to client hydration. Readreferences/file-structure.md for the full query layer structure.
App router folders are for routing only - Only page.tsx, content.tsx, loading.tsx, layout.tsx, default.tsx, error.tsx, not-found.tsx belong in app/ folders. Readreferences/file-structure.md for all placement rules.
getServerAuth first in every page.tsx - Call before any data prefetches. Readreferences/auth-api-patterns.md for the full pattern.
Link directly to tab routes - Use /products/${id}/overview, not /products/${id} (which causes a redirect).
@header uses default.tsx, not page.tsx - default.tsx renders for ALL child routes; page.tsx only matches the exact route.
Defensive error handling - Always handle error, isLoading, and !data states before rendering content.
Always use parallel routes for detail pages with tabs. Benefits: correct loading skeleton during list-to-detail navigation, independent loading states, tab navigation doesn't reload the header.
/nextjs-data create
Create new pages with complete query layer and SSR hydration.
Before Starting
Identify page type using decision table above
Scan existing queries in lib/queries/ (if exists) - reuse before creating new
Scan existing components from your UI package (if exists)
Identify the target app if working in a monorepo
Creation Flow
1. Gather requirements (page type, data source, which app)
2. Check/Create query layer (keys.ts + server.ts + client.ts)
3. Present plan to user (all files to create with locations)
4. After approval: create query, page.tsx, content.tsx, loading.tsx
For detail pages: layout.tsx, default.tsx, @header/, tabs
/react-ui - React component creation, extraction, patterns, review. Use for UI concerns (shadcn, forms, themes).
/js-monorepo - Monorepo infrastructure (pnpm, Turborepo, shared packages). Use when setting up the repo structure.
Cross-skill initialization order:/js-monorepo init first, then shadcn setup, then /react-ui create, then /nextjs-data create. Read the js-monorepo skill's shadcn-setup.md for the full sequence.
Checklist
Before completing any sub-command:
Every page.tsx uses getQueryClient() + getServerAuth + prefetchQuery + HydrationBoundary
Every content.tsx has 'use client' + useQuery from client fetcher
Client components return skeleton (not null) when loading
Query layer has keys.ts + server.ts + client.ts in lib/queries/{domain}/
Mutations in mutations.ts use client API with invalidateQueries on success
loading.tsx exists and mirrors content structure
error.tsx exists for error boundaries; detail pages have not-found.tsx
Detail pages call notFound() when entity doesn't exist
Links point to tab routes, not parent routes
No custom components in app router folders
Types from shared contracts package, UI from shared UI package