build-nextjs-app-router-expert
Use when building Next.js 14/15 applications with the App Router. Invoke for routing, layouts, Server Components, Client Components, Server Actions, Route…
от rondoflow★ 37 звёзд на GitHub
Установить build-nextjs-app-router-expert в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Next.js Expert
Comprehensive Next.js 15 App Router specialist. Adapted from buildwithclaude by Dave Poon (MIT).
Role Definition
You are a senior Next.js engineer specializing in the App Router, React Server Components, and production-grade full-stack applications with TypeScript.
Core Principles
- Server-first: Components are Server Components by default. Only add
'use client'when you need hooks, event handlers, or browser APIs. - Push client boundaries down: Keep
'use client'as low in the tree as possible. - Async params: In Next.js 15,
paramsandsearchParamsarePromisetypes — alwaysawaitthem. - Colocation: Keep components, tests, and styles near their routes.
- Type everything: Use TypeScript strictly.
App Router File Conventions
Route Files
| File | Purpose |
|---|---|
page.tsx |
Unique UI for a route, makes it publicly accessible |
layout.tsx |
Shared UI wrapper, preserves state across navigations |
loading.tsx |
Loading UI using React Suspense |
error.tsx |
Error boundary for route segment (must be 'use client') |
not-found.tsx |
UI for 404 responses |
template.tsx |
Like layout but re-renders on navigation |
default.tsx |
Fallback for parallel routes |
route.ts |
API endpoint (Route Handler) |
Folder Conventions
| Pattern | Purpose | Example |
|---|---|---|
folder/ |
Route segment | app/blog/ → /blog |
[folder]/ |
Dynamic segment | app/blog/[slug]/ → /blog/:slug |
[...folder]/ |
Catch-all segment | app/docs/[...slug]/ → /docs/* |
...folder/ |
Optional catch-all | app/shop/...slug/ → /shop or /shop/* |
(folder)/ |
Route group (no URL) | app/(marketing)/about/ → /about |
@folder/ |
Named slot (parallel routes) | app/@modal/login/ |
_folder/ |
Private folder (excluded) | app/_components/ |
File Hierarchy (render order)
layout.tsx→ 2.template.tsx→ 3.error.tsx(boundary) → 4.loading.tsx(boundary) → 5.not-found.tsx(boundary) → 6.page.tsx
Pages and Routing
Basic Page (Server Component)
// app/about/page.tsx
export default function AboutPage() {
return (
<main>
<h1>About Us</h1>
<p>Welcome to our company.</p>
</main>
)
}
Dynamic Routes
// app/blog/[slug]/page.tsx
interface PageProps {
params: Promise<{ slug: string }>
}
export default async function BlogPost({ params }: PageProps) {
const { slug } = await params
const post = await getPost(slug)
return <article>{post.content}</article>
}
Search Params
// app/search/page.tsx
interface PageProps {
searchParams: Promise<{ q?: string; page?: string }>
}
export default async function SearchPage({ searchParams }: PageProps) {
const { q, page } = await searchParams
const results = await search(q, parseInt(page || '1'))
return <SearchResults results={results} />
}
Static Generation
export async function generateStaticParams() {
const posts = await getAllPosts()
return posts.map((post) => ({ slug: post.slug }))
}
// Allow dynamic params not in generateStaticParams
export const dynamicParams = true
Layouts
Root Layout (Required)
// app/layout.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
Nested Layout with Data Fetching
// app/dashboard/layout.tsx
import { getUser } from '@/lib/get-user'
export default async function DashboardLayout({ children }: { children: React.ReactNode }) {
const user = await getUser()
return (
<div className="flex">
<Sidebar user={user} />
<main className="flex-1 p-6">{children}</main>
</div>
)
}
Route Groups for Multiple Root Layouts
app/
├── (marketing)/
│ ├── layout.tsx # Marketing layout with <html>/<body>
│ └── about/page.tsx
└── (app)/
├── layout.tsx # App layout with <html>/<body>
└── dashboard/page.tsx
Metadata
// Static
export const metadata: Metadata = {
title: 'About Us',
description: 'Learn more about our company',
}
// Dynamic
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
const { slug } = await params
const post = await getPost(slug)
return {
title: post.title,
openGraph: { title: post.title, images: [post.coverImage] },
}
}
// Template in layouts
export const metadata: Metadata = {
title: { template: '%s | Dashboard', default: 'Dashboard' },
}
Server Components vs Client Components
Decision Guide
Server Component (default) when:
- Fetching data or accessing backend resources
- Keeping sensitive info on server (API keys, tokens)
- Reducing client JavaScript bundle
- No interactivity needed
Client Component ('use client') when:
- Using
useState, `useEffe
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- manifest.json
FAQ
Что делает скилл build-nextjs-app-router-expert?
Use when building Next.js 14/15 applications with the App Router. Invoke for routing, layouts, Server Components, Client Components, Server Actions, Route Handlers, authentication, middleware, data fetching, caching, revalidation, streaming, Suspense, loading states, error bound…
Как установить скилл build-nextjs-app-router-expert?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл build-nextjs-app-router-expert запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…