本文へ移動
cccskills
無料GitHub で公開日本語紹介

manage-openapi-overlays

OpenAPIの元仕様を直接変更せず、JSONPathで対象を指定するOverlayの作成・適用・検証を案内します。SDKの命名やグループ化、リトライ、ページネーションなどを設定できます。

原文原文の説明を見る

Use when creating, applying, or validating overlay files including x-speakeasy extensions. Covers overlay syntax, JSONPath targeting, retries, pagination, naming, grouping, open enums, global headers, custom security. Triggers on "create overlay", "apply overlay", "overlay file", "x-speakeasy", "add extension", "configure retries", "add pagination", "overlay for retries".

trycompai/compスター 2,061(GitHub 2,061 + cccskills 0)

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • SDK生成用のOverlayを作りたいとき
  • 既存のOverlayを適用・検証したいとき
  • リトライやページネーションを設定したいとき
  • OpenAPI仕様の検証エラーを調整したいとき

日本語での紹介

できること

OpenAPI仕様を直接変更せずに、SDK生成向けのカスタマイズを加えるOverlayファイルの作成、適用、検証を支援します。JSONPathで操作やスキーマなどの対象を指定し、値の追加・更新や削除を定義できます。仕様間の差分からOverlayを作る方法、speakeasyコマンドで適用・検証する方法、.speakeasy/workflow.yamlに登録して処理へ組み込む方法も扱います。SDKメソッドの命名やグループ化、リトライ、ページネーション、未知の列挙値、共通ヘッダー、カスタム認証などの設定例があります。

こんなときに便利

外部管理の仕様ファイルを保ったまま、SDKの生成結果や認証設定を調整したいときに使えます。OpenAPIの検証で見つかった問題をOverlayで直せるか判断したり、既存ファイルの対象指定や構文を確認したりする場面にも向いています。

使い方の例

  • 「このOpenAPI仕様にSDKのメソッド名を設定するOverlayを作って」
  • 「Overlayを適用して、構文と対象指定を検証して」
  • 「このAPI操作にリトライとページネーションを設定したい」

注意点

SPEAKEASY_API_KEYの設定、またはspeakeasy auth loginによる認証が案内されています。Overlayでは不正なYAML・JSON構文、壊れた$ref、誤ったデータ型など、元仕様自体の問題は修正できません。ライセンスはApache-2.0です。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md10.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

manage-openapi-overlays

Overlays let you customize an OpenAPI spec for SDK generation without modifying the source. This skill covers creating overlay files, applying them to specs, and using them to fix validation errors.

Content Guides

TopicGuide
OpenAPI Validationcontent/validation.md
Security Schemescontent/security-schemes.md

These guides cover validating specs, fixing common issues, and configuring authentication methods.

Authentication

Set SPEAKEASY_API_KEY env var or run speakeasy auth login.

When to Use

Use this skill when you need to manually work with overlay files:

  • Creating an overlay file from scratch with specific JSONPath targets
  • Applying an existing overlay file to a spec
  • Validating overlay syntax and structure
  • Comparing two specs to generate an overlay
  • Understanding overlay mechanics (actions, targets, update/remove)
  • Fixing lint issues via manual overlay creation
  • User says: "create overlay", "apply overlay", "overlay file", "manual overlay", "overlay syntax", "JSONPath targeting", "validate overlay"

NOT for: AI-powered naming suggestions (see improve-sdk-naming instead)

Inputs

InputRequiredDescription
Target specYesOpenAPI spec to customize or fix
CustomizationsDependsChanges to apply (groups, names, retries, descriptions)
Overlay fileDependsExisting overlay to apply (for apply workflow)
Lint outputHelpfulValidation errors to fix (for fix workflow)

Outputs

OutputDescription
Overlay fileYAML file with JSONPath-targeted changes
Modified specTransformed OpenAPI spec (when applying)

Commands

Generate an Overlay by Comparing Specs

speakeasy overlay compare -b <before-spec> -a <after-spec> -o <output-overlay>

Use this when you have a modified version of a spec and want to capture the differences as a reusable overlay.

Apply an Overlay to a Spec

speakeasy overlay apply -s <spec-path> -o <overlay-path> --out <output-path>

Validate an Overlay

speakeasy overlay validate -o <overlay-path>

Creating an Overlay Manually

Create an overlay file with this structure:

overlay: 1.0.0
info:
  title: My Overlay
  version: 1.0.0
actions:
  - target: "$.paths['/example'].get"
    update:
      x-speakeasy-group: example
      x-speakeasy-name-override: getExample

Each action has a target (JSONPath expression) and an update (object to merge) or remove (boolean to delete the target).

Example: SDK Method Naming and Grouping

overlay: 1.0.0
info:
  title: SDK Customizations
  version: 1.0.0
