Install
openclaw skills install fec-nextjs-project-standardUse when creating or reviewing Next.js 14+ App Router projects, file routes, layouts, server/client component boundaries, SSR/SSG/ISR, streaming, metadata, middleware, server actions, or Next-specific data fetching. For generic client React component architecture, apply the project's React conventions separately; Chinese triggers include Next.js, App Router.
openclaw skills install fec-nextjs-project-standard适用于使用 Next.js 14+ 与 App Router 的仓库。
规范 Next.js 14+ 项目中 App Router、SSR/SSG/ISR 渲染模式、数据获取、路由布局、中间件和 SEO 元数据的工程实践,确保服务端优先、性能优化和可维护性。
'use client'。loading.tsx、error.tsx、not-found.tsx、metadata 和敏感逻辑的服务端边界。src/
├── app/ # App Router
│ ├── layout.tsx # 根布局
│ ├── page.tsx # 首页
│ ├── loading.tsx # 全局 loading UI
│ ├── error.tsx # 全局错误边界
│ ├── not-found.tsx # 404
│ ├── globals.css
│ │
│ ├── (auth)/ # 路由组
│ │ ├── login/
│ │ │ └── page.tsx
│ │ └── register/
│ │ └── page.tsx
│ │
│ ├── (dashboard)/ # 仪表盘路由组
│ │ ├── layout.tsx # 共享布局
│ │ ├── dashboard/
│ │ │ └── page.tsx
│ │ └── users/
│ │ ├── page.tsx
│ │ └── [id]/
│ │ └── page.tsx
│ │
│ └── api/ # API Routes
│ └── users/
│ └── route.ts
│
├── components/ # 共享组件
├── lib/ # 工具、配置
├── hooks/
├── services/
└── types/
| 模式 | 使用场景 | 实现方式 |
|---|---|---|
| SSR | 动态、需实时数据 | 默认,fetch 不缓存或 cache: 'no-store' |
| SSG | 静态内容 | generateStaticParams + 静态 fetch |
| ISR | 定期更新 | revalidate 或 revalidatePath |
| CSR | 客户端交互 | 'use client' + useEffect 或 SWR/React Query |
async 或 fetch,不暴露 useEffectuseEffect + useState,或 SWR / React Queryloading.tsx 和 Suspense 包裹异步区块,提供流式体验(auth) 不改变 URL,只影响布局[id] 配合 generateStaticParams 做 SSGlayout.tsx 包裹子路由,共享 UI 与布局page.tsx 为叶子路由,不可嵌套middleware.ts 根目录metadata 或 generateMetadata 导出title、description、openGraph、twitter 等generateMetadata(params) 生成'use client'useState、useEffect、浏览器 APInext/image,字体使用 next/fontNEXT_PUBLIC_ 环境变量。loading.tsx / error.tsx、路由与布局等以本 skill 为准。'use client' 组件:组合与复合组件、表单、客户端状态、列表虚拟化、动效与键盘/焦点等,与纯 React 项目一致,遵循项目中的 React 规则(如 .claude/rules/fec-react.md)。app/ 目录、page.tsx、layout.tsx、loading.tsx、error.tsx)