Install
$ agentstack add skill-aurorascharff-skills-nextjs-app-architecture ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Next.js App Architecture
Use when building or refactoring Next.js 16+ App Router apps. The skill is organized into focused references — load only the ones relevant to the current task.
When to read which reference
The references are split into two zones. Load only what the task calls for.
Core (load for any RSC Next.js app)
| Task | Read | | ----------------------------------------------------------------------- | ------------------------------- | | Creating a new feature, deciding folder structure, naming files | references/feature-folders.md | | Writing a query or server action, invalidating cached data | references/queries-actions.md | | Building a server/client component, designing a skeleton, using use() | references/components.md | | Composing a page, placing `, preventing CLS | references/pages-suspense.md` |
Instant Apps (load only when optimizing for instant-feeling apps)
These build on the core; they're opt-in opinions, not architecture requirements.
| Task | Read | | ------------------------------------------------------------------------------------- | -------------------------------- | | Turning on cacheComponents, adding 'use cache' / cacheTag / updateTag | references/cache-components.md | | useOptimistic for mutations, toasts, pending state, action-prop pattern, pagination | references/ux-patterns.md |
Read references in addition to, not instead of, this overview. Each one assumes the rules below already apply.
The model
Next.js 16+ App Router with React Server Components. Three high-level patterns shape everything else:
- Feature-sliced layout — domain folders under
features/, each owning its queries, actions, and components. Pages inapp/compose features; they never contain domain logic. - Async server components by default — components
awaittheir own queries directly. Client components ('use client') are leaves, not parents, of the tree. - Suspense at the page — the feature exports content + a sibling skeleton. The page imports both and places the `` boundary.
Decision rules (always apply)
These rules apply to every change. If you violate one, you'll fight the framework later.
- Pages never fetch data directly. They compose feature components.
- Pages stay synchronous. Use
params.then()instead ofawait paramsso the page chrome above the.then()paints immediately and only the data-dependent section suspends. (Required for the static shell when Cache Components is on; still a nice-to-have without it.) Seereferences/pages-suspense.md. - Queries live in
-queries.tswithimport 'server-only'andcache()wrapping every export. Seereferences/queries-actions.md. - Actions live in
-actions.tswith'use server'at the top. The file name matches the folder, even when the mutation targets a sub-concept. Seereferences/feature-folders.mdandreferences/queries-actions.md. - Async server component is the default. Add
'use client'only when you need hooks, event handlers, or browser APIs. Seereferences/components.md. - The page owns the Suspense boundary; the feature owns the skeleton. Don't pre-wrap components in `
inside the feature. Seereferences/pages-suspense.md`. - Skeletons live in the same file as the component.
FeedandFeedSkeletonare sibling exports. Seereferences/components.md. - Single-use sub-components stay inlined as non-exported functions in the same file. Exports are for things other files import. See
references/components.md.
Decision flow for a new feature
1. Does a feature folder for this domain already exist?
→ Yes: use it. Don't make a new one.
→ No: is this a real domain noun, or a sub-concept of an existing one?
→ Sub-concept (favorite, like, vote, bookmark): fold into the parent feature.
→ Real domain: create features//.
2. Add the query
→ features//-queries.ts
→ Wrap in cache(). If using Cache Components, also add 'use cache' + cacheTag.
→ See references/queries-actions.md (core) and references/cache-components.md (Cache Components).
3. Add the action (if there's a mutation)
→ features//-actions.ts
→ 'use server' at the top, validate input, refresh() (or updateTag() with Cache Components) to invalidate.
4. Build the component
→ features//components/.tsx
→ async server component that awaits its query
→ Export and from the same file.
5. Compose the page
→ app//page.tsx
→ Keep the page synchronous, use params.then().
→ Place }>.
Pitfalls
- Passing server actions as props to call them. Client components import actions directly.
- Refetching what the parent already has. Server components take plain values, not promises. If `
queried the list, pass eachpostto`, don't refetch by id. - Inlining route-specific components in the page file. Extract them into the feature folder. The page should not grow past composition.
- Splitting a card and its grid into separate files. They're always used together. One file, multiple exports.
- Making a feature folder for one query, one action, one button. Fold it into the parent feature.
- Using
'use cache'withoutcacheComponents: true. They go together. Seereferences/cache-components.md. - Wrapping the entire page in a Suspense fallback. Page chrome paints instantly, only data-dependent sections suspend. See
references/pages-suspense.md.
Reference index
Core
references/feature-folders.md— Folder layout, naming, merging sub-concepts, when a new folder is justified, action/query file naming.references/queries-actions.md— Server-only queries,cache()for dedup, server actions, validation,refresh()for invalidation.references/components.md— Async server components, skeletons, client boundary, promise +use()pattern, single-use helpers, polling for live data.references/pages-suspense.md— Page composition,PageProps/LayoutProps,params.then(), Suspense placement rules, CLS prevention, error boundaries, layout-level Suspense.
Instant Apps (opt-in)
references/cache-components.md—cacheComponents: truemodel, the static shell,'use cache'/'use cache: private'/'use cache: remote',cacheTag/cacheLifestrategy,updateTag/revalidateTaginvalidation,connection()escape hatch, build constraints.references/ux-patterns.md—useOptimisticfor mutations, toasts, pending state viadata-pending, destructive action flows, the action-prop pattern, URL pagination,useFormStatus.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: aurorascharff
- Source: aurorascharff/skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.