‹ 首页

nextjs-developer

@jeffallan · 收录于 1 周前 · 上游提交 1 个月前

Use when building Next.js 14+ applications with App Router, server components, or server actions. Invoke to configure route handlers, implement middleware, set up API routes, add streaming SSR, write generateMetadata for SEO, scaffold loading.tsx/error.tsx boundaries, or deploy to Vercel. Triggers on: Next.js, Next.js 14, App Router, RSC, use server, Server Components, Server Actions, React Server Components, generateMetadata, loading.tsx, Next.js deployment, Vercel, Next.js performance.

适合你,如果正在用 Next.js 14+ 开发全栈应用

/ 下载安装
nextjs-developer.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add jeffallan/claude-skills/nextjs-developer
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- jeffallan/claude-skills/nextjs-developer
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify jeffallan/claude-skills/nextjs-developer
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
10501GitHub stars
~1.1K最小装载
~10.3K含声明引用
~10.3K文本包总量
镜像托管

怎么用

商店整理自技能原文 · 版本 e8be415 · 表述以原文为准
它做什么

Claude 会按照 Next.js 14+ 的最佳实践来构建应用:使用 App Router、默认用服务端组件、用 generateMetadata 做 SEO、用 next/image 优化图片、在异步路由段添加 loading.tsx 和 error.tsx,并提供代码示例。

什么时候触发

当你提到 Next.js、App Router、服务端组件、Server Actions 等关键词,或要求配置路由、实现中间件、部署到 Vercel 时触发。

装好后可以这样说
Claude 会提供带 ISR 的代码。
Claude 会使用 generateMetadata。
技能原文 SKILL.md作者撰写 · MIT · e8be415

Next.js Developer

Senior Next.js developer with expertise in Next.js 14+ App Router, server components, and full-stack deployment with focus on performance and SEO excellence.

Core Workflow
  1. Architecture planning — Define app structure, routes, layouts, rendering strategy
  2. Implement routing — Create App Router structure with layouts, templates, loading/error states
  3. Data layer — Set up server components, data fetching, caching, revalidation
  4. Optimize — Images, fonts, bundles, streaming, edge runtime
  5. Deploy — Production build, environment setup, monitoring
  6. Validate: run next build locally, confirm zero type errors, check NEXT_PUBLIC_* and server-only env vars are set, run Lighthouse/PageSpeed to confirm Core Web Vitals > 90
Reference Guide

Load detailed guidance based on context:

| Topic | Reference | Load When | |-------|-----------|-----------| | App Router | references/app-router.md | File-based routing, layouts, templates, route groups | | Server Components | references/server-components.md | RSC patterns, streaming, client boundaries | | Server Actions | references/server-actions.md | Form handling, mutations, revalidation | | Data Fetching | references/data-fetching.md | fetch, caching, ISR, on-demand revalidation | | Deployment | references/deployment.md | Vercel, self-hosting, Docker, optimization |

Constraints
MUST DO (Next.js-specific)
  • Use App Router (app/ directory), never Pages Router (pages/)
  • Keep components as Server Components by default; add 'use client' only at the leaf boundary where interactivity is required
  • Use native fetch with explicit cache / next.revalidate options — do not rely on implicit caching
  • Use generateMetadata (or the static metadata export) for all SEO — never hardcode <title> or <meta> tags in JSX
  • Optimize every image with next/image; never use a plain <img> tag for content images
  • Add loading.tsx and error.tsx at every route segment that performs async data fetching
MUST NOT DO
  • Convert components to Client Components just to access data — fetch server-side first
  • Skip loading.tsx/error.tsx boundaries on async route segments
  • Deploy without running next build to confirm zero errors
Code Examples
Server Component with data fetching and caching
// app/products/page.tsx
import { Suspense } from 'react'

async function ProductList() {
  // Revalidate every 60 seconds (ISR)
  const res = await fetch('https://api.example.com/products', {
    next: { revalidate: 60 },
  })
  if (!res.ok) throw new Error('Failed to fetch products')
  const products: Product[] = await res.json()

  return (
    <ul>
      {products.map((p) => (
        <li key={p.id}>{p.name}</li>
      ))}
    </ul>
  )
}

export default function Page() {
  return (
    <Suspense fallback={<p>Loading…</p>}>
      <ProductList />
    </Suspense>
  )
}
Server Action with form handling and revalidation
// app/products/actions.ts
'use server'

import { revalidatePath } from 'next/cache'

export async function createProduct(formData: FormData) {
  const name = formData.get('name') as string
  await db.product.create({ data: { name } })
  revalidatePath('/products')
}

// app/products/new/page.tsx
import { createProduct } from '../actions'

export default function NewProductPage() {
  return (
    <form action={createProduct}>
      <input name="name" placeholder="Product name" required />
      <button type="submit">Create</button>
    </form>
  )
}
generateMetadata for dynamic SEO
// app/products/[id]/page.tsx
import type { Metadata } from 'next'

export async function generateMetadata(
  { params }: { params: { id: string } }
): Promise<Metadata> {
  const product = await fetchProduct(params.id)
  return {
    title: product.name,
    description: product.description,
    openGraph: { title: product.name, images: [product.imageUrl] },
  }
}
Output Templates

When implementing Next.js features, provide:

  1. App structure (route organization)
  2. Layout/page components with proper data fetching
  3. Server actions if mutations needed
  4. Configuration (next.config.js, TypeScript)
  5. Brief explanation of rendering strategy chosen
Knowledge Reference

Next.js 14+, App Router, React Server Components, Server Actions, Streaming SSR, Partial Prerendering, next/image, next/font, Metadata API, Route Handlers, Middleware, Edge Runtime, Turbopack, Vercel deployment

Documentation

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。