Agent SkillsRightNow-AI/openfang › nextjs-expert

nextjs-expert

GitHub

提供 Next.js 14+ App Router 架构指导,涵盖 SSR/SSG、Server Components、数据获取及部署优化,帮助构建高性能 SEO 友好应用。

crates/openfang-skills/bundled/nextjs-expert/SKILL.md RightNow-AI/openfang

Trigger Scenarios

Next.js 项目架构设计 App Router 路由配置 服务端组件与客户端组件选型 Next.js 性能优化与部署

Install

npx skills add RightNow-AI/openfang --skill nextjs-expert -g -y
More Options

Non-standard path

npx skills add https://github.com/RightNow-AI/openfang/tree/main/crates/openfang-skills/bundled/nextjs-expert -g -y

Use without installing

npx skills use RightNow-AI/openfang@nextjs-expert

指定 Agent (Claude Code)

npx skills add RightNow-AI/openfang --skill nextjs-expert -a claude-code -g -y

安装 repo 全部 skill

npx skills add RightNow-AI/openfang --all -g -y

预览 repo 内 skill

npx skills add RightNow-AI/openfang --list

SKILL.md

Frontmatter
{
    "name": "nextjs-expert",
    "description": "Next.js expert for App Router, SSR\/SSG, API routes, middleware, and deployment"
}

Next.js Expert

A seasoned Next.js architect with deep expertise in the App Router paradigm, server-side rendering strategies, and production deployment patterns. This skill provides guidance on building performant, SEO-friendly web applications using Next.js 14+ conventions, including Server Components, Streaming, and the full spectrum of data fetching and caching mechanisms.

Key Principles

  • Prefer Server Components by default; only add "use client" when the component requires browser APIs, event handlers, or React state
  • Leverage the app/ directory structure where each folder segment maps to a URL route, using layout.tsx for shared UI and page.tsx for unique content
  • Design data fetching at the server layer using async Server Components and fetch with Next.js caching semantics
  • Use generateStaticParams for static pre-rendering of dynamic routes at build time, falling back to on-demand ISR for long-tail pages
  • Keep client bundles small by pushing logic into Server Components and using dynamic imports for heavy client-only libraries

Techniques

  • Structure routes with app/[segment]/page.tsx, using route groups (parentheses) to organize without affecting URL paths
  • Implement loading.tsx and error.tsx boundaries at each route segment to provide instant loading states and graceful error recovery
  • Use Route Handlers (app/api/.../route.ts) with exported GET, POST, PUT, DELETE functions for API endpoints
  • Configure middleware in middleware.ts at the project root with a matcher config to intercept requests for auth, redirects, or header injection
  • Optimize images with next/image (automatic srcSet, lazy loading, AVIF/WebP) and fonts with next/font (zero layout shift, self-hosted subsets)
  • Enable ISR by returning revalidate values from fetch calls or using revalidatePath/revalidateTag for on-demand cache invalidation
  • Set up next.config.js with redirects, rewrites, headers, and the experimental options appropriate to your deployment target

Common Patterns

  • Parallel Routes: Use @named slots in layouts to render multiple page-level components simultaneously, enabling dashboards and split views
  • Intercepting Routes: Place (..) convention routes to show modals on navigation while preserving the direct URL as a full page
  • Server Actions: Define async functions with "use server" for form submissions and mutations without building separate API routes
  • Streaming with Suspense: Wrap slow data-fetching components in Suspense boundaries to stream HTML progressively and improve TTFB

Pitfalls to Avoid

  • Do not use useEffect for data fetching in Server Components; fetch directly in the component body or use server-side utilities
  • Do not place "use client" at the layout level unless every child truly requires client interactivity, as this opts out the entire subtree from server rendering
  • Do not confuse the Pages Router (pages/ directory) patterns with App Router conventions; they have different data fetching and routing models
  • Do not skip setting proper cache headers and revalidation times, as stale data and unnecessary re-renders degrade both performance and user experience

Version History

  • acf2587 Current 2026-08-20 07:39

Same Skill Collection

crates/openfang-hands/bundled/browser/SKILL.md
crates/openfang-hands/bundled/clip/SKILL.md
crates/openfang-hands/bundled/collector/SKILL.md
crates/openfang-hands/bundled/infisical-sync/SKILL.md
crates/openfang-hands/bundled/lead/SKILL.md
crates/openfang-hands/bundled/predictor/SKILL.md
crates/openfang-hands/bundled/researcher/SKILL.md
crates/openfang-hands/bundled/trader/SKILL.md
crates/openfang-hands/bundled/twitter/SKILL.md
crates/openfang-skills/bundled/ansible/SKILL.md
crates/openfang-skills/bundled/api-tester/SKILL.md
crates/openfang-skills/bundled/aws/SKILL.md
crates/openfang-skills/bundled/azure/SKILL.md
crates/openfang-skills/bundled/ci-cd/SKILL.md
crates/openfang-skills/bundled/code-reviewer/SKILL.md
crates/openfang-skills/bundled/compliance/SKILL.md
crates/openfang-skills/bundled/confluence/SKILL.md
crates/openfang-skills/bundled/crypto-expert/SKILL.md
crates/openfang-skills/bundled/css-expert/SKILL.md
crates/openfang-skills/bundled/data-analyst/SKILL.md
crates/openfang-skills/bundled/data-pipeline/SKILL.md
crates/openfang-skills/bundled/docker/SKILL.md
crates/openfang-skills/bundled/elasticsearch/SKILL.md
crates/openfang-skills/bundled/email-writer/SKILL.md
crates/openfang-skills/bundled/figma-expert/SKILL.md
crates/openfang-skills/bundled/gcp/SKILL.md
crates/openfang-skills/bundled/git-expert/SKILL.md
crates/openfang-skills/bundled/github/SKILL.md
crates/openfang-skills/bundled/golang-expert/SKILL.md
crates/openfang-skills/bundled/graphql-expert/SKILL.md
crates/openfang-skills/bundled/helm/SKILL.md
crates/openfang-skills/bundled/interview-prep/SKILL.md
crates/openfang-skills/bundled/jira/SKILL.md
crates/openfang-skills/bundled/kubernetes/SKILL.md
crates/openfang-skills/bundled/linear-tools/SKILL.md
crates/openfang-skills/bundled/linux-networking/SKILL.md
crates/openfang-skills/bundled/llm-finetuning/SKILL.md
crates/openfang-skills/bundled/ml-engineer/SKILL.md
crates/openfang-skills/bundled/mongodb/SKILL.md
crates/openfang-skills/bundled/nginx/SKILL.md
crates/openfang-skills/bundled/notion/SKILL.md
crates/openfang-skills/bundled/oauth-expert/SKILL.md
crates/openfang-skills/bundled/openapi-expert/SKILL.md
crates/openfang-skills/bundled/postgres-expert/SKILL.md
crates/openfang-skills/bundled/presentation/SKILL.md
crates/openfang-skills/bundled/project-manager/SKILL.md
crates/openfang-skills/bundled/prometheus/SKILL.md
crates/openfang-skills/bundled/prompt-engineer/SKILL.md
crates/openfang-skills/bundled/python-expert/SKILL.md

Metadata

Files
0
Version
acf2587
Hash
36f86339
Indexed
2026-08-20 07:39

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 20:29
浙ICP备14020137号-1 $mapa de visitantes$