react-nextjs
Use when the user asks about Next.js, App Router, Server and Client Components, 'use client', Server Actions, layouts, loading.tsx/error.tsx, caching and…
от j4flmao★ 47 звёзд на GitHub
Установить react-nextjs в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Next.js
Purpose
Build Next.js apps with App Router. Server Components by default. 'use client' only when required. Data fetching in Server Components with async/await.
Agent Protocol
Trigger
Exact user phrases: "Next.js", "App Router", "Server Component", "Client Component", "Next.js structure", "SSR Next.js", "SSG Next.js", "Next.js data fetching", "use server", "use client".
Input Context
Before activating, verify:
- next.config exists; check the Next.js major (15/16 make
params,searchParams,cookies(),headers()async and stop cachingfetchby default; 16 adds Cache Components and renamesmiddleware.tstoproxy.ts). - Whether the project uses Pages Router or App Router.
Output Artifact
No file output. Produces page file structure and component code as text.
Response Format
File structure:
app/
layout.tsx
page.tsx
loading.tsx
error.tsx
users/[id]/page.tsx
Code: show component and data fetching. No import statements.
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output.
Completion Criteria
- Server Components used by default. 'use client' only when interactivity is needed.
- Data fetching in Server Components with async/await (no useEffect for data).
- Route groups, parallel routes, or intercepting routes used appropriately.
- loading.tsx, error.tsx, not-found.tsx present for each route segment.
- Metadata API used for SEO on every page.
- Client boundaries are as small as possible (wrap interactive widgets, not pages).
Max Response Length
2560 tokens.
Component Architecture / Decision Trees
Architecture Options
| Approach | Trade-off | When to Use |
|---|---|---|
| Server Component | Zero client JS, direct DB access | Data fetching, static content |
| Client Component | Interactivity, hooks, browser APIs | Forms, animations, state |
| Route Handler (route.ts) | Standard API endpoint | Webhooks, third-party integration |
| Server Action | Form mutation, revalidation | All form submissions |
| Middleware | Edge, runs before request | Auth redirects, A/B testing |
| ISR (revalidate) | Stale-while-revalidate | Content pages, blogs |
Decision Tree: Server vs Client
Does the component need:
├── Event listeners (onClick, onChange) -> Client Component
├── Hooks (useState, useEffect, useContext) -> Client Component
├── Browser APIs (localStorage, window) -> Client Component
├── Direct DB access / file system -> Server Component
└── Fetch data from API -> Server Component
Decision Tree: Rendering Strategy
How often does the data change?
├── Never (blog post, docs) -> static (default, no revalidate)
├── Occasionally (product catalog) -> ISR with revalidate: 3600
├── On demand (CMS content) -> revalidatePath / revalidateTag
└── Every request (auth user) -> dynamic (no cache)
Decision Tree: Caching
Is the fetch result user-specific?
├── Yes -> no cache (fetch is uncached by default since Next.js 15; reading cookies()/headers() makes the route dynamic)
└── No -> opt in to caching
├── Can be stale 60s -> `next: { revalidate: 60 }` (or 'use cache' + cacheLife with cacheComponents)
├── Static until invalidated -> `cache: 'force-cache'` + `next: { tags: [...] }`, invalidate with revalidateTag
└── Next.js 13/14 only: fetch was cached by default — don't rely on it after upgrading
Component Design Patterns
Server Component Data Fetching
// app/users/page.tsx
async function UsersPage() {
const users = await db.user.findMany({ orderBy: { createdAt: 'desc' }, take: 20 })
return (
<div>
<h1>Users</h1>
{users.map(user => <UserCard key={user.id} user={user} />)}
</div>
)
}
Client Component with Server Action
// app/users/UserForm.tsx
'use client'
import { useActionState } from 'react'
import { createUser } from './actions'
export function UserForm() {
const [state, formAction, pending] = useActionState(createUser, null)
return (
<form action={formAction}>
<input name="name" required />
{state?.error && <p>{state.error}</p>}
<button disabled={pending}>{pending ? 'Saving...' : 'Create'}</button>
</form>
)
}
Server Action
// app/users/actions.ts
'use server'
import { z } from 'zod'
const schema = z.object({ name: z.string().min(2), email: z.string().email() })
export async function createUser(_: any, formData: FormData) {
const data = Object.fromEntries(formData)
const result = schema.safeParse(data)
if (!result.success) return { error: 'Validation failed', issues: result.error.flatten().fieldErrors }
await db.user.create({ data: result.data })
revalidatePath('/users')
return { success: true }
}
Parallel Route
// app/layout.tsx
export default function Layout({ children, feed, notifications }: {
children: React.Rea
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/app-router-architecture.md
- references/app-router.md
- references/merged-nextjs-server-components.md
- references/middleware-edge.md
- references/nextjs-app-router-patterns.md
- references/nextjs-data-fetching-caching.md
- references/nextjs-data-fetching.md
- references/nextjs-deployment.md
- references/server-components.md
FAQ
Что делает скилл react-nextjs?
Use when the user asks about Next.js, App Router, Server and Client Components, 'use client', Server Actions, layouts, loading.tsx/error.tsx, caching and revalidation, proxy/middleware or Next.js data fetching. Produces Next.js 15/16 App Router code and route structure. Not for render/caching internals or why a route is dynamic (use nextjs-internals).
Как установить скилл react-nextjs?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл react-nextjs запускает скрипты?
Нет, скилл состоит только из инструкций (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…