/ceh-documentation:write-api-referencefrom ceh-documentation
Load this skill when writing a project's user-facing reference docs: every public function, endpoint, CLI flag, config key, environment variable, and error. Trigger on "write the API reference", "document every endpoint", "document all the CLI flags".
Ships in ceh-documentation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The reference is the only exhaustive page type in a docs set. Every other page is allowed to be selective because this one is not: a guide shows the three options a task needs and links here for the other twenty. A reference entry that is missing sends the reader to the source. A reference entry that teaches crowds out the lookup.
Work against <root>: the project path handed over by the caller, or the current working
directory. Write under <root>/docs/reference/. Read
${CLAUDE_SKILL_DIR}/references/docs-standard.md ("the standard" below) before writing: it fixes
the page anatomy, Markdown and link rules, markers (_Added in <version>._, the deprecation
blockquote, [VERIFY: …]), and report format used here.
Check for mkdocstrings (::: directives, plugins: in mkdocs.yml), Sphinx autodoc
(conf.py extensions), TypeDoc (typedoc.json), or a committed or served OpenAPI spec.
A spec or docstrings that exist but are not wired into the docs build (FastAPI serving
/openapi.json at runtime, docstrings with no mkdocstrings) count as not configured.
Enumerate before writing. The surface is what a user can reach without importing a private path.
| Project kind | The surface is |
|---|---|
| Python library | Names in __all__, else the non-underscore names re-exported from the package __init__.py; the classes' public methods and attributes |
| TypeScript / JS library | The exports / main / types entries in package.json and everything their index files re-export, including type-only exports (interfaces, type aliases) |
| HTTP API | Every route in the router files or the OpenAPI spec: method, path, auth, request, response, status codes |
| CLI | Every command, subcommand, flag, and positional from the argparse / click / typer / commander definitions — cross-check against --help output when the CLI runs |
| Every kind | Configuration: env vars read (os.environ, getenv, process.env, settings classes), config file keys, their defaults. Errors: exception classes and error codes a user can receive |
Counting rules, so two runs count the same thing:
__len__ → len(q)), never __init__: the
constructor is documented on the class entry./docs, /openapi.json, /redoc) count as
one item: a single entry headed Framework routes on reference/service.md, which also holds
health and other non-resource endpoints, listing each path in a table.422 validation error) count as one item: one grouped entry in errors.md.[project.scripts] or bin target counts as the CLI, not also as API.TypeError for a non-string) and each CLI usage or exit-code error count as one Errors item
each.__all__ counts under Errors, not also under
the API.Record the total per kind. That count is the coverage target. The report states
N of M documented.
docs/reference/
├── index.md # every page, one line each: what it covers
├── <module>.md # one page per public module / resource / command group
├── cli.md # when there is a CLI
├── configuration.md # every env var and config key
└── errors.md # every exception / error code
Reference pages are named after the code, not by the <PREFIX>-<NN> reading-order scheme the
guide pages use: nobody reads a reference in order, they arrive by name, and a filename that
mirrors the module is the one they guess. Each page gets a breadcrumb under its H1,
[← Reference](index.md), and no prev/next footer.
The page H1 is the public import path (tinyq, not tinyq.queue) or the resource name (Notes).
Within a page, group by kind and sort alphabetically inside each group, so a lookup never depends on knowing the source order:
## Classes, each class entry followed by its members as ### `Class.member`
(methods, then attributes, alphabetical); then ## Functions, then ## Constants, then
## Types for exported interfaces and type aliases.reference/cli.md, one ### per command (### `slugkit`, ### `tool sync`),
its usage line in a text block, flags and positionals as rows of one table (Name, Type,
Default, Description), then an exit-code table (Code, Meaning).GET, POST, PUT, PATCH, DELETE. A CRUD reader expects that order, not the
alphabet.`404 note not found`).### `Client.stream`
Stream a completion token by token. _Added in v2.3.0._
```python
def stream(self, prompt: str, *, model: str | None = None, timeout: float = 60.0) -> Iterator[Chunk]
```
| Parameter | Type | Default | Description |
| --------- | ------------- | -------- | ---------------------------------------------------------------- |
| `prompt` | `str` | required | The input text. |
| `model` | `str \| None` | `None` | Model id; `None` uses the client default. |
| `timeout` | `float` | `60.0` | Seconds before `TimeoutError`, measured per chunk, not per call. |
- **Returns:** `Iterator[Chunk]` — yields as tokens arrive.
- **Raises:** [`RateLimitError`](errors.md#ratelimiterror) when the quota is exhausted.
- **Why per-chunk timeout:** see [Streaming](../concepts/CO-03-streaming.md#why-it-works-this-way).
Signature, types, and defaults come from the code, copied, never retyped from memory.
The description comes from the docstring. Normalize it lightly (capitalize, end with a
period, move "Raises X" into the Raises line) without changing its meaning. Where there is none,
describe only behavior the code makes plain; otherwise write [VERIFY: purpose of X].
Show an example only when usage is not obvious from the signature. The guides carry the worked usage.
Surprising behavior gets a "Why" link to the concept page that explains it. The reference states what, the concept states why. Never inline the rationale here.
Deprecated items carry the standard's deprecation blockquote on the line after the heading:
> **Deprecated in <version>:** use <replacement>. Removed in <version>.
HTTP endpoints use this shape instead of a signature:
### `POST /notes`
Create a note. **Auth:** `x-api-key` header.
| Request field | In | Type | Required | Description |
| ------------- | ----- | -------- | -------- | -------------------------------------------------- |
| `body` | query | `string` | yes | Note text, at most `NOTESVC_MAX_NOTE_BYTES` bytes. |
| Status | Body | When |
| ------ | ------------------------------ | --------------------------------------------------------- |
| `201` | `{"id": 1, "body": "…"}` | Created. |
| `413` | `{"detail": "note too large"}` | See [`413 note too large`](errors.md#413-note-too-large). |
errors.md entries: when it is raised, what the user did to cause it, how to fix it. The guide
troubleshooting page links here by error name.
Experienced users open the reference to find what is new. Mark items added in the last three
releases, never the initial release. With fewer than two releases there is nothing to mark. Use
_Changed in <version>: <what>._ for a changed default or behavior in the same window. Marker
formats and placement follow standard §7.
git -C <root> tag --sort=-creatordate | head -4 # newest tags
git -C <root> diff <older-tag>..<newer-tag> -- <public source paths>
A public name that first appears in a range's diff is Added in <newer-tag>, spelled as the tag
spells it (standard §7). When CHANGELOG.md places the addition in a different release, the
changelog wins on which release. With no tags, date items from CHANGELOG.md alone and spell the
version as its heading does. With neither tags nor a changelog, omit the markers.
errors.md entry.${CLAUDE_SKILL_DIR}/references/docs-standard.md §4–§7: anatomy,
Markdown, links, markers.[VERIFY: …] instead of guessing.Pages under <root>/docs/reference/. End the reply with the report of
${CLAUDE_SKILL_DIR}/references/docs-standard.md §10. When write-project-docs called this skill,
return only the rows, open items, and coverage line for it to merge. Put the coverage line above
the table in the form of standard §10, and the generator recommendation when no reference generator
is wired into the docs build. Open items include every undocumented surface item.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub cheneeheng/ceh-claude-code-library --plugin ceh-documentation5 skills in this plugin
/write-concept-docsLoad this skill when writing user-facing concept pages: the mental model a user needs (core objects, lifecycle, data flow, error model) and why. Trigger on "explain how this works in the docs", "write a concepts section". Not for a maintainer architecture doc./write-examplesLoad this skill when writing runnable example programs under examples/: a feature tour and copy-paste recipes, each run before it is kept. Trigger on "write examples for this project", "add usage examples", "the examples are missing or broken"./write-guides-and-runbooksLoad this skill when writing or revising task docs for users or operators: user guides, getting-started and install guides, runbooks, troubleshooting. Trigger on "write a user guide", "ops runbook", "getting-started guide". Not for a whole docs set (use write-project-docs)./write-project-docsLoad this skill when writing a complete docs set under docs/: quickstart, guides, concepts, API reference, examples, troubleshooting. Trigger on "document this project", "write the docs for this library", "build out the docs folder". Not for a README refresh.