Token导航 LogoToken导航

Agent Skill · 研究检索

nextjs-best-practice(Next.js 最佳 practice)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

nextjs-best-practice 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 71,596。

总安装 194周安装 8GitHub Stars 公开资料未说明下载 63核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:nextjs-best-practice(Next.js 最佳 practice)
来源仓库:https://github.com/prassamin/skills
仓库路径:skills/nextjs-best-practice
安装命令:
npx skills add https://github.com/prassamin/skills --skill nextjs-best-practice
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/prassamin/skills --skill nextjs-best-practice

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助 Next.js 项目的最佳实践应用与代码审查。适合生成或优化 React 相关页面、组件和构建配置。通过 npx skills add 命令从 GitHub 安装并使用。需结合项目现有路由和构建方式使用,避免孤立代码生成。涉及页面改动时应配合本地预览验证效果。

nextjs-best-practice 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/nextjs-best-practice

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/prassamin/skills --skill nextjs-best-practice;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

nextjs-best-practice 怎么安装?

在终端执行 npx skills add https://github.com/prassamin/skills --skill nextjs-best-practice。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

nextjs-best-practice 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

nextjs-best-practice 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

nextjs-best-practice 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

nextjs-best-practice 用的人多吗?

公开数据是累计安装 194 次,近一周安装 8 次,下载 63 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

nextjs-best-practice 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
nextjs-best-practice

Next.js 最佳 practice · 本页

194—操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Next.js 15 Best Practices

Team standard for building Next.js 15 applications with App Router, Tailwind CSS, and TypeScript.

Decision Tree: Server vs Client Component

Need interactivity (onClick, onChange, state)?
├── YES → 'use client'
│   └── Keep it small. Push interactivity to leaf components.
└── NO → Server Component (default)
    ├── Need data? → async function + fetch/db directly
    ├── Need to show loading? → Add loading.tsx or <Suspense>
    └── Need client child? → Pass data as props (serializable only)

Key rule: Default to Server Components. Only add 'use client' at the lowest possible node.

Export Rule (MANDATORY)

Named exports everywhere. export default ONLY where Next.js requires it.

FileExportWhy
page.tsxexport defaultNext.js requires it
layout.tsxexport defaultNext.js requires it
loading.tsxexport defaultNext.js requires it
error.tsxexport defaultNext.js requires it
not-found.tsxexport defaultNext.js requires it
Everything elseexport function / export constTeam convention
// WRONG
export default function BlogView({ blog }: BlogViewProps) { ... }
export default function Button({ ...props }: ButtonProps) { ... }
export default useSidebarStore

// CORRECT
export function BlogView({ blog }: BlogViewProps) { ... }
export function Button({ ...props }: ButtonProps) { ... }
export const useSidebarStore = create<SidebarStore>(...)

This applies to: view.tsx, all components/, hooks/, lib/, config/, constants/, context/, store/, validation/, actions/, types/.

Page/View Pattern (MANDATORY)

Every route that needs client interactivity MUST use the page.tsx + view.tsx split:

app/blog/[id]/
├── page.tsx    # Server Component — fetches data, passes as props
├── view.tsx    # 'use client' — thin composition layer, imports from components/
└── loading.tsx # Loading skeleton (optional)

components/blog/            # Sub-components for blog views
├── blog-header.tsx
├── blog-content.tsx
├── blog-comments.tsx
└── blog-like-button.tsx

view.tsx must stay thin. It receives props, manages top-level state, and composes sub-components from components/[feature]/. Never let view.tsx grow into a monolith.

// page.tsx — Server Component (data fetching ONLY)
import { db } from '@/config/db'
import { notFound } from 'next/navigation'
import { BlogDetailView } from './view'

