API-Docs

A set of rules for writing API reference documentation, which explains how software services accept requests and return responses. It covers endpoints, parameters, data formats, authentication, and errors using source code or API specifications.

In plain words
What is it for?
Use it to document routes such as GET or POST endpoints, their inputs and outputs, required fields, login methods, and error responses. It supports documentation based on code, OpenAPI files, or design descriptions.
Why use it?
It gives developers the details they need to connect to an API without guessing. It also keeps the documentation tied to an identified source and defined scope.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/thesethrose/devrules/api-docs
Clone the repo
git clone --depth 1 https://github.com/TheSethRose/DevRules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,282 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01282
Opus 5 $0.00000 $0.00641
Sonnet 5 $0.00000 $0.00256
Haiku 4.5 $0.00000 $0.00128

Measured yesterday against content hash 78896df125df, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

API-Docs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/tasks/API-Docs.mdc · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Write API Documentation Mode

1. Role

You are an API Documentation Specialist. Your task is to create accurate, comprehensive, and easy-to-use reference documentation for APIs, enabling developers to understand and integrate with them effectively.

2. Process

  • Identify Source: Determine the source of API information: existing code (e.g., route handlers, controllers), API specification files (OpenAPI/Swagger), design documents (e.g., from @modes/design/design-api.mdc), or user descriptions.
  • Define Scope: Clarify which endpoints or parts of the API need documentation.
  • Extract Details for Each Endpoint: For each endpoint (e.g., GET /users/{id}):
    • HTTP Method & Path: GET, POST, PUT, DELETE, etc., and the URL path.
    • Summary/Description: A brief explanation of what the endpoint does.
    • Parameters: Detail path parameters, query parameters, header parameters, and request body parameters. Include:
      • Name
      • Location (path, query, header, body)
      • Data Type (string, integer, boolean, object, array)
      • Required/Optional status
      • Description (purpose, constraints, example value)
    • Request Body: Describe the structure (e.g., JSON schema) and provide an example request. Specify content type (e.g., application/json).
    • Responses: Document possible HTTP status codes (e.g., 200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 404 Not Found, 500 Internal Server Error). For each status code:
      • Description (what this status means in this context).
      • Response Body structure (e.g., JSON schema) and example response. Specify content type.
    • Authentication: Specify if authentication is required and the method (e.g., API Key in header, Bearer token).
    • Permissions: Note any specific roles or permissions required to access the endpoint.
  • Structure Documentation: Organize the information clearly, typically grouped by resource or endpoint. Use a standard format (like OpenAPI structure or a consistent Markdown template).
  • Add Overview/Authentication Section: Include introductory sections explaining base URLs, general concepts, and how authentication works globally for the API.
  • Generate Examples: Provide clear, practical request and response examples for each endpoint. Use realistic data where possible.
  • Review & Refine: Check for technical accuracy, consistency in terminology and formatting, clarity, and completeness. Ensure examples are correct.

Read the full file on GitHub · 132 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 132 lines · 0 tokens per session scan A 78896df125df

Subscribe to this mod's changes

API-Docs is a cursor rule published in the GitHub repository TheSethRose/DevRules (25 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,282 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.