---
title: "OpenAPI 仕様を生成・保守する（エージェント用スキル） | Orchestor"
description: "コードや設計先行の仕様、検証パターンから OpenAPI 3.1 仕様を生成・保守します。API ドキュメントの作成、SDK の生成、API 契約への準拠確認に使います。wshobson/agents が公開している「OpenAPI 仕様を生成・保守する」の使い方を確認できます。"
canonical_url: "https://www.orchestor.io/ja/skills/wshobson/agents/openapi-spec-generation"
markdown_url: "https://www.orchestor.io/ja/skills/wshobson/agents/openapi-spec-generation.md"
---

[c96b5f6](https://github.com/wshobson/agents/commit/c96b5f6552dba32e4492307493ee613581430715)[原文を開く](https://github.com/wshobson/agents/blob/c96b5f6552dba32e4492307493ee613581430715/plugins/documentation-generation/skills/openapi-spec-generation/SKILL.md)

wshobson2026/11/24

原文 (選択中)

未翻訳

プレビュー (選択中)

66 行（空行を除く 50 行） · 2.00 KB原文

```yaml
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 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

## Structured data

```json
[
  [
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "name": "Orchestor",
      "url": "https://www.orchestor.io",
      "sameAs": [
        "https://orchestor.io",
        "https://www.orchestor.io",
        "https://docs.orchestor.io"
      ],
      "@id": "https://www.orchestor.io/#organization",
      "alternateName": [
        "オーケスター"
      ],
      "logo": "https://www.orchestor.io/images/common/ogp/orchestor-ogp.png",
      "parentOrganization": {
        "@type": "Organization",
        "name": "ドットメディア株式会社",
        "url": "https://www.dotmedia.co.jp"
      }
    },
    {
      "@context": "https://schema.org",
      "@type": "WebSite",
      "url": "https://www.orchestor.io",
      "name": "Orchestor",
      "description": "Orchestor で画像・動画・音声を作り、参照素材を Remix できます。",
      "@id": "https://www.orchestor.io/#website",
      "alternateName": [
        "オーケスター"
      ],
      "inLanguage": "ja",
      "publisher": {
        "@id": "https://www.orchestor.io/#organization"
      }
    }
  ],
  {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "@id": "https://www.orchestor.io/skills/wshobson/agents/openapi-spec-generation#breadcrumb",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Orchestor",
        "item": "https://www.orchestor.io/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "スキル",
        "item": "https://www.orchestor.io/skills"
      },
      {
        "@type": "ListItem",
        "position": 3,
        "name": "OpenAPI 仕様を生成・保守する",
        "item": "https://www.orchestor.io/skills/wshobson/agents/openapi-spec-generation"
      }
    ]
  }
]
```

---

[Documentation index](https://www.orchestor.io/llms.txt)