actions:
  - target: "$.paths['/users'].get"
    update:
      x-speakeasy-group: users
      x-speakeasy-name-override: list
  - target: "$.paths['/users'].post"
    update:
      x-speakeasy-group: users
      x-speakeasy-name-override: create
  - target: "$.paths['/users/{id}'].get"
    update:
      x-speakeasy-group: users
      x-speakeasy-name-override: get
  - target: "$.paths['/users/{id}'].delete"
    update:
      x-speakeasy-group: users
      x-speakeasy-name-override: delete
      deprecated: true

This produces SDK methods: sdk.users.list(), sdk.users.create(), sdk.users.get(), sdk.users.delete().

Example: Apply Overlay

# Apply overlay and write merged spec
speakeasy overlay apply -s openapi.yaml -o sdk-overlay.yaml --out openapi-modified.yaml

# Compare two specs to generate an overlay
speakeasy overlay compare -b original.yaml -a modified.yaml -o changes-overlay.yaml

Using in Workflow (Recommended)

Instead of applying overlays manually, add them to .speakeasy/workflow.yaml:

sources:
  my-api:
    inputs:
      - location: ./openapi.yaml
    overlays:
      - location: ./naming-overlay.yaml
      - location: ./grouping-overlay.yaml

Overlays are applied in order. Later overlays can override earlier ones. This approach ensures overlays are always applied during speakeasy run.

Common Fix Patterns

Use overlays to fix validation issues when you cannot edit the source spec.

IssueOverlay Fix
Poor operation namesAdd x-speakeasy-name-override to the operation
Missing descriptionsAdd summary or description to the operation
Missing tagsAdd tags array to the operation
Need operation groupingAdd x-speakeasy-group to operations
Need retry configAdd x-speakeasy-retries to operations or globally
Deprecate an endpointAdd deprecated: true to the operation
Add SDK-specific metadataAdd any x-speakeasy-* extension

Fix Workflow

# 1. Validate the spec to identify issues
speakeasy lint openapi --non-interactive -s openapi.yaml

# 2. Create an overlay file targeting each issue (see patterns above)

# 3. Add overlay to workflow.yaml under sources.overlays

# 4. Regenerate the SDK
speakeasy run --output console

Speakeasy Extensions Reference

Extensions (x-speakeasy-*) customize SDK generation. Apply them via overlays.

ExtensionApplies ToPurpose
x-speakeasy-retriesOperation or rootConfigure retry behavior
x-speakeasy-paginationOperationEnable automatic pagination
x-speakeasy-name-overrideOperationOverride SDK method name
x-speakeasy-groupOperationGroup methods under namespace
x-speakeasy-unknown-valuesSchema with enumAllow unknown enum values
x-speakeasy-globalsRootDefine SDK-wide parameters
x-speakeasy-custom-security-schemeSecurity schemeMulti-part custom auth

Retries

actions:
  - target: "$.paths['/resources'].get"  # Or "$" for global
    update:
      x-speakeasy-retries:
        strategy: backoff
        backoff:
          initialInterval: 500      # ms
          maxInterval: 60000        # ms
          maxElapsedTime: 3600000   # ms
          exponent: 1.5
        statusCodes: ["5XX", "429"]
        retryConnectionErrors: true

Pagination

Offset/Limit:

actions:
  - target: "$.paths['/users'].get"
    update:
      x-speakeasy-pagination:
        type: offsetLimit
        inputs:
          - name: offset
            in: parameters
            type: offset
          - name: limit
            in: parameters
            type: limit
        outputs:
          results: $.data
          numPages: $.meta.total_pages

Cursor:

actions:
  - target: "$.paths['/events'].get"
    update:
      x-speakeasy-pagination:
        type: cursor
        inputs:
          - name: cursor
            in: parameters
            type: cursor
        outputs:
          results: $.events
          nextCursor: $.next_cursor

Open Enums (Anti-Fragility)

Prevent SDK breakage when APIs return new enum values:

actions:
  - target: "$.components.schemas.Status"
    update:
      x-speakeasy-unknown-values: allow

For all enums (add x-speakeasy-jsonpath: rfc9535 at overlay root):

actions:
  - target: $..[?length(@.enum) > 1]
    update:
      x-speakeasy-unknown-values: allow

Global Headers

Add SDK-wide headers as constructor options:

actions:
  - target: $
    update:
      x-speakeasy-globals:
        parameters:
          - $ref: "#/components/parameters/TenantId"
  - target: $.components
    update:
      parameters:
        TenantId:
          name: X-Tenant-Id
          in: header
          schema:
            type: string

Result: client = SDK(api_key="...", tenant_id="tenant-123")

Custom Security Schemes

For complex auth (HMAC, multi-part credentials):

