write-api-reference
预览截图
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "write-api-reference":https://skillpi.com/zh/skills/deepskill-fa25d3ae9e3dd52114b922a65a3d612870dcc0bb640c0dfb82d1323f1ee17e11。安装前核对上游来源和版本:https://github.com/vercel/next.js。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
为 Next.js API 生成 API 参考文档:包括函数、组件、文件约定、指令和配置选项。自动激活条件:用户请求编写、创建或起草 API 参考页面;当路径包含 docs/01-app/03-api-reference/,或出现关键词如“API 参考”、“属性(props)”、“参数(parameters)”、“返回值(returns)”、“签名(signature)”时也会触发。输入来源:Next.js 源代码、现有的 API 参考页面,或用户提供的规范说明。输出类型:一个 Markdown(.mdx)格式的 API 参考页面,包含 YAML 前置元数据、使用示例、参考章节、行为说明及示例代码。
介绍来源: third_party · vercel · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 制作一个 API 参考页,用于记录单个 API 表面(功能、组件、文件常规、指令或配置选项) 。 页面应当简洁,可扫描,以实例为导向.
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: write-api-reference
description: |
Produces API reference documentation for Next.js APIs: functions, components, file conventions, directives, and config options.
**Auto-activation:** User asks to write, create, or draft an API reference page. Also triggers on paths like `docs/01-app/03-api-reference/`, or keywords like "API reference", "props", "parameters", "returns", "signature".
**Input sources:** Next.js source code, existing API reference pages, or user-provided specifications.
**Output type:** A markdown (.mdx) API reference page with YAML frontmatter, usage example, reference section, behavior notes, and examples.
agent: Plan
context: fork
metadata:
internal: trueWriting API Reference Pages
Goal
Produce an API reference page that documents a single API surface (function, component, file convention, directive, or config option). The page should be concise, scannable, and example-driven.
Each page documents one API. If the API has sub-methods (like cookies.set()), document them on the same page. If two APIs are independent, they get separate pages.
Structure
Identify which category the API belongs to, then follow the corresponding template.
Categories
- Function (
cookies,fetch,generateStaticParams): signature, params/returns, methods table, examples - Component (
Link,Image,Script): props summary table, individual prop docs, examples - File convention (
page,layout,route): definition, code showing the convention, props, behavior, examples - Directive (
use client,use cache): definition, usage, serialization/boundary rules, reference - Config option (
basePath,images, etc.): definition, config code, behavioral sections
Template
---
title: {API name}
description: {API Reference for the {API name} {function|component|file convention|directive|config option}.}
---
{One sentence defining what it does and where it's used.}
```tsx filename="path/to/file.tsx" switcher
// Minimal working usage
```
```jsx filename="path/to/file.js" switcher
// Same example in JS
```
## Reference
{For functions: methods/params table, return type.}
{For components: props summary table, then `#### propName` subsections.}
{For file conventions: `### Props` with `#### propName` subsections.}
{For directives: usage rules and serialization constraints.}
{For config: options table or individual option docs.}
### {Subsection name}
{Description + code example + table of values where applicable.}
## Good to know
- {Default behavior or implicit effects.}
- {Caveats, limitations, or version-specific notes.}
- {Edge cases the developer should be aware of.}
## Examples
### {Example name}
{Brief context, 1-2 sentences.}
```tsx filename="path/to/file.tsx" switcher
// Complete working example
```
```jsx filename="path/to/file.js" switcher
// Same example in JS
```
## Version History
| Version | Changes |
| -------- | --------------- |
| `vX.Y.Z` | {What changed.} |
Category-specific notes:
- Functions: Lead with the function signature and
awaitif async. Document methods in a table if the return value has methods (likecookies). Document options in a separate table if applicable. - Components: Start with a props summary table (
| Prop | Example | Type | Required |). Then document each prop under#### propNamewith description, code example, and value table where useful. - File conventions: Show the default export signature with TypeScript types. Document each prop (
params,searchParams, etc.) under#### propNamewith a route/URL/value example table. - Directives: No
## Referencesection. Use## Usageinstead, showing correct placement. Document serialization constraints and boundary rules. - Config options: Show the
next.config.tssnippet. Use subsections for each behavioral aspect.
Rules
- Lead with what it does. First sentence defines the API. No preamble.
- Show working code immediately. A minimal usage example appears right after the opening sentence, before
## Reference. - Use
switcherfor tsx/jsx pairs. Always include both. Always includefilename="path/to/file.ext". - Use
highlight={n}for key lines. Highlight the line that demonstrates the API being documented. - Tables for simple APIs, subsections for complex ones. If a prop/param needs only a type and one-line description, use a table row. If it needs a code example or multiple values, use a
####subsection. - Behavior section uses `> Good to know:
or## Good to know`. Use the blockquote format for brief notes (1-3 bullets). Use the heading format for longer sections. Not "Note:" or "Warning:". - Examples section uses
### Example Namesubsections. Each example solves one specific use case. - Version History table at the end. Include when the API has changed across versions. Omit for new APIs.
- No em dashes. Use periods, commas, or parentheses instead.
- Mechanical, observable language. Describe what happens, not how it feels. "Returns an object" not "gives you an object".
- Link to related docs with relative paths. Use
/docs/app/...format. - No selling or justifying. No "powerful", "easily", "simply". State what the API does.
| Don't | Do |
|---|---|
| "This powerful function lets you easily manage cookies" | "cookies is an async function that reads HTTP request cookies in Server Components" |
| "You can conveniently access..." | "Returns an object containing..." |
| "The best way to handle navigation" | "<Link> extends the HTML <a> element to provide prefetching and client-side navigation" |
- Bridge new framework terms with legacy or generic vocabulary. When the API renames or differentiates from a prior concept (Pages-era term, generic web term, REST vocabulary), include one such synonym in the frontmatter
descriptionand once in prose. Example:description: "Use Dynamic Segments to read URL parameters and generate routes from dynamic data."mentions "URL parameters" alongside "Dynamic Segments". One synonym, folded into natural prose. No separate "Synonyms" or "Also known as" section, no keyword stuffing. Goal: preserve discoverability for users still searching the old vocabulary even when the framework has moved on.
| Don't | Do |
|---|---|
| "Learn how to use Route Handlers" | "Build API endpoints with Route Handlers, the App Router replacement for API Routes" |
| "Configure dynamic route segments" | "Read URL parameters from dynamic route segments" |
Workflow
- Ask for reference material. Ask the user if they have any RFCs, PRs, design docs, or other context that should inform the doc.
- Identify the API category (function, component, file convention, directive, config).
- Research the implementation. Read the source code to understand params, return types, edge cases, and defaults.
- Check e2e tests. Search
test/for tests exercising the API to find real usage patterns, edge cases, and expected behavior. - Check existing related docs for linking opportunities and to avoid duplication.
- Write using the appropriate category template. Follow the rules above.
- Review against the rules. Verify: one sentence opener, immediate code example, correct
switcher/filenameusage, tables vs subsections, "Good to know" format, no em dashes, mechanical language.
References
Read these pages in docs/01-app/03-api-reference/ before writing. They demonstrate the patterns above.
04-functions/cookies.mdx- Function with methods table, options table, and behavior notes03-file-conventions/page.mdx- File convention with props subsections and route/URL/value tables02-components/link.mdx- Component with props summary table and detailed per-prop docs01-directives/use-client.mdx- Directive with usage section and serialization rules04-functions/fetch.mdx- Function with troubleshooting section and version history
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 解决开发者编写 Next.js API 参考文档的高频刚需,显著提升文档生成效率
- 功能闭环完整,覆盖函数、组件、文件约定、指令、配置五大类别
亮点
- 触发词覆盖全面且边界清晰,支持路径匹配与关键词双重触发机制
亮点
- 结构清晰完整,提供标准化模板与详细规则,确保输出一致性
- 包含完整的端到端示例与分类指导,便于执行
亮点
- 基于源码与测试数据生成文档,确保准确性与可靠性
- 规范处理多语言示例与类型标注,覆盖主要使用场景
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。