skillsync

api-docs

Writes reference documentation for an HTTP API endpoint from its code, route definition or OpenAPI snippet: purpose, parameters, example request and response, and errors. Use when the user asks to document an API or write API docs.

Ask your agent

What it does

A reference page per endpoint with parameters, a curl example, a sample response and every error it can return.

SKILL.md
---
name: api-docs
description: "Writes reference documentation for an HTTP API endpoint from its code, route definition or OpenAPI snippet: purpose, parameters, example request and response, and errors. Use when the user asks to document an API or write API docs."
---

# API docs

Write the reference page a developer needs to call an endpoint correctly on the first try. Use
endpoint-template.md for the layout.

## Gather first

From the code, route or spec, find: method and path, authentication, path/query/body parameters with
types and whether they're required, the success response, and every error status the handler can return.
If something can't be found (for example a rate limit), mark it **TODO** rather than inventing it.

## Steps

1. **Purpose**: one sentence on what the endpoint does, starting with a verb ("Creates an invoice…").
2. **Parameters**: a table per location (path, query, body). Type, required, default, and a
   description that says what values are allowed, not just the type.
3. **Example request**: a runnable `curl` with realistic values. Use `$API_TOKEN` for secrets.
4. **Example response**: real field names, realistic values, and trim long arrays to one or two items.
5. **Errors**: every status code with its error code and what the caller should do about it.
6. **Notes**: idempotency, pagination, rate limits and side effects (emails sent, webhooks fired).

## Style

- Second person, present tense: "Returns…", "You can…".
- Field names in `code`. Units always stated (cents, seconds, bytes).
- Never document internal-only fields or debug flags.
2 files
  • SKILL.md1.6 KB
  • endpoint-template.md0.6 KB