actions:
  - target: $.components
    update:
      securitySchemes:
        hmacAuth:
          type: http
          scheme: custom
          x-speakeasy-custom-security-scheme:
            schema:
              type: object
              properties:
                keyId:
                  type: string
                keySecret:
                  type: string
  - target: $
    update:
      security:
        - hmacAuth: []

With envVarPrefix: MYAPI in gen.yaml, generates env var support for MYAPI_KEY_ID, MYAPI_KEY_SECRET.

JSONPath Targeting Reference

TargetSelects
$.paths['/users'].getGET /users operation
$.paths['/users/{id}'].*All operations on /users/{id}
$.paths['/users'].get.parameters[0]First parameter of GET /users
$.components.schemas.UserUser schema definition
$.components.schemas.User.properties.nameName property of User schema
$.infoAPI info object
$.info.titleAPI title
$.servers[0]First server entry

What NOT to Do

  • Do NOT use overlays for invalid YAML/JSON syntax errors -- fix the source file
  • Do NOT try to fix broken $ref paths with overlays -- fix the source spec
  • Do NOT use overlays to fix wrong data types -- this is an API design issue
  • Do NOT try to deduplicate schemas with overlays -- requires structural analysis
  • Do NOT ignore errors that require source spec fixes -- overlays cannot solve everything
  • Do NOT modify source OpenAPI specs directly if they are externally managed
  • Do NOT use a speakeasy overlay create command -- it does not exist

Troubleshooting

ErrorCauseSolution
"target not found"JSONPath does not match spec structureVerify exact path and casing by inspecting the spec
Changes not appliedOverlay not in workflowAdd overlay to sources.overlays in workflow.yaml
"invalid overlay"Malformed YAMLCheck overlay structure: needs overlay, info, actions
YAML parse errorInvalid overlay syntaxCheck YAML indentation and quoting
No changes visibleWrong target pathUse $.paths['/exact-path'] with exact casing
Errors persist after overlayIssue not overlay-appropriateCheck if the issue requires a source spec fix instead
Overlay order conflictLater overlay overrides earlierReorder overlays in workflow.yaml or merge into one file

After Making Changes

After creating or modifying overlay files and adding them to workflow.yaml, prompt the user to regenerate the SDK:

Overlay configuration complete. Would you like to regenerate the SDK now with speakeasy run?

If the user confirms, run:

speakeasy run --output console

Overlay changes only take effect in the SDK after regeneration.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

api-endpoint-contract

無料概要あり

APIエンドポイントの追加・変更で、DTO、入力検証、OpenAPI仕様、MCPツールの説明や公開範囲を揃え、エージェントからも扱いやすいAPIに整えます。

  • APIエンドポイントを追加したいとき
  • DTOと入力検証を整えたいとき
  • MCPツールとしてAPIを公開したいとき
trycompai/comp2,0612026年10月24日 更新

audit-design-system

無料概要あり

既存コードのデザインシステム利用状況を調べ、旧UI部品やlucide-reactのアイコンを@trycompai/design-systemの部品・Carbonアイコンへ置き換えるスキルです。

  • 旧UI部品を移行したいとき
  • アイコンをCarbonに置き換えたいとき
  • 画面のデザインシステム準拠を確認するとき
trycompai/comp2,0612026年10月24日 更新

audit-hooks

無料概要あり

指定されたファイルのフックやAPI利用を点検し、禁止パターンをSWRやapiClientなどの指定方式へ修正するための監査手順と実装規約をまとめています。

  • 既存コードのAPI利用を点検したいとき
  • 生のfetchをapiClientに置き換えたいとき
  • 更新処理をSWRのmutateにそろえたいとき
trycompai/comp2,0612026年10月24日 更新

audit-rbac

無料概要あり

NestJSのAPIとフロントエンドを調べ、権限チェックや監査ログのルール違反を修正するための確認項目を示します。

  • APIの権限チェックを点検したいとき
  • 画面操作の権限制御を確認したいとき
  • RBAC違反を修正したいとき
trycompai/comp2,0612026年10月24日 更新

audit-tests

無料概要あり

権限で表示や操作が変わるコンポーネントの単体テストを点検し、不足分の追加や失敗の修正を行って、管理者と閲覧専用ユーザーの動作を確かめます。

  • 権限別の単体テストを追加したいとき
  • 管理者と監査ユーザーの表示を検証したいとき
  • 失敗する権限テストを修正したいとき
trycompai/comp2,0612026年10月24日 更新

better-auth-best-practices

無料概要あり

Better Authを使ったTypeScript認証の設定を支援し、データベース接続、セッション管理、メール認証、OAuth、プラグインやセキュリティ項目を整理します。

  • Better Authで認証を導入したいとき
  • DBやORMアダプターを接続したいとき
  • セッションの保存方法を設定したいとき
trycompai/comp2,0612026年10月24日 更新

trycompai のスキルをすべて見る

このスキルの問題を報告する