← 返回 Skills 市场
134
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install nextjs-patterns
功能描述
Apply Next.js 15 best practices and modern patterns including App Router, Server Components, Server Actions, caching strategies, and performance optimization...
使用说明 (SKILL.md)
Next.js 15 Best Practices
Core Principles
- Default to Server Components — only add
"use client"when you need interactivity or browser APIs - Colocate by feature — keep components, hooks, and utils near the routes that use them
- Type everything — leverage TypeScript with strict mode enabled
- Cache deliberately — understand the four caching layers and opt in/out explicitly
Project Structure
app/
(marketing)/ # route group: no URL segment
page.tsx
(dashboard)/
layout.tsx
[id]/
page.tsx
api/
route.ts
components/
ui/ # shared, "dumb" UI components
features/ # feature-specific components
lib/
db.ts # database client (singleton)
auth.ts # auth helpers
utils.ts
Server vs. Client Components
// ✅ Server Component (default) — runs on server, no JS sent to client
export default async function ProductList() {
const products = await db.product.findMany()
return \x3Cul>{products.map(p => \x3Cli key={p.id}>{p.name}\x3C/li>)}\x3C/ul>
}
// ✅ Client Component — only when needed
"use client"
import { useState } from "react"
export function Counter() {
const [n, setN] = useState(0)
return \x3Cbutton onClick={() => setN(n + 1)}>{n}\x3C/button>
}
Data Fetching Patterns
// Parallel fetching (avoid sequential waterfalls)
export default async function Dashboard() {
const [user, stats] = await Promise.all([
fetchUser(),
fetchStats(),
])
return \x3CView user={user} stats={stats} />
}
// fetch with cache control
const data = await fetch("https://api.example.com/data", {
next: { revalidate: 60 }, // ISR: revalidate every 60s
// cache: "no-store" // always fresh
// cache: "force-cache" // static, until manual revalidation
})
Server Actions
// app/actions.ts
"use server"
import { revalidatePath } from "next/cache"
export async function createPost(formData: FormData) {
const title = formData.get("title") as string
await db.post.create({ data: { title } })
revalidatePath("/posts")
}
// app/posts/new/page.tsx
import { createPost } from "../actions"
export default function NewPost() {
return (
\x3Cform action={createPost}>
\x3Cinput name="title" />
\x3Cbutton type="submit">Create\x3C/button>
\x3C/form>
)
}
Metadata & SEO
// Static metadata
export const metadata = {
title: "My App",
description: "...",
}
// Dynamic metadata
export async function generateMetadata({ params }) {
const post = await fetchPost(params.slug)
return { title: post.title, description: post.excerpt }
}
Error & Loading States
// app/posts/loading.tsx — automatic Suspense boundary
export default function Loading() {
return \x3CSkeleton />
}
// app/posts/error.tsx — automatic error boundary
"use client"
export default function Error({ error, reset }) {
return \x3Cbutton onClick={reset}>Retry: {error.message}\x3C/button>
}
Performance Checklist
- Images use
next/imagewith explicitwidth/height - Fonts use
next/font(zero layout shift) - Dynamic imports for heavy client components:
dynamic(() => import(...)) -
generateStaticParamsfor known dynamic routes - Bundle analyzer run:
ANALYZE=true next build - Partial Prerendering (PPR) considered for mixed static/dynamic pages
References
See references/ folder for routing patterns, caching deep-dive, and migration guide.
安全使用建议
This skill appears to be a documentation/reference pack for Next.js 15 and is internally consistent. Before running any example commands you should: (1) confirm the author/source since the registry metadata has no homepage; (2) review any shell commands (npx/npm) before executing them locally; (3) never paste real secrets into example code — examples reference DATABASE_URL and NEXT_PUBLIC_API_URL but the skill does not need them; and (4) if you prefer the agent not to use this skill autonomously, adjust agent skill invocation settings (autonomous invocation is enabled by default but the skill itself does not request extra privileges).
功能分析
Type: OpenClaw Skill
Name: nextjs-patterns
Version: 1.0.0
The skill bundle provides comprehensive documentation and code examples for Next.js 15 best practices, including App Router patterns, Server Actions, and caching strategies. All content across SKILL.md and the reference files is educational and aligns with official framework documentation without any indicators of malicious intent, prompt injection, or security risks.
能力评估
Purpose & Capability
Name/description match contents: the skill is a collection of Next.js 15 patterns, migration notes, caching and routing guidance. There are no unexplained env vars, binaries, or installs required by the skill.
Instruction Scope
SKILL.md and reference files contain code examples and advice for building/reviewing apps. The instructions do not direct the agent to read local files, exfiltrate data, or call endpoints outside illustrative examples. Some examples reference db clients and process.env as typical sample code, but the skill does not instruct the agent to access actual credentials or system files.
Install Mechanism
No install spec and no code to write to disk (instruction-only). Guidance includes common commands (npx, npm) as examples for upgrading Next.js, which is expected for a migration guide; the skill itself does not perform downloads.
Credentials
Requires no environment variables or credentials. Reference docs mention typical env names (DATABASE_URL, NEXT_PUBLIC_API_URL) only as examples; nothing in the skill attempts to access or require user secrets.
Persistence & Privilege
always is false and there are no install hooks or configuration changes. The skill does not request persistent runtime presence or elevated privileges.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install nextjs-patterns - 安装完成后,直接呼叫该 Skill 的名称或使用
/nextjs-patterns触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release
元数据
常见问题
Next.js 15 Best Practices 是什么?
Apply Next.js 15 best practices and modern patterns including App Router, Server Components, Server Actions, caching strategies, and performance optimization... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 134 次。
如何安装 Next.js 15 Best Practices?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install nextjs-patterns」即可一键安装,无需额外配置。
Next.js 15 Best Practices 是免费的吗?
是的,Next.js 15 Best Practices 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Next.js 15 Best Practices 支持哪些平台?
Next.js 15 Best Practices 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Next.js 15 Best Practices?
由 Hjs102468(@goldath)开发并维护,当前版本 v1.0.0。
推荐 Skills