nextjs-app-architecture

Build and audit Next.js 16 App Router apps using a feature-sliced React Server Components architecture.

83|Updated Jun 4, 2026
One-click install
npx skills add https://github.com/aurorascharff/nextjs-app-architecture-skill --skill nextjs-app-architecture-aurorascharff
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nextjs-app-architecture
Source: https://github.com/aurorascharff/nextjs-app-architecture-skill
Command: npx skills add https://github.com/aurorascharff/nextjs-app-architecture-skill --skill nextjs-app-architecture-aurorascharff

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Next.js App Router projects often drift into route-loader-shaped pages that fetch data inline, leak route params into components, and scatter queries, actions, and Suspense boundaries inconsistently. This Skill gives an AI coding agent a single enforceable architecture—synchronous composing pages, feature-owned async server components, co-located skeletons, and disciplined caching—so apps stay consistent and easy to modify. ## Core Features & Use Cases - Architecture workflow: An 8-step build/audit workflow covering feature folder placement, server-only queries, server actions, component/skeleton design, page composition with params.then(), Suspense placement, and interaction patterns. - Invariant checklist: 11 non-negotiable rules plus a verification checklist for auditing diffs, including Cache Components rules for 'use cache', cacheTag, cacheLife, and updateTag invalidation. - On-demand references: Eight reference files covering feature folders, queries/actions, components, pages/Suspense, Cache Components, SPA client caches, UX patterns, and the next-beats example app. - Use Case: Ask the agent to refactor a page that awaits params and fetches inline; it converts the page into a synchronous compositor that resolves route props at the boundary and delegates reads to feature-owned async server components with sibling skeletons. ## Quick Start Ask the agent to audit your Next.js app's app/ directory against this architecture and refactor any page that fetches data inline into feature-owned async server components.

Frequently Asked Questions about nextjs-app-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Next.js App Router project with React Server Components?▼

Organize code into feature folders under features/<domain>/ with <domain>-queries.ts (marked import 'server-only'), <domain>-actions.ts (marked 'use server'), and a components/ directory. Pages in app/ stay synchronous, compose feature components, and place Suspense boundaries without fetching data themselves.

How do I keep Next.js pages synchronous instead of awaiting params?▼

Use params.then() or searchParams.then() inside the page body instead of await params at the top, or Promise.all([params, searchParams]).then(...) when both are needed. Content above the .then() paints into the static shell while data-dependent sections suspend behind page-owned Suspense boundaries.

When should I use 'use cache' versus React cache() in Next.js?▼

Use 'use cache' with cacheTag and cacheLife under Cache Components to share reads across requests, and reserve React cache() for proven same-request deduplication of dynamic queries. Do not add cache() to a function that already uses 'use cache' unless a separate same-request duplication problem exists.

Does this architecture work without Cache Components enabled?▼

Yes. Without cacheComponents: true, skip 'use cache', cacheTag, and cacheLife, use plain server-only async queries by default, and invalidate with refresh() from server actions. Pages still use params.then() so chrome paints before route-specific data resolves.

Why does my Next.js build fail after enabling Cache Components?▼

Builds fail when async work lacks both 'use cache' and an ancestor Suspense boundary, when request data appears inside 'use cache', or when a page awaits params at the top. Cache the reusable read, wrap justified dynamic reads in a page-owned Suspense, and keep pages synchronous with params.then().

Where should skeleton components live in a Next.js feature folder?▼

Export each skeleton from the same file as its component, defined at the end of the file, such as Feed and FeedSkeleton as siblings. The page imports both and places the Suspense boundary; features never pre-wrap themselves, and alias skeleton wrappers that only pass props should be avoided.