openapi-spec-generation — Claude Code skill
Creates and maintains OpenAPI 3.1 specs from code or design-first contracts. Use it for API docs, SDK generation, and contract checks.
/plugin marketplace add wshobson/agents
/plugin install documentation-generation@claude-code-workflowsWhat openapi-spec-generation does
This skill covers OpenAPI 3.1 work from the first draft through ongoing maintenance. It can help create API documentation, derive a specification from existing code, design contracts before implementation, validate an API against its spec, and prepare specs for client SDK generation.
The material describes design-first, code-first, and hybrid workflows. Templates and worked examples are stored in references/details.md. It also covers reusable schemas with $ref, error responses, security schemes, API versioning, nullable values, naming consistency, and server variables.
Install it when your project needs the API code and contract to stay aligned. Skip it for work that has no OpenAPI or API-contract concerns.
What it helps with
- draft an OpenAPI 3.1 specification
- derive an API spec from existing code
- design a contract before implementation
- check an API implementation against its spec
- prepare a specification for client SDK generation
Example prompts for the agent
- Create an OpenAPI 3.1 spec for this REST API and reuse shared schemas with `$ref`.
- Compare the API implementation with its specification and list missing error responses.
- Build a design-first contract for these endpoints using the templates in `references/details.md`.
How to install openapi-spec-generation
1Plugin marketplace
/plugin marketplace add wshobson/agents/plugin install documentation-generation@claude-code-workflowsThis installs the whole documentation-generation plugin with all its skills
2Skills CLI (Vercel)
npx skills add wshobson/agents --skill openapi-spec-generation -a claude-code3Manually: put the files in place
~/.claude/skills/openapi-spec-generation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/openapi-spec-generation/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill openapi-spec-generation -a codex2Manually: put the files in place
.agents/skills/openapi-spec-generation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill openapi-spec-generation -a cursor2Manually: put the files in place
.cursor/skills/openapi-spec-generation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshobson/agents openapi-spec-generation2Manually: put the files in place
.github/skills/openapi-spec-generation/SKILL.mdPlatform CLI
gemini skills install https://github.com/wshobson/agents --path plugins/documentation-generation/skills/openapi-spec-generationManually: put the files in place
.devin/skills/openapi-spec-generation/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set213
The whole set →Similar
Questions about openapi-spec-generation
How do I install openapi-spec-generation in Claude Code?
Run npx skills add wshobson/agents --skill openapi-spec-generation -a claude-code. The skill file is placed at ~/.claude/skills/openapi-spec-generation/SKILL.md.
What does openapi-spec-generation do?
It helps create and maintain OpenAPI 3.1 specifications from code or a contract designed before implementation. It also covers API validation, documentation, and SDK-generation workflows.
Which OpenAPI design approaches does it support?
It supports design-first, code-first, and hybrid approaches. Concrete templates and worked examples are available in references/details.md.
Source text
SKILL.md · MIT
---
name: openapi-spec-generation
description: Generate and maintain OpenAPI 3.1 specifications from code, design-first specs, and validation patterns. Use when creating API documentation, generating SDKs, or ensuring API contract compliance.
---
# OpenAPI Spec Generation
Comprehensive patterns for creating, maintaining, and validating OpenAPI 3.1 specifications for RESTful APIs.
## When to Use This Skill
- Creating API documentation from scratch
- Generating OpenAPI specs from existing code
- Designing API contracts (design-first approach)
- Validating API implementations against specs
- Generating client SDKs from specs
- Setting up API documentation portals
## Core Concepts
### 1. OpenAPI 3.1 Structure
```yaml
openapi: 3.1.0
info:
title: API Title
version: 1.0.0
servers:
- url: https://api.example.com/v1
paths:
/resources:
get: ...
components:
schemas: ...
securitySchemes: ...
```
### 2. Design Approaches
| Approach | Description | Best For |
| ---------------- | ---------------------------- | ------------------- |
| **Design-First** | Write spec before code | New APIs, contracts |
| **Code-First** | Generate spec from code | Existing APIs |
| **Hybrid** | Annotate code, generate spec | Evolving APIs |
## Templates and detailed worked examples
Full template library and detailed worked examples live in `references/details.md`. Read that file when you need the concrete templates.
## Best Practices
### Do's
- **Use $ref** - Reuse schemas, parameters, responses
- **Add examples** - Real-world values help consumers
- **Document errors** - All possible error codes
- **Version your API** - In URL or header
- **Use semantic versioning** - For spec changes
### Don'ts
- **Don't use generic descriptions** - Be specific
- **Don't skip security** - Define all schemes
- **Don't forget nullable** - Be explicit about null
- **Don't mix styles** - Consistent naming throughout
- **Don't hardcode URLs** - Use server variables
© Seth Hobson · MIT · wshobson/agents