difyz9/skills · Archived

nextjs-expert

Next.js 14+ App Router 开发专家,提供最佳实践、性能优化和现代化开发指导

First seen Feb 27, 2026

Installation

$ npx skills add difyz9/skills --skill nextjs-expert

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from difyz9/skills.

npx skills add difyz9/skills

Browse all from difyz9/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Default branch main
Open issues 0
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,776 B
  • docs SUMMARY.md 114 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 3 installs

SKILL.md

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 组件代码,包含类型定义和错误处理。