Skip to content
OpenAPI Writer cover
API DesignFree · MIT

OpenAPI Writer

A complete OpenAPI spec grounded in the real endpoints — every response status, reusable schemas, real examples. Not a half-spec.

v1.0.0 · ~538 tokens · ⬇ 0 · Updated July 6, 2026

What it does

Writes/validates an OpenAPI 3.x spec from the actual routes and models: every parameter and response status (not just 200), $ref'd reusable schemas and errors, declared security schemes, realistic examples. Validates that the spec parses, matches the real API, and invents no field types. Flags anything it couldn't verify against the code.

Example uses

Spec an existing Express API

Your API has real routes but no spec, and consumers keep asking how it works.

Write an OpenAPI 3.1 spec for the Express routes in src/routes/ — users, projects, and API keys. Document every response status including the 401, 403, and 422 error shapes, put shared schemas in components with $ref, and add realistic examples. Flag any field type you can't verify from the code.

Validate a stale Swagger file

The existing spec has drifted from the actual API and nobody trusts it anymore.

Our swagger.yaml hasn't been touched in a year. Compare it against the actual FastAPI routes and fix the drift: endpoints missing from the spec, fields with wrong types, and undocumented error responses. Don't add anything you can't confirm in the code.

Prepare a spec for client generation

You want to generate a typed client but the current spec is too broken to generate from.

We want to generate a TypeScript client from our OpenAPI spec but the generator chokes on it. Make the spec generation-ready: resolve the dangling $refs, define the standard error response once in components, and declare the bearer auth scheme on every protected operation.

Install

# 1. Create the skill folder in your Claude setup
mkdir -p ~/.claude/skills/openapi-writer

# 2. Download SKILL.md into it (or move the file you just downloaded)
#    → ~/.claude/skills/openapi-writer/SKILL.md

# 3. Claude Code auto-discovers it on next launch.

Inside the skill

SKILL.md
---
name: openapi-writer
description: Write or validate an OpenAPI (Swagger) spec from an API or a design. Use when documenting an API, generating a client/server from a spec, or asked "write the OpenAPI spec", "document these endpoints", "validate my swagger". Produces a spec that's actually complete enough to generate from.
---

# OpenAPI Writer

An OpenAPI spec is only useful if it's complete and accurate — a half-spec generates broken
clients and lies to consumers. Ground it in the real endpoints; describe every response.

## Build it from the real API

Read the actual routes, handlers, and models — don't invent fields. For each endpoint capture:
- Path + method, summary + description (what AND when to use it).
- **Parameters**: path/query/header, each with type, required, description, example.
- **Request body**: schema (`$ref` a reusable component), required fields, example.
- **Responses**: EVERY status it returns — 200 AND the 4xx/5xx with their error schema.
  A spec that only documents the happy path is half a spec.

## Structure well

- **Components/schemas**: define models once, `$ref` them everywhere. No copy-pasted inline schemas.
- **Reusable responses/parameters**: the standard error, the pagination params — define once.
- **Security schemes**: declare auth (bearer/apiKey/oauth) and apply per operation.
- **Examples**: realistic ones on requests and responses — they drive the docs UI and mocks.

## Validate

- Spec parses and is valid OpenAPI 3.x (no dangling `$ref`, no missing required fields).
- Every path/method the code exposes is present; nothing documented that doesn't exist.
- Types match reality (the field the API returns as a string isn't specced as integer).

## Rules

- Document every response status, not just 200 — consumers need the error shapes to handle them.
- `$ref` shared schemas; duplication drifts out of sync.
- If you can't confirm a field from the code, mark it and ask — don't guess types into a contract.

## Output

The OpenAPI 3.x document (YAML or JSON as the project uses), with components, security, and
examples. Note any endpoint you couldn't fully verify against the code.

Changelog

  • v1.0.02026-07-03Initial clean-room write.

Frequently asked questions

Is OpenAPI Writer free?

Yes. OpenAPI Writer is free to download and MIT-licensed.

Where do I install OpenAPI Writer?

Place the SKILL.md file in ~/.claude/skills/openapi-writer/ and Claude Code auto-discovers it on next launch.

How many tokens does OpenAPI Writer use?

About 538 tokens — it is designed to be token-lean.

Anthony M. — Founder & Lead Reviewer
Anthony M.Verified Builder

We're developers and SaaS builders who use these tools daily in production. Every review comes from hands-on experience building real products — DealPropFirm, ThePlanetIndicator, PropFirmsCodes, and many more. We don't just review tools — we build and ship with them every day.

Written and tested by developers who build with these tools daily.