vercel/next.js/.agents/skills/write-api-reference/SKILL.md
write-api-reference
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 referen
- Source repository stars
- 141,364
- Declared platforms
- 0
- Static risk flags
- 1
- Last source update
- 2026-08-05
- Source checked
- 2026-08-05
Decision brief
What it does—and where it fits
Produces API reference documentation for Next. js APIs: functions, components, file conventions, directives, and config options.
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/vercel/next.js --skill ".agents/skills/write-api-reference"Inspect the Agent Skill "write-api-reference" from https://github.com/vercel/next.js/blob/bcea67d4e96fbaf8c51f50951e497724d2a02cfb/.agents/skills/write-api-reference/SKILL.md at commit bcea67d4e96fbaf8c51f50951e497724d2a02cfb. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Workflow
1. Ask for reference material. Ask the user if they have any RFCs, PRs, design docs, or other context that should inform the doc. 2. Identify the API category (function, component, file convention, directive, config). 3. Research the implementation. Read the source code to under…
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. - 02
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.
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. - 03
Structure
Identify which category the API belongs to, then follow the corresponding template.
Function (cookies, fetch, generateStaticParams): signature, params/returns, methods table, examplesComponent (Link, Image, Script): props summary table, individual prop docs, examplesFile convention (page, layout, route): definition, code showing the convention, props, behavior, examples - 04
Categories
1. Function (cookies, fetch, generateStaticParams): signature, params/returns, methods table, examples 2. Component (Link, Image, Script): props summary table, individual prop docs, examples 3. File convention (page, layout, route): definition, code showing the convention, props…
Function (cookies, fetch, generateStaticParams): signature, params/returns, methods table, examplesComponent (Link, Image, Script): props summary table, individual prop docs, examplesFile convention (page, layout, route): definition, code showing the convention, props, behavior, examples - 05
Template
tsx filename="path/to/file.tsx" switcher // Minimal working usage jsx filename="path/to/file.js" switcher // Same example in JS
tsx filename="path/to/file.tsx" switcher // Minimal working usage jsx filename="path/to/file.js" switcher // Same example in JS
Permission review
Static risk signals and limitations
Network access
The documentation includes network, browsing, or remote request actions.
**Check e2e tests.** Search `test/` for tests exercising the API to find real usage patterns, edge cases, and expected behavior.Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 89/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 141,364 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- vercel/next.js
- Skill path
- .agents/skills/write-api-reference/SKILL.md
- Commit
- bcea67d4e96fbaf8c51f50951e497724d2a02cfb
- License
- MIT
- Collected
- 2026-08-05
- Default branch
- canary
View the original SKILL.md
Writing 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
Alternatives
Compare before choosing
vercel/next.js
insight-error-page
Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new `errors/<slug>.mdx` page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification against canonical docs, and Vercel technical writing style.
alirezarezvani/claude-skills
code-to-prd
Reverse-engineer any codebase into a complete Product Requirements Document (PRD). Analyzes routes, components, state management, API integrations, and user interactions to produce business-readable documentation detailed enough for engineers or AI agents to fully reconstruct every page and endpoint. Works with frontend frameworks (React, Vue, Angular, Svelte, Next.js, Nuxt), backend frameworks (NestJS, Django, Express, FastAPI), and fullstack applications. Use when users mention: generate PRD,
heroui-inc/heroui
heroui-react
HeroUI v3 React component library (Tailwind CSS v4 + React Aria). Use when building UIs with HeroUI — creating Buttons, Modals, Forms, Cards; installing @heroui/react; configuring dark/light themes with oklch variables; or fetching component docs. Keywords: HeroUI, Hero UI, heroui, @heroui/react, @heroui/styles.
affaan-m/ECC
documentation-lookup
Use up-to-date library and framework docs via Context7 MCP instead of training data. Activates for setup questions, API references, code examples, or when the user names a framework (e.g. React, Next.js, Prisma).