本文へスキップ
Skillpedia
APIとサーバー(バックエンド)41k · #6690

openapi-spec-generation

できること

このツールは、API(プログラム同士が連携するための窓口)のドキュメントを作成・整理するのに役立ちます。コードや以前の設計書からドキュメントを生成できます。

使う場面

  • ✓新しいAPIを文書化する必要があるとき。
  • ✓コード内の既存のAPIのドキュメントを生成したいとき。
  • ✓他のプログラムがAPIを利用するためのガイドを作る必要があるとき。

スキルのリンク

https://github.com/wshobson/agents/blob/main/plugins/documentation-generation/skills/openapi-spec-generation/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/wshobson/agents/blob/main/plugins/documentation-generation/skills/openapi-spec-generation/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“ユーザーデータを受け取るこのAPIのOpenAPIドキュメントを作成してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

ツールはコードや設計ファイルを分析して、APIの動作を把握します。そのうえで、APIの詳細をすべて記述した標準化されたファイル(OpenAPI 3.1)を生成します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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

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
よくある質問

OpenAPIとは何ですか?

APIを記述するための標準形式です。オンラインサービスの利用方法を説明する地図のようなものです。

「Design-First」と「Code-First」の違いは何ですか?

「Design-First」は、道路(API)を作る前に地図(ドキュメント)を作ることです。「Code-First」は、道路を作ってからそこから地図を生成することです。

「$ref」を使うのはなぜですか?

同じ情報を繰り返し書かないための近道のようなものです。あるデータ型を一か所に記述しておけば、「$ref」を使って別の場所から再利用できます。

詳細

作者による元の説明

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.

repo: wshobson/agents

人気

GitHubのスター
41k
ランキング
#6690
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル