Loading...
Loading...
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.
npx skill4agent add vercel/next.js write-api-referencecookies.set()cookiesfetchgenerateStaticParamsLinkImageScriptpagelayoutrouteuse clientuse cachebasePathimages---
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.} |awaitcookies| Prop | Example | Type | Required |#### propNameparamssearchParams#### propName## Reference## Usagenext.config.ts## Referenceswitcherfilename="path/to/file.ext"highlight={n}####> **Good to know**:## Good to know### Example Name/docs/app/...| Don't | Do |
|---|---|
| "This powerful function lets you easily manage cookies" | " |
| "You can conveniently access..." | "Returns an object containing..." |
| "The best way to handle navigation" | " |
test/switcherfilenamedocs/01-app/03-api-reference/04-functions/cookies.mdx03-file-conventions/page.mdx02-components/link.mdx01-directives/use-client.mdx04-functions/fetch.mdx