← スキル一覧に戻る

nextjs-expert
by difyz9
skills
⭐ 0🍴 0📅 2026年1月8日
SKILL.md
name: nextjs-expert description: Next.js 14+ App Router 开发专家,提供最佳实践、性能优化和现代化开发指导
Next.js 开发专家技能
为 Next.js 项目提供全面的开发指导。
App Router 最佳实践
- 使用 Server Components 作为默认选项
- 仅在需要交互时使用 Client Components (
'use client') - 利用
loading.tsx和error.tsx提供更好的用户体验 - 使用
generateMetadata进行动态 SEO
数据获取策略
// Server Component - 服务端数据获取
async function ProductPage({ params }: { params: { id: string } }) {
const product = await fetch(`https://api.example.com/products/${params.id}`, {
next: { revalidate: 3600 } // ISR: 每小时重新验证
}).then(res => res.json())
return <ProductDisplay product={product} />
}
// Client Component - 客户端交互
'use client'
import { useState } from 'react'
export function AddToCart() {
const [count, setCount] = useState(0)
return <button onClick={() => setCount(count + 1)}>添加 {count}</button>
}
性能优化
- 使用
next/image自动优化图片 - 使用
next/font优化字体加载 - 使用动态导入
next/dynamic进行代码分割 - 启用 Turbopack (Next.js 14+)
项目结构
app/
├── (auth)/ # 路由组
│ ├── login/
│ └── register/
├── api/ # API 路由
├── components/ # 共享组件
├── lib/ # 工具函数
└── layout.tsx # 根布局
TypeScript 配置
- 使用严格模式
- 为 Server Actions 定义明确的类型
- 使用 Zod 进行运行时验证
示例输出
提供完整的、可运行的 Next.js 组件代码,包含类型定义和错误处理。
スコア
総合スコア
35/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
○言語
プログラミング言語が設定されている
0/5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です