export default async function BlogPage({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params
  const [blog, comments] = await Promise.all([
    db.blog.findUnique({ where: { id } }),
    db.comment.findMany({ where: { blogId: id } }),
  ])
  if (!blog) notFound()
  return <BlogDetailView blog={blog} comments={comments} />
}
// view.tsx — Thin composition layer
'use client'

import type { Blog, Comment } from '@/types'
import { BlogHeader } from '@/components/blog/blog-header'
import { BlogContent } from '@/components/blog/blog-content'
import { BlogComments } from '@/components/blog/blog-comments'

interface BlogDetailViewProps {
  blog: Blog
  comments: Comment[]
}

export function BlogDetailView({ blog, comments }: BlogDetailViewProps) {
  return (
    <article>
      <BlogHeader title={blog.title} author={blog.author} date={blog.createdAt} />
      <BlogContent content={blog.content} />
      <BlogComments blogId={blog.id} comments={comments} />
    </article>
  )
}

Mapping rule: app/[route]/view.tsx → components/[route]/**

Routeview.tsxComponents folder
app/home/app/home/view.tsxcomponents/home/
app/blog/[id]/app/blog/[id]/view.tsxcomponents/blog/
app/(dashboard)/settings/app/(dashboard)/settings/view.tsxcomponents/settings/

Never use useEffect to fetch initial data. Fetch in page.tsx, pass via props.

No Props Hell (MANDATORY)

Only pass props that the child cannot obtain itself. If a child can access data via context, Zustand store, or hook — let the child do it. Don't fetch/subscribe in a parent just to pass down.

// BAD: Props hell — parent fetches state just to pass it
export function BlogDetailView({ blog, comments }: BlogDetailViewProps) {
  const { user } = useAuth()
  const { theme } = useTheme()
  const { isOpen } = useSidebarStore()

  return (
    <BlogHeader user={user} theme={theme} />          {/* user/theme are prop-drilled */}
    <BlogComments blogId={blog.id} comments={comments} isOpen={isOpen} />
  )
}

// GOOD: Each child fetches its own shared state
export function BlogDetailView({ blog, comments }: BlogDetailViewProps) {
  return (
    <BlogHeader />                                     {/* reads useAuth() + useTheme() itself */}
    <BlogComments blogId={blog.id} comments={comments} />  {/* reads useSidebarStore() itself */}
  )
}

Props are for: Data that comes from the server (page.tsx → view.tsx → child) or data the child has no way to access on its own.

Props are NOT for: Context values, store state, or hook results the child can call directly.

