一键导入
std-nextjs
Next.js App Router conventions — Server Components, server actions, ISR/SSG, Vercel. Use when building Next.js pages, layouts, or server actions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Next.js App Router conventions — Server Components, server actions, ISR/SSG, Vercel. Use when building Next.js pages, layouts, or server actions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
ReactJS Vite SPA conventions — React Router, Zustand, TanStack Query, Tailwind, Framer Motion, ApexCharts. Use when building Vite web SPA pages or components.
WCAG 2.2 AA accessibility audit with 4-principle framework, automated checks, color contrast analysis, keyboard navigation testing, and ARIA pattern validation. Triggers on "accessibility audit", "WCAG audit", "a11y audit", "accessibility check", "screen reader test", "keyboard accessibility", or "accessibility compliance".
Design and review REST APIs for consistency, standards compliance, and developer experience. Use this skill whenever someone asks to design an API, create endpoints, review API contracts, generate OpenAPI specs, or says things like "design the API for X", "review this endpoint", "what should the API look like", "create a REST interface", "write the OpenAPI spec", or "check my API design". Also trigger when someone mentions pagination strategy, error response format, API versioning, or rate limiting design.
Atomic Design methodology for component hierarchy across Phlex (Rails), ReactJS Vite SPA, Next.js App Router, and React Native. Covers atoms, molecules, organisms, templates, and pages with composition rules. Triggers on "atomic design", "component hierarchy", "atom component", "molecule component", "organism component", "design system structure", or "component organization".
React composition patterns for scalable component architecture. Use when refactoring components with boolean prop proliferation, building component libraries, designing compound components, or reviewing component APIs. Triggers on "composition pattern", "compound component", "boolean props", "component architecture", "render props", or "React 19 patterns".
Execute deployment workflows with pre-flight checks, environment validation, health verification, and rollback procedures. Use this skill whenever someone asks to deploy, push to staging, release to production, or says things like "deploy to staging", "release this to production", "run the deployment checklist", "is this ready to deploy", "execute the release", or "roll back the deployment". Also trigger when someone mentions deployment readiness, smoke tests after deploy, rollback procedures, or canary/blue-green deployment strategy.
| name | std-nextjs |
| description | Next.js App Router conventions — Server Components, server actions, ISR/SSG, Vercel. Use when building Next.js pages, layouts, or server actions. |
| paths | ["**/next.config.*","**/app/**/*.tsx","**/app/**/*.jsx","**/src/app/**/*.ts","**/src/app/**/*.tsx","**/middleware.ts"] |
Rules for building Next.js web applications with the App Router, consuming the shared Rails API backend.
| Concern | Library |
|---|---|
| Framework | Next.js 15+ (App Router) — Server Components by default. React 19 minimum |
| Styling | Tailwind CSS (same conventions as the std-reactjs skill; use cn() for conditional classes) |
| Server state | TanStack Query — Client Components only |
| Client state | Zustand — Client Components only |
| HTTP | axios (Rails API client) for client + server actions; fetch for cacheable server reads |
| Forms | react-hook-form + zod (Client Components) |
| i18n | next-intl or react-i18next |
| Testing | Vitest + React Testing Library + MSW |
CSS Modules only for animations Tailwind cannot express.
The version is part of the convention (std-infrastructure: pin every version). Next.js 15
changed caching defaults and request APIs, so the same code behaves differently on 14 — and
guidance that does not say which major it means is guidance you cannot check.
| Next.js 14 | Next.js 15+ (this repo) | |
|---|---|---|
fetch | cached by default | not cached by default — opt in with cache: 'force-cache' |
GET Route Handlers | cached by default | not cached — opt in with export const dynamic = 'force-static' |
| Client Router Cache | page segments reused on <Link> nav | not reused (back/forward and shared layouts still are); tune via experimental.staleTimes |
cookies, headers, draftMode | synchronous | async — await cookies() |
params, searchParams | plain objects | Promises — await params |
Two consequences that shape every example in this skill:
params: Promise<{…}> and await cookies() are not style — they are required. Sync usage
is a 14-ism that warns in dev and breaks.fetch default. Since 15 makes uncached the default and 14 made cached
the default, any code whose correctness depends on the default is a version bug waiting to
happen. State intent explicitly — next: { revalidate, tags } or cache: 'force-cache' — which
is why references/caching.md always does, and why it reads as verbose. That verbosity is the
point.Upgrading from 14: npx @next/codemod@canary upgrade latest handles the async-API migration.
app/ # Routes: layout.tsx, page.tsx, loading.tsx, error.tsx, not-found.tsx
(auth)/ (dashboard)/ # Route groups
api/ # Route Handlers — BFF/webhooks/health only, never a second API
src/
components/ui|forms/ # Design system primitives, form components
actions/ # Server actions (use-case layer for mutations)
hooks/ stores/ # Client hooks, Zustand stores
api/ # Rails API client
domain/ types/ lib/ i18n/
middleware.ts # Edge middleware (auth gate, locale, redirects)
tests/
'use client' only for interactivity: state, event handlers, browser APIs, Zustand,
TanStack Query. Keep Client Components small and leaf-level.'use client' to a page or layout file — extract the interactive part instead.await directly; they cannot use hooks, state, or event handlers.// app/orders/page.tsx — Server Component fetches, Client Component renders interaction
import { OrderTable } from '@/components/OrderTable'; // 'use client'
export default async function OrdersPage() {
const orders = await fetchOrders();
return <OrderTable initialData={orders} />;
}
async/await. Parallelize independent reads with Promise.all.initialData so there is no loading flash.export const revalidate = N. Static: nothing, or dynamic = 'force-static'. Per-request:
dynamic = 'force-dynamic'. On-demand: revalidatePath() / revalidateTag().revalidatePath/revalidateTag after a successful mutation.<form action={formAction}> + useActionState.metadata or generateMetadata. Use generateMetadata when the title
depends on fetched data. Set a canonical URL to avoid duplicate content.matcher. It is a coarse gate, not the
security boundary.next/image for every image; next/link for every internal link.<Suspense> to stream the shell first.@next/bundle-analyzer.'use client' on a page or layout file.useEffect for data fetching in pages.import 'server-only').loading.tsx / error.tsx boundaries (error.tsx must be a Client Component).<img> instead of next/image; <a> instead of next/link.metadata export.NEXT_PUBLIC_ prefix.app/api.<Suspense>, error boundaries → references/rendering.mdreferences/server-actions.mdrevalidateTag vs revalidatePath, request dedupe → references/caching.mdgenerateMetadata/sitemaps, Vercel & ECS deploy → references/middleware-seo-deploy.md