Command Palette

Search for a command to run...

Назад к скиллам
скилл № 51155

NextJS

Builds Next.js apps with App Router — server components, caching, Server Actions, auth, deployment. Use for any Next.js routing, data, cache, or build issue.

БесплатноБез исполняемых скриптов
clawicот clawic★ 23 звезды на GitHub

Установить NextJS в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Setup

All persistent data for this skill lives in ~/Clawic/data/nextjs/. On first use, read setup.md for project integration.

Configuration

User-dependent variables. Defaults apply until the user states a preference; store them in ~/Clawic/data/nextjs/config.yaml.

Variable Type Default Effect
package_manager npm | pnpm | yarn | bun npm Selects install/run command syntax, lockfile references, and Docker corepack/cache-mount advice
deployment_target vercel | docker | standalone | static-export vercel Drives build config (output mode), env-var handling, and which parts of deployment.md apply; static-export disables SSR/ISR/Server Actions guidance
styling tailwind | css-modules | styled-components | vanilla-extract tailwind Shapes styling examples and the RSC-compatibility caveats (styled-components needs a client boundary/registry)
component_naming PascalCase | kebab-case PascalCase Sets filenames used in generated components and import examples
folder_convention feature-folders | type-folders feature-folders Governs where new routes, components, and colocated files are placed

Preference areas to record as the user reveals them:

  • conventions — component/file naming, folder organization, barrel-file usage
  • stack — TypeScript, ORM (Prisma/Drizzle), auth library, state management
  • proactivity — how eagerly to flag caching/boundary/performance issues vs only on request
  • safety posture — how proactively to surface auth hardening (data-access layer, CVE-2025-29927) vs only when asked

When To Use

  • Building or debugging a Next.js App Router application — routing, rendering, data, deploy
  • Boundary errors: "useState only works in Client Components", hydration mismatch, "functions cannot be passed to Client Components"
  • Cache surprises: stale pages, data not updating, ISR behaving "randomly"
  • Wiring auth: sessions, protected routes, role checks
  • Shipping: Vercel, Docker, standalone server, static export
  • Not for plain React questions (see react skill) or Pages Router deep-dives — App Router is assumed throughout

Architecture

~/Clawic/data/nextjs/
├── memory.md          # Project conventions, patterns
└── projects/          # Per-project learnings

See memory-template.md for the file formats. If you have data at an old location (~/nextjs/ or ~/clawic/nextjs/), move it to ~/Clawic/data/nextjs/, and say in one line that you moved it and from where.

Quick Reference

Situation Go to
First session with a user or project setup.md, then memory-template.md
Page slow, sequential awaits, streaming, Server Actions data-fetching.md
Stale or over-fresh data, revalidate, ISR, cache debugging caching.md
Login, sessions, protected routes, roles auth.md
Modals over pages, parallel routes, layouts, navigation routing.md
Docker, self-hosting, env vars, static export deployment.md
Anything else Next.js Apply Core Rules below; open the closest file only if they don't settle it

Core Rules

1. Server by Default, Client at the Leaves

'use client' marks a boundary, not one component: everything imported below it ships to the browser. Put interactivity in leaf components; a 'use client' layout de-RSCs its whole subtree.

2. Parallel Fetches or You Pay the Sum

Sequential awaits cost sum(t1..tn); Promise.all costs max(). Three 300ms fetches: 900ms sequential, 300ms parallel. Chain awaits only when one call genuinely needs the other's result.

3. One Dynamic Read Poisons the Whole Route

cookies(), headers(), or an uncached fetch anywhere in the tree — layouts included — forces the entire route to render per-request. Read them in the leaf that needs them, behind <Suspense>.

4. Dev Lies About Caching

next dev renders everything dynamically. Verify cache behavior only with next build && next start; debug headers and build-output symbols are in caching.md.

5. Middleware Redirects, the Data Layer Enforces

Middleware does optimistic cookie checks for UX; every Server Action, route handler, and query re-verifies the session. CVE-2025-29927 let a spoofed request header skip middleware entirely — patched versions and the data-access-layer pattern in auth.md.

6. Server Actions Are Public Endpoints

Anyone can POST to an action with its id; a hidden button protects nothing. First lines of every action: session check, then input validation.

7. Write, Revalidate, Then Redirect

Every mutating action ends with revalidatePath/revalidateTag, or the UI keeps serving stale cache. redirect() throws — call it after the try/catch, never inside one.

8. NEXT_PUBLIC_ Is Baked at Build Time

Inlined into the bundle during next build; changing it at runtime does nothing. Unprefixed vars stay server-only — and any differing public var means one Docker image pe

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • _meta.json
  • auth.md
  • caching.md
  • data-fetching.md
  • deployment.md
  • memory-template.md
  • routing.md
  • setup.md

FAQ

Что делает скилл NextJS?

Builds Next.js apps with App Router — server components, caching, Server Actions, auth, deployment. Use for any Next.js routing, data, cache, or build issue.

Как установить скилл NextJS?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл NextJS запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить NextJS с