Skip to content
Agentmart
Submit a tool

openapi-first

Generate API code, types, validators, mock servers, and client SDKs from a single OpenAPI 3.1 specification.

Skill by MILTONADINA

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/miltonadina-openapi-first

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Generate API code, types, validators, mock servers, and client SDKs from a single OpenAPI 3.1 specification. Use whenever building or modifying an HTTP API endpoint. The OpenAPI doc is source of truth - drift between doc and code is a contract violation caught by tests. Triggers on requests involving REST endpoints, API design, or client/server contracts.

Use cases: documents, design, backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/openapi-first

What's inside

Skill name
openapi-first
Description
Generate API code, types, validators, mock servers, and client SDKs from a single OpenAPI 3.1 specification. Use whenever building or modifying an HTTP API endpoint. The OpenAPI doc is source of truth - drift between doc and code is a contract violation caught by tests. Triggers on requests involving REST endpoints, API design, or client/server contracts.
License
MIT
Instructions
153 lines in SKILL.md · view on GitHub

Files (3)

  • SKILL.md
  • SKILL.md.bundle
  • SKILL.md.sig

SKILL.md (first lines)

# OpenAPI First

> The API contract is the source of truth. Code derives from it, not the other
> way around.

**Tradeoff:** Adds an upfront OpenAPI authoring step. Worth it: free types,
free validators, free client SDKs, free mocks, and contract testing comes for
free.

---

## When to invoke

- New API endpoint requested
- Existing endpoint being modified (request/response shape changes)
- Client SDK needed for an existing API
- Migration from undocumented API to documented

---

## Workflow

1. **Write or update the OpenAPI 3.1 spec** at `openapi/<service>.yml`.
2. **Generate types** for both server and client.
3. **Generate validators** so runtime requests are checked against the schema.
4. **Implement the handler** to satisfy the spec (the test is "the
   schema-validator passes against real requests/responses").
5. **Generate the mock server** for frontend development.
6. **Add a contract test** that exercises every operation against the spec.

---

## Recommended tooling (TypeScript)

- **`openapi-typescript`** — type generation
- **`zod-openapi`** or **`@asteasolutions/zod-to-openapi`** — write schemas in
  Zod, derive OpenAPI from them
- **`@hono/zod-openapi`** or **`fastify-openapi-glue`** — server framework
  integration
- **`orval`** or **`@kubb/swagger-client`** — typed client SDK generation
- **`@stoplight/prism`** — mock server
- **`schemathesis`** or **`dredd`** — contract testing

---

## For Python (FastAPI)

FastAPI generates OpenAPI from typed handlers — the spec is derived from code.
This works in reverse to "OpenAPI first." If you have an existing FastAPI app,
treat its `/openapi.json` output as authoritative and treat the docs export as
the canonical spec for client generation.

---

## For Rust

- **`utoipa`** — Rust code annotations generate OpenAPI
- **`paperclip`** — alternative annotation-based generator
- **`progenitor`** — generate Rust client from OpenAPI

---

## Quality gates

A change is done when all five hold:

1. The OpenAPI spec validates against the OpenAPI 3.1 schema.
2. `spectral lint openapi/<service>.yml` passes with the default ruleset
   (extend with `.spectral.yaml` for project rules).
3. Generated types are checked into the repo and re-generated by CI on
   schema changes. Drift = build failure.
4. Contract tests run on every PR.
5. `oasdiff` detects breaking changes, and a breaking change requires a major
   version bump.

---

## Anti-patterns

**Hand-writing types after the schema**: defeats the purpose. Always generate.

**Schema-after**: writing the handler and then describing it in OpenAPI. Don't.
The schema is the design artifact.

**Optional everywhere**: if a field is always required in practice, mark it
required. Schema laxity becomes runtime errors.

**Missing error responses**: every operation should document 4xx and 5xx
responses with `Problem Details` (RFC 9457) bodies.

**No versioning strategy**: pick header-based (`Accept: application/vnd.api+json;
version=2`) or path-based (`/v2/`) and stick to it.

---

## Worked example

`openapi/auth.yml`:
```yaml
openapi: 3.1.0
info:
  title: Auth Service
  version: 1.0.0
paths:
  /auth/reset:
    post:
      operationId: requestPasswordReset
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetRequest'
      responses:
        '200':
          description: Reset link sent
        '422':
          description: Invalid email
          content:

From MILTONADINA/DevOPs, MIT.

More from MILTONADINA/DevOPs

Signals

Stars
0
Forks
0
Open issues
12
Last commit (this folder)
Oct 12, 2026 (17 days ago)
Last release
Sep 23, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from MILTONADINA

Cite this page

openapi-first skill. Agent Mart. https://agentmart.dev/skills/miltonadina-openapi-first (last updated 2026-10-24)