nextjs
Skill0 starsChanged 7 months agoMITView on GitHub
Build full-stack Next.js applications using the App Router (Next.js 13+). ALWAYS load this skill when the user mentions "next.js", "nextjs", "next", "app router", "server components", "server actions", "route handlers", or any React full-stack work. Also trigger for: pages, layouts, loading states, API routes in Next.js, SSR, SSG, ISR, caching, middleware, Vercel deployment, or any mention of building a full-stack React app. TypeScript is always used unless the user explicitly says otherwise. Do not wait for the user to say "App Router" — assume it for any new Next.js project.
19 other projects use a version of this.
Adopted by
Most recently taken up by
- davidvornholt/mailboxtheir own version, first seen Oct 4, 2026
- fjerbi/claude-code-arsenaltheir own version, first seen Sep 28, 2026
- AvilaCarlosDev/openclaw-skillstheir own version, first seen Sep 19, 2026
- SnowBeatRain/skillstheir own version, first seen Sep 15, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- Rikinshah787/agent-skills-production-skillstheir own version, first seen Aug 10, 2026
Used with
Projects with it also use terraform, tailwind and 3 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
ihiteshguptaSkillterraform
Expert in Infrastructure as Code with Terraform. Use for creating, managing, and versioning infrastructure across cloud providers.
Also in 3 projects that use this
nth5693Skilltailwind
Also in 3 projects that use this
akornmeierSkillshadcn-ui
Use when building React UIs with component libraries, implementing forms, dialogs, navigation, or data display. Use when user mentions shadcn, Radix UI, Base UI, or asks about accessible React components. Proactively suggest when building UI that would benefit from pre-built accessible components with Tailwind CSS styling.
Also in 3 projects that use this
VercelSkillreact
React renderer for json-render that turns JSON specs into React components. Use when working with @json-render/react, building React UIs from JSON, creating component catalogs, or rendering AI-generated specs.
Also in 3 projects that use this
akornmeierSkilldocker
Guide for using Docker - a containerization platform for building, running, and deploying applications in isolated containers. Use when containerizing applications, creating Dockerfiles, working with Docker Compose, managing images/containers, configuring networking and storage, optimizing builds, deploying to production, or implementing CI/CD pipelines with Docker.
Also in 3 projects that use this
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- openai/plugins★ 7.3ksame name
- nth5693/gemini-kit★ 373same name
- faqndo97/ai-skills★ 33same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- alexander-danilenko/cortex-ai-skills★ 16same name
- wpank/ai★ 11same name
- YepAPI/skills★ 8same name
- DongDuong2001/pudo-code-system★ 5same name
- leonvanzyl/claude-code-pro-workflow-demo★ 4same name
- Aver005/agent-skills★ 2same name
9 more not listed
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 repository6 other files it gives its agents.
- cavemanSkill
- nodejs24Skill
- react19Skill
- spec-webdevSkill
- ui-kit-generatorSkill
- tailwind-ui-kit-generatorSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 3 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 17 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 51
Default: everything is a Server Component: Add 'use client' only when needed.
- Very specific: line 61
Keep 'use client' as far down the tree as possible — it makes the entire subtree client-side
- Distinctive: line 139
Use for mutations — form submissions, DB writes, state changes.
- Very specific: line 234
Put 'use client' high in the tree — it disables RSC for the entire subtree
- Distinctive: line 235
Use Server Actions to fetch data (they're for mutations only)
- Very specific: line 236
Read cookies() or headers() in layouts — forces dynamic rendering everywhere
- Distinctive: line 238
Create Route Handlers for mutations that only your own UI calls
- Very specific: line 239
Use any — always type properly
- Very specific: line 241
Use unstable_cache — replaced by 'use cache' directive in Next.js 16
- Very specific: line 242
Start new projects with middleware.ts — use proxy.ts instead
- Very specific: line 248
Use revalidateTag after mutations to invalidate cached data
- Very specific: line 250
Keep proxy.ts lightweight — no DB calls, no heavy logic
“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Next.js App Router Guidelines
Next.js 16 (latest: 16.2.6), App Router, TypeScript, full-stack. This is the authoritative reference — apply it for any Next.js work.
Project Structure
src/
├── app/ # App Router — routes live here
│ ├── layout.tsx # Root layout (required) — renders <html> and <body>
│ ├── page.tsx # Home route
│ ├── loading.tsx # Suspense fallback (streaming)
│ ├── error.tsx # Error boundary
│ ├── not-found.tsx # 404 handler
│ ├── (auth)/ # Route group — no URL impact
│ │ ├── login/page.tsx
│ │ └── register/page.tsx
│ ├── dashboard/
│ │ ├── layout.tsx # Nested layout — persists across child routes
│ │ ├── page.tsx
│ │ └── [id]/page.tsx # Dynamic segment
│ └── api/ # Route Handlers (external API consumers)
│ └── webhook/route.ts
├── components/
│ ├── ui/ # Presentational, reusable
│ └── features/ # Feature-specific components
├── lib/ # Shared utilities, db client, helpers
├── actions/ # Server Actions
└── types/ # Shared TypeScript typesServer vs Client Components
Default: everything is a Server Component. Add 'use client' only when needed.
| Use Server Component for | Use Client Component ('use client') for |
| Data fetching | onClick, onChange, event handlers |
| DB queries, secrets, API keys | useState, useEffect, hooks |
| Heavy dependencies (SDKs, markdown) | Browser APIs (window, localStorage) |
| Static/streamed UI | Animations, focus management |
Key rules:
- Keep
'use client'as far down the tree as possible — it makes the entire subtree client-side - Server Components can render Client Components as children — not the other way around
- Pass server-fetched data as props into Client Components
// ✅ Server Component fetches, passes to small client island
export default async function PostPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params
const post = await db.post.findUnique({ where: { id } })
return <PostView post={post} /> // PostView is the 'use client' component
}Data Fetching
Fetch directly in Server Components — no useEffect, no API ping-pong:
// ✅ Fetch in Server Component
export default async function UsersPage() {
const users = await db.user.findMany()
return <UserList users={users} />
}Caching in Next.js 16 — opt-in with 'use cache':
Everything is dynamic by default. Cache explicitly with the 'use cache' directive:
// Cache a whole page
'use cache'
export default async function BlogPage() {
const posts = await db.post.findMany()
return <PostList posts={posts} />
}
// Cache a specific component
async function RecentPosts() {
'use cache'
const posts = await db.post.findMany({ take: 5 })
return <ul>{posts.map(p => <li key={p.id}>{p.title}</li>)}</ul>
}
// Cache a data function with lifetime and tags
import { cacheLife, cacheTag } from 'next/cache'
async function getPosts() {
'use cache'
cacheLife('hours') // or 'seconds', 'days', 'weeks', or { revalidate: 3600 }
cacheTag('posts') // tag for targeted invalidation
return db.post.findMany()
}
// Invalidate by tag after mutation
import { revalidateTag } from 'next/cache'
revalidateTag('posts')Still works for fetch-based caching:
const data = await fetch('https://api.example.com/posts', {
next: { revalidate: 3600, tags: ['posts'] }
})Route segment config (still valid):
export const dynamic = 'force-dynamic' // always dynamic
export const revalidate = 60 // ISR fallbackServer Actions
Use for mutations — form submissions, DB writes, state changes. No separate API route needed for your own UI.
// actions/post.ts
'use server'
import { revalidateTag } from 'next/cache'
import { z } from 'zod'
const schema = z.object({ title: z.string().min(1), body: z.string().min(1) })
export async function createPost(formData: FormData) {
const parsed = schema.safeParse({
title: formData.get('title'),
body: formData.get('body'),
})
if (!parsed.success) return { error: 'Invalid input' }
await db.post.create({ data: parsed.data })
revalidateTag('posts')
return { success: true }
}// Use directly in a Server Component form
import { createPost } from '@/actions/post'
export default function NewPostForm() {
return (
<form action={createPost}>
<input name="title" />
<textarea name="body" />
<button type="submit">Publish</button>
</form>
)
}Server Actions vs Route Handlers — when to use which:
| Situation | Use |
| Form submission / mutation from your own UI | Server Action |
| Data fetching for your own UI | Async Server Component |
| External consumers (mobile app, webhooks, third-party) | Route Handler |
| SSE / streaming to non-React clients | Route Handler |
| Auth callbacks, webhooks | Route Handler |
Never use Server Actions as query endpoints — they're POST-only and meant for mutations:
// ❌ Wrong — don't fetch data via Server Actions
export async function getUsers() {
'use server'
return db.user.findMany()
}
// ✅ Right — fetch directly in the Server Component
export default async function UsersPage() {
const users = await db.user.findMany()
return <UserList users={users} />
}Route Handlers
For external API consumers, webhooks, SSE — lives in app/api/*/route.ts:
// app/api/webhook/route.ts
import { NextRequest } from 'next/server'
export async function POST(req: NextRequest) {
const body = await req.json()
// validate, process
return Response.json({ received: true })
}
// Note: GET handlers are NOT cached by default in Next.js 16
export async function GET() {
const data = await db.post.findMany()
return Response.json(data)
}Anti-Patterns
❌ Never:
- Put
'use client'high in the tree — it disables RSC for the entire subtree - Use Server Actions to fetch data (they're for mutations only)
- Read
cookies()orheaders()in layouts — forces dynamic rendering everywhere - Fetch in
useEffectwhen a Server Component would do - Create Route Handlers for mutations that only your own UI calls
- Use
any— always type properly - Hardcode secrets — env variables only, never exposed to client
- Use
unstable_cache— replaced by'use cache'directive in Next.js 16 - Start new projects with
middleware.ts— useproxy.tsinstead
✅ Always:
- Server Component by default,
'use client'only when needed - Cache explicitly with
'use cache'+cacheTag— don't rely on implicit caching - Validate all inputs with Zod in Server Actions and Route Handlers
- Use
revalidateTagafter mutations to invalidate cached data - Stream slow data with
<Suspense>boundaries - Keep
proxy.tslightweight — no DB calls, no heavy logic
package.json Baseline
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
}
}Turbopack is the default bundler in Next.js 16 — no --turbopack flag needed.
# Bootstrap
npx create-next-app@latest my-app --typescript --tailwind --app --src-dirReference Files
Load these when the topic comes up — don't load all of them upfront:
references/routing-layouts.md— routing patterns, layouts, special files, streaming with Suspensereferences/deployment.md— proxy.ts, validation, TypeScript defaults, Vercel deployment
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.

