AGENT SKILL

nextjs

Next.js web production guidance for App Router architecture, server/client boundaries, caching strategy, and runtime behavior.

License 许可
MIT
最近更新
2026-09-14
Stars
★ 1
Forks
0

01 前言 Front Matter

name
nextjs
agents
[ "coder", "sidekick-reviewer", "architect", "feature-designer", "feature-reviewer", "planner", "ask", "builder", "orchestrator" ]
detect
{ "files": [ "next.config.js", "next.config.mjs", "next.config.ts" ], "content": [ { "file": "package.json", "contains": "\"next\"" } ] }
description
Next.js web production guidance for App Router architecture, server/client boundaries, caching strategy, and runtime behavior.

03 SKILL.md 正文

Scope

  • In scope: Next.js web app architecture with App Router, Server/Client Component boundaries, data fetching/caching, and production-ready routing/error patterns.
  • Out of scope: generic React fundamentals already covered by the react skill, non-Next bundler tooling, and backend platform operations.

Invariants

  • Prefer Server Components by default; add "use client" only for browser APIs, local interactivity, or client-only libraries.
  • Keep data access and secrets on the server boundary (Route Handlers, Server Actions, server-only modules).
  • Use next/link for internal navigation and preserve App Router file conventions (layout.tsx, loading.tsx, error.tsx, not-found.tsx).
  • Define caching behavior intentionally (fetch cache options, revalidation strategy, dynamic/static rendering) instead of relying on implicit defaults.
  • Treat metadata, images, and fonts as first-class performance work (generateMetadata, next/image, next/font).

Validation Checklist

Failure Handling

  • If an implementation requires breaking App Router conventions, stop and document the constraint before proceeding.
  • If rendering or cache mode is ambiguous, choose explicit configuration and record the reason in code-level docs.
  • If a feature leaks server-only logic to client bundles, block the change until the boundary is corrected.

High-Value Next.js Practices

  • Use nested layouts to avoid duplicating shell UI and to enable partial rendering.
  • Keep Server Actions small and side-effect focused; validate inputs at the action boundary.
  • Use route handlers for HTTP integration boundaries and normalize error responses.
  • Prefer incremental, route-segment level optimization over app-wide toggles.

04 同仓库更多 Skills