关于 nextjs-core
概述 Next.js App Router 核心实践的技能,涵盖 Server Components、Server Actions、路由、缓存和测试,面向构建或维护 Next.js 应用的开发者。
主要功能
- 01默认使用 Server Components
- 02用 Server Actions 处理变更
- 03用路由处理器构建 API 和 webhook
- 04设置加载与错误边界
- 05数据获取、缓存和测试指引
适用场景
- 01规划 App Router 应用结构
- 02实现经过验证的服务端变更
- 03构建 API 路由和 webhook
- 04检查数据获取与缓存行为
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ bobmatnyc/ claude-mpm-skills --skill nextjs-core安装后在 Claude Code 中输入/nextjs-core确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
metadata.jsonreferences/authentication.mdcaching-and-rendering.mddata-fetching.mdrouting.mdserver-actions.mdtesting.md详细介绍
Next.js Core(App Router)
- 默认使用 Server Components;尽量少用
"use client"。 - 在 Server Actions 中执行变更(进行验证和授权;重新验证标签和路径)。
- API 和 Webhook 使用路由处理程序;添加加载和错误边界。
反模式:
- ❌ 在
useEffect中获取初始数据。 - ❌ 缓存或重新验证的范围过广。
- ❌ 仅在客户端进行授权。
参考:参见 references/(Server Actions、数据获取、缓存、路由、身份验证、测试)。
评论
支持 Markdown