agentleFS
KhaledSaeed18KhaledSaeed18/node-express-boilerplate/.agents/skills/add-openapi-docs/SKILL.md

add-openapi-docs

Skill36 starsChanged 4 months agoMITView on GitHub

Add or update OpenAPI 3.1 documentation for API endpoints in src/docs/. Use when the user asks to document endpoints, add Swagger/OpenAPI docs, or when a new resource or route was added without docs.

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When the user asks to document an endpoint or resource, follow this sequence.

    line 6
  2. Distinctive:

    Add component schemas for the resource:

    line 16
  3. Distinctive:

    All response codes actually produced: 200/201, 400 (validation), 401, 403 (CSRF or ownership), 404, 409 (conflict), 429

    line 36
  4. Very specific:

    If the resource introduces a new tag, add it to the tags array with a description.

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

When the user asks to document an endpoint or resource, follow this sequence. The spec is assembled at import time in src/docs/index.ts and served by swagger-ui-express at /api-docs.

Variables

  • <Name> = PascalCase singular (e.g. Note)
  • <name> = camelCase singular (e.g. note)
  • <names> = camelCase plural (e.g. notes)

Step 1 — Schemas (src/docs/schemas.ts)

Add component schemas for the resource:

  • <Name> — the response entity shape (must match <Name>ResponseDTO in src/types/, never include password/token/internal fields)
  • Create<Name>Request and Update<Name>Request — must match the Zod schemas in src/validations/<name>.validation.ts exactly (required fields, min/max lengths, formats)

Reuse the existing shared schemas: ErrorResponse, PaginatedResponse, SuccessResponse.

Step 2 — Paths (src/docs/paths/<name>.paths.ts)

Copy the structure of src/docs/paths/note.paths.ts. It defines reusable local constants — keep the same ones:

  • csrfHeader — required x-csrf-token header parameter on every mutating operation (POST/PUT/PATCH/DELETE)
  • rateLimitHeaders — X-RateLimit-* response headers with the route group's actual limit
  • authErrors — shared 401/403/429 responses referencing #/components/schemas/ErrorResponse
  • paginationParams — page/limit query params on list endpoints

For every operation document:

  • tags, summary, description (mention auth + rate limit)
  • Request body referencing the component schema, with a realistic example
  • All response codes actually produced: 200/201, 400 (validation), 401, 403 (CSRF or ownership), 404, 409 (conflict), 429
  • security: [{ bearerAuth: [] }, { cookieAuth: [] }] on protected endpoints

Export const <name>Paths = { ... } keyed by path (e.g. '/notes', '/notes/{id}' — no base URL prefix; src/docs/index.ts handles that).

Step 3 — Register (src/docs/index.ts)

import { <name>Paths } from './paths/<name>.paths';
// merge into the paths object alongside authPaths, notePaths, healthPaths

If the resource introduces a new tag, add it to the tags array with a description.

Step 4 — Verify

pnpm full-check
pnpm dev   # then open http://localhost:3000/api-docs and confirm the new endpoints render

Confirm every documented request/response matches the actual controller and validation behavior — docs that drift from code are worse than no docs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.