nextjs
Next.js App Router reference skill covering pages, layouts, components, metadata, i18n, API-backed data access, server actions, caching, accessibility, analytics, and testing. Use when the task touches a Next.js code path and should follow the project's App Router conventions.
What this skill does
<EXTREMELY-IMPORTANT> This skill is a routing shell over the Next.js reference set, not the full framework manual. Non-negotiable rules: 1. Read `references/stack.md` first. 2. Then load only the references needed for the actual task. 3. Keep user-visible text translated. 4. Keep data access in the project’s API-client pattern. 5. Keep the heavy Next.js guidance in `references/`, not inline here. </EXTREMELY-IMPORTANT> # nextjs ## Inputs - `$request`: The Next.js page, component, routing, caching, or testing task ## Goal Route Next.js work through the project's App Router conventions so implementation follows the established patterns for data access, metadata, localization, and rendering boundaries. ## Step 0: Read the stack contract Always start with: - `references/stack.md` That establishes the locked decisions for runtime, config, and project-wide Next.js patterns. **Success criteria**: The project’s Next.js architecture assumptions are explicit before editing. ## Step 1: Load only the relevant references Use the routing table to pick reference files that match the task. Do not bulk-load the full reference tree. | Task | Read | |------|------| | Folder layout, file conventions, project structure | `references/folder-structure.md` | | Route groups, dynamic routes, parallel/intercepting routes | `references/routing.md` | | Creating or editing a page or layout | `references/page-checklist.md` | | Component structure, client/server boundaries | `references/component-anatomy.md` | | Data fetching, API client, fetch wrappers | `references/api-client-pattern.md` | | Server actions, mutations, revalidation | `references/server-actions.md` | | Caching, ISR, on-demand revalidation | `references/caching-strategy.md` | | Translations, locale routing, message files | `references/i18n-conventions.md` | | Error boundaries, error.tsx, not-found.tsx | `references/error-handling.md` | | Structured logging, log levels | `references/logging.md` | | Analytics, event tracking, consent | `references/tracking.md` | | Authentication, middleware, session | `references/auth.md` | | Security headers, CSP, CSRF, rate limiting | `references/security.md` | | SEO, metadata, Open Graph, sitemap | `references/seo.md` | | Accessibility, ARIA, keyboard navigation | `references/accessibility.md` | | Unit tests, component tests | `references/testing-unit.md` | | E2E tests, Playwright | `references/testing-e2e.md` | | Machine-readable output, JSON-LD, structured data | `references/machine-readable.md` | Multiple tasks? Read multiple files. The references are self-contained. **Success criteria**: The active context only contains the task-relevant Next.js conventions. ## Step 2: Implement with the core Next.js guardrails Keep these rules active: - async request-bound APIs are awaited - data access uses the project API client, not ad hoc fetches or ORM calls - visible strings go through the localization layer - pages and layouts stay server-first unless a leaf component truly needs client mode - metadata and SEO requirements stay attached to page work **Success criteria**: The change fits the project’s App Router architecture instead of generic framework defaults. ## Step 3: Verify the affected surface Use the narrowest relevant verification: - unit tests - e2e tests - linting or type checks - page or route smoke validation **Success criteria**: The changed Next.js surface still behaves correctly. ## Guardrails - Do not inline the whole Next.js handbook in `SKILL.md`. - Do not skip `references/stack.md`. - Do not hardcode user-facing strings when i18n is required. - Do not bypass the project’s API-client and caching conventions. - Do not add `disable-model-invocation`; this is a normal domain skill. ## When To Load References - `references/stack.md` Always. - then only the task-relevant files under `references/` ## Output Contract Report: 1. which Next.js references were loaded 2. the architecture pattern chosen 3. the change made 4. the verification run
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.