← スキル一覧に戻る

openapi-spec-generation
by ccf
A curated plugin marketplace featuring 10 specialized plugins, 16 unique agents, and 40+ skills for Claude Code. Focused on capabilities NOT covered by Claude Code's 100+ built-ins.
⭐ 0🍴 0📅 2026年1月17日
SKILL.md
name: openapi-spec-generation description: Generate and maintain OpenAPI 3.1 specifications from code, design-first specs, and validation patterns.
summary: |
- Use
openapi: 3.1.0with JSON Schema support - Design-first for new APIs, code-first for existing
- Structure: info → servers → paths → components
- Validate with: spectral, openapi-generator validate
- Generate SDKs:
openapi-generator generate -i spec.yaml -g typescript-axios
context_cost: high load_when:
- 'openapi'
- 'swagger'
- 'api documentation'
- 'api spec'
- 'sdk generation'
enhances:
- api-design-principles
OpenAPI Spec Generation
Patterns for creating and validating OpenAPI 3.1 specifications.
When to Use
- 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
Core Concepts
OpenAPI 3.1 Structure
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: ...
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 |
Quick Reference
Common Components
components:
schemas:
User:
type: object
required: [id, email]
properties:
id: { type: string, format: uuid }
email: { type: string, format: email }
parameters:
PageParam:
name: page
in: query
schema: { type: integer, minimum: 1, default: 1 }
responses:
NotFound:
description: Resource not found
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
Authentication Patterns
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
security:
- BearerAuth: []
Validation Commands
# Validate spec
npx @stoplight/spectral-cli lint openapi.yaml
# Generate TypeScript client
npx openapi-generator-cli generate \
-i openapi.yaml \
-g typescript-axios \
-o ./generated-client
# Generate server stub
npx openapi-generator-cli generate \
-i openapi.yaml \
-g nodejs-express-server \
-o ./generated-server
Best Practices
- Use $ref extensively — DRY principle for schemas
- Include examples — Real data helps consumers
- Document errors — All possible error responses
- Version in URL —
/v1/,/v2/for breaking changes - Use operationId — Unique, descriptive IDs for SDK generation
For detailed templates, see templates.md For validation patterns, see validation.md
スコア
総合スコア
70/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です