nextjs-architecture
Skill2 starsChanged 4 months agoMITView on GitHub
Architect and scaffold Next.js applications (App Router) with production-grade project structure, rendering strategy, data fetching, and routing decisions. Use this whenever the user starts a new Next.js project, asks where a file/route/component should live, asks about server vs client components, asks about SSR/SSG/ISR/streaming, or is making structural decisions in a Next.js codebase. Also trigger on "how should I structure this Next.js app", "server actions", "route groups", "app router vs pages router".
- Reads credentials
2 other projects use a version of this.
Adopted by
Most recently taken up by
- lubshad/skillstheir own version, first seen Nov 1, 2026
- bryanus1/agent-skillstheir own version, first seen Nov 1, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- lubshad/skills★ 1same name
- bryanus1/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- accessibility-a11ySkill
- design-system-tailwindSkill
- motion-design-toolkitSkill
- react-component-engineeringSkill
- react-three-fiber-3dSkill
- responsive-mobile-firstSkill
- auth-authorizationSkill
- database-schema-designSkill
- form-validation-error-handlingSkill
- mern-stack-architectureSkill
- rest-api-integrationSkill
- state-managementSkill
- landing-page-conversionSkill
- payment-gateway-integrationSkill
- saas-dashboard-adminSkill
- startup-mvp-developmentSkill
- ux-research-flow-designSkill
- visual-design-languageSkill
- ai-assisted-frontend-workflowSkill
- deployment-vercel-productionSkill
- performance-seo-optimizationSkill
- project-architecture-clean-codeSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use this skill to make deliberate, defensible architecture decisions in Next.js (App Router, v14+) projects instead of defaulting to ad-hoc …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Next.js Architecture Skill
Use this skill to make deliberate, defensible architecture decisions in Next.js (App Router, v14+) projects instead of defaulting to ad-hoc file placement.
When to reach for this skill
- Starting a new Next.js project or feature
- Deciding server component vs client component
- Choosing a rendering strategy (SSG / SSR / ISR / PPR / streaming)
- Structuring routes, layouts, route groups, parallel/intercepting routes
- Data fetching patterns (fetch caching, server actions, mutations)
Default project structure
src/
├── app/
│ ├── (marketing)/ # route group: public pages, own layout
│ │ ├── page.tsx
│ │ └── layout.tsx
│ ├── (app)/ # route group: authenticated app shell
│ │ ├── dashboard/
│ │ └── layout.tsx
│ ├── api/ # route handlers (only for webhooks/3rd-party callbacks)
│ ├── layout.tsx # root layout
│ └── globals.css
├── components/
│ ├── ui/ # primitive design-system components
│ └── features/ # feature-scoped composite components
├── lib/ # server-only utilities, db clients, auth
├── hooks/ # client-only hooks
├── actions/ # server actions, grouped by domain
├── types/
└── config/ # site config, env schemaCore decision rules
- Default to Server Components. Only add
"use client"when you need interactivity (state, effects, event handlers, browser APIs) or a third-party client-only library (R3F, Framer Motion, GSAP hooks). Push the client boundary as low/leaf as possible — don't mark a whole page client just because one button needsonClick. - Prefer Server Actions over API routes for mutations from within the app. Reserve
app/api/*route handlers for webhooks, third-party callbacks, or endpoints consumed by non-Next.js clients. - Rendering strategy per route, not per app:
- Static marketing/content pages → SSG (
generateStaticParams, nodynamicexport) or ISR (revalidate) - Personalized/authenticated pages → SSR (
dynamic = 'force-dynamic'or uncached fetch) - Long lists / dashboards with slow data → stream with
<Suspense>+ loading.tsx skeletons
- Static marketing/content pages → SSG (
- Colocate route-only UI (
_components/, prefixed with underscore to opt out of routing) inside the route folder; put anything reused across ≥2 routes insrc/components/. - Data fetching: fetch directly in Server Components with the native
fetchcache options ({ cache: 'force-cache' | 'no-store', next: { revalidate, tags } }**. Avoid client-sideuseEffectfetching for initial page data — it costs a waterfall and hurts Core Web Vitals. - Environment/config validation: validate
process.envat startup with a zod schema inconfig/env.ts, never readprocess.env.Xad hoc across the codebase.
Scaffolding
scripts/scaffold-route-group.sh <name> generates a route group's layout.tsx + page.tsx following the structure above — faster and more consistent than hand-writing boilerplate for a new marketing/app/auth section.
Anti-patterns to flag
"use client"at the top of a whole page when only a small island is interactive- Fetching data in a client component with
useEffectwhen it could be a Server Component - Business logic inside API routes that duplicates a Server Action
- Deeply nested prop-drilling instead of composition/children pattern for Server→Client boundaries
- Barrel files (
index.tsre-exporting everything) that break tree-shaking and slow builds at scale
Example prompt this skill should trigger on
"Set up a new Next.js 15 app for a SaaS dashboard with marketing pages and an authenticated app section."
Response should propose the route-group structure above, explain the server/client split, and scaffold the root + route-group layouts before writing feature code.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