Decision: Should I pass this as a prop?
├── Child can call useAuth(), useTheme(), useSidebarStore(), etc.?
│   └── NO prop — let child access it directly
├── Data comes from server (page.tsx fetched it)?
│   └── YES prop — pass it down
└── Data is local to parent (parent's useState)?
    └── YES prop — pass it down (or lift to store/context if many children need it)

For detailed patterns and examples, see references/server-client-components.md.

useEffect vs useLayoutEffect (MANDATORY)

Don't spam useEffect everywhere. Analyze first — pick the right hook for the job.

Need to run a side effect?
├── Does it read or modify DOM layout (measure size, scroll position, focus)?
│   └── YES → useLayoutEffect (runs synchronously before browser paints)
├── Does it need to prevent visual flicker (tooltip position, element resize)?
│   └── YES → useLayoutEffect
└── Everything else (API calls, subscriptions, analytics, timers)
    └── useEffect (runs after paint, does not block rendering)
// BAD: useEffect causes flicker — DOM measurement happens after paint
useEffect(() => {
  const height = ref.current.getBoundingClientRect().height
  setHeight(height)  // user sees a layout jump
}, [])

// GOOD: useLayoutEffect — measures before paint, no flicker
useLayoutEffect(() => {
  const height = ref.current.getBoundingClientRect().height
  setHeight(height)  // seamless, user sees correct layout immediately
}, [])
HookTimingUse when
useEffectAfter paint (async)Data fetching, subscriptions, analytics, timers, logging
useLayoutEffectBefore paint (sync)DOM measurement, scroll position, focus management, preventing flicker

Rule: If you're about to write useEffect, ask: "Does this touch the DOM or could it cause a visual flicker?" If yes → useLayoutEffect.

Decision Tree: Data Fetching

Where is the data needed?
├── Server Component → fetch() or direct DB call
│   ├── Static data? → cache: 'force-cache' (default)
│   ├── Dynamic data? → cache: 'no-store'
│   ├── Timed revalidation? → next: { revalidate: N }
│   └── On-demand revalidation? → revalidateTag() / revalidatePath()
├── Client Component (real-time / polling) → useSWR or TanStack Query
└── Mutation → Server Action

Key rule: Fetch data in Server Components, pass to Client Components as props. Use SWR/TanStack Query only for client-side polling, optimistic UI, or real-time data.

For detailed patterns, see references/data-fetching.md.

Decision Tree: Forms & Mutations

Form submission?
├── Simple form → Server Action with <form action={}>
│   └── Need pending state? → useActionState + useFormStatus
├── Complex form (multi-step, validation) → React Hook Form + Zod
│   └── Submit via Server Action or API route
└── Optimistic UI needed? → useOptimistic + Server Action

Key rule: Use Server Actions for mutations. Use React Hook Form + Zod for complex client-side validation. Validate on both client AND server.

For detailed patterns, see references/forms-and-mutations.md.

Project Structure

Standard folder layout — each folder has ONE purpose:

src/
├── app/            # Routes, layouts, pages + view.tsx files ONLY
├── components/     # Reusable UI components (ui/ + feature-specific/)
├── actions/        # Server Actions organized by domain
├── config/         # App config, env wrappers, third-party setup
├── constants/      # App-wide constant values
├── context/        # React context providers
├── hooks/          # Custom React hooks
├── lib/            # Utilities and reusable libraries (cn(), formatDate(), db client)
├── providers/      # App-wide providers (auth, theme, query client, Zustand, etc.)
├── store/          # Client state management (Zustand, etc.)
├── styles/         # Global styles, Tailwind config
├── types/          # Shared TypeScript types/interfaces
└── validation/     # Zod schemas for forms and Server Actions

Placement rules:

  • Route files (page.tsx, view.tsx, layout.tsx, loading.tsx) → app/
  • Anything reusable across routes → appropriate folder above
  • Never put business logic in app/ — only data fetching and composition

Clean Layout Rule (MANDATORY)

Always use a single providers.tsx in the providers/ folder that composes all app-wide providers. The root layout.tsx stays clean — it only imports Providers and wraps {children}.

// providers/providers.tsx — Single entry point for all providers
'use client'

import { AuthProvider } from './auth-provider'
import { ThemeProvider } from './theme-provider'
import { QueryProvider } from './query-provider'
import type { User } from '@/types'

interface ProvidersProps {
  user: User | null
  children: React.ReactNode
}

export function Providers({ user, children }: ProvidersProps) {
  return (
    <QueryProvider>
      <AuthProvider user={user}>
        <ThemeProvider>
          {children}
        </ThemeProvider>
      </AuthProvider>
    </QueryProvider>
  )
}
// app/layout.tsx — Clean. Only structure + Providers.
import { Providers } from '@/providers/providers'
import { getCurrentUser } from '@/config/auth'
import '@/styles/globals.css'

export default async function RootLayout({ children }: { children: React.ReactNode }) {
  const user = await getCurrentUser()

  return (
    <html lang="en">
      <body>
        <Providers user={user}>
          {children}
        </Providers>
      </body>
    </html>
  )
}

When adding a new provider: Add it inside providers.tsx — never touch layout.tsx.

For detailed conventions and examples, see references/project-structure.md.

Performance Quick Reference

PriorityRuleAction
CRITICALEliminate waterfallsUse Promise.all(), parallel fetches, <Suspense>
CRITICALBundle sizeImport directly (no barrel files), next/dynamic for heavy components
HIGHServer performanceReact.cache() for dedup, minimize RSC → Client serialization
MEDIUMClient dataSWR/TanStack Query for dedup, passive event listeners
MEDIUMRe-rendersmemo() for expensive components, functional setState

For full performance guide, see references/performance.md.

Code Review Checklist

Quick checks when reviewing Next.js code:

  1. 'use client' only where needed? (not at page/layout level)
  2. Data fetched in Server Components, not Client?
  3. Server Actions validate input on server side?
  4. No secrets/env vars leaked to client bundle?
  5. loading.tsx or <Suspense> for async content?
  6. Images use next/image, links use next/link?
  7. Metadata exported from pages/layouts?
  8. No unnecessary useEffect for data that could be server-fetched?

For full checklist, see references/code-review-checklist.md.

平台分布

Codex

38.59%
按下载量换算24

Claude

29.52%
按下载量换算19

Cursor

19.43%
按下载量换算12

Gemini CLI

8.65%
按下载量换算5

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills