Openapi Spec Generation

Openapi Spec Generation

Helps an AI agent write, maintain and validate OpenAPI 3.1 specs, design-first or code-first, for API docs, SDK generation and contract checks.

Skill files3 files

references/

SKILL.md67 lines
1
---
2
name: openapi-spec-generation
3
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.
4
---
5
6
# OpenAPI Spec Generation
7
8
Comprehensive patterns for creating, maintaining, and validating OpenAPI 3.1 specifications for RESTful APIs.
9
10
## When to Use This Skill
11
12
- Creating API documentation from scratch
13
- Generating OpenAPI specs from existing code
14
- Designing API contracts (design-first approach)
15
- Validating API implementations against specs
16
- Generating client SDKs from specs
17
- Setting up API documentation portals
18
19
## Core Concepts
20
21
### 1. OpenAPI 3.1 Structure
22
23
```yaml
24
openapi: 3.1.0
25
info:
26
title: API Title
27
version: 1.0.0
28
servers:
29
- url: https://api.example.com/v1
30
paths:
31
/resources:
32
get: ...
33
components:
34
schemas: ...
35
securitySchemes: ...
36
```
37
38
### 2. Design Approaches
39
40
| Approach | Description | Best For |
41
| ---------------- | ---------------------------- | ------------------- |
42
| **Design-First** | Write spec before code | New APIs, contracts |
43
| **Code-First** | Generate spec from code | Existing APIs |
44
| **Hybrid** | Annotate code, generate spec | Evolving APIs |
45
46
## Templates and detailed worked examples
47
48
Full template library and detailed worked examples live in `references/details.md`. Read that file when you need the concrete templates.
49
50
## Best Practices
51
52
### Do's
53
54
- **Use $ref** - Reuse schemas, parameters, responses
55
- **Add examples** - Real-world values help consumers
56
- **Document errors** - All possible error codes
57
- **Version your API** - In URL or header
58
- **Use semantic versioning** - For spec changes
59
60
### Don'ts
61
62
- **Don't use generic descriptions** - Be specific
63
- **Don't skip security** - Define all schemes
64
- **Don't forget nullable** - Be explicit about null
65
- **Don't mix styles** - Consistent naming throughout
66
- **Don't hardcode URLs** - Use server variables
67

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…