Communitygithub.com

curiositech/windags-skills

クライアントを破壊しないHTTP APIのバージョン管理戦略の選択と運用 — Stripeの日付ベース固定バージョン、非推奨/廃止ヘッダーペア(RFC 9745 + RFC 8594)、URI vs ヘッダー vs メディアタイプ方式、バージョントランスフォーマーパターン。Stripeの公開アーキテクチャとIETF RFCに基づいています。

windags-skills とは?

このスキルは、HTTP APIにおけるバージョン管理戦略について、特に長期間運用されるパブリックAPIと内部APIの違いに焦点を当て、実践的なガイドを提供します。Stripeが採用する「APIキーごとに日付ベースのバージョンを固定する」モデルは、小さな破壊的変更を頻繁に行う大規模パブリックAPIに最適で、/v1/→/v2/のような大掛かりな移行を避けられます。また、RFC 9745とRFC 8594で定義されたDeprecationヘッダーとSunsetヘッダーのペアを用いることで、クライアントに事前に非推奨と廃止を通知するための標準的な方法を学べます。さらに、複数のバージョンを効率的に管理する「バージョントランスフォーマーパターン」の実装方法も解説しており、Cline、Cursor、GitHub Copilot、Codexなどの主要なAIエージェントプラットフォームで利用できます。このスキルは、API設計者、バックエンド開発者、APIプラットフォームエンジニアが、クライアントに優しいAPIの進化を実現するために役立ちます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/curiositech/windags-skills/tree/HEAD/skills/api-versioning-strategy

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

APIバージョン管理戦略

TL;DR: 日付ベースでAPIキーごとにバージョンを固定する(Stripeのモデル)ことは、長期運用されるパブリックAPIにおいて/v1/、/v2/よりも優れています。なぜなら、クライアントに新しいツリーへの移行を強制せずに、小さな破壊的変更を行えるからです。内部APIの場合は、追加的な進化とDeprecationおよびSunsetヘッダー(RFC 9745、RFC 8594)で十分です。常に事前に告知し、常に日付を決めて廃止し、決して単に削除しないでください。


すぐに知りたいことから選ぶ

症状セクション
「フィールドを変更したいけど、10万のAPIキーがある」日付ベース固定バージョン
「/v1/ vs Accept: application/vnd.foo.v2+json どちらを選ぶべき?」戦略比較
「エンドポイントが廃止されることをクライアントに伝えるには?」非推奨+廃止
「コードで6つのバージョンを管理するのが大変」バージョントランスフォーマー
「内部API — バージョン管理は本当に必要?」内部API vs パブリックAPI

決定図

flowchart TD
  A[APIの動作を変更する必要がある] --> B{追加のみ?<br/>新しいフィールド、新しいエンドポイント、新しいオプションのパラメータ}
  B -->|はい| C[そのままリリース<br/>バージョン管理不要]
  B -->|いいえ、破壊的変更| D{APIはパブリック<br/>+ 不透明なクライアントが多い?}
  D -->|いいえ、内部/クライアント少数| E[移行を調整<br/>+ Deprecation/Sunset ヘッダー]
  D -->|はい、パブリック| F{リクエストごとに<br/>互換レイヤーを適用できる?}
  F -->|はい、トランスフォーマーあり| G[日付ベース固定バージョン<br/>Stripeモデル]
  F -->|いいえ、大規模な書き換え| H[メジャーバージョンURI更新<br/>/v1 → /v2]
  E --> I[Deprecation: @timestamp<br/>+ Sunset: HTTP-date<br/>+ Link: rel=deprecation を設定]
  G --> I
  H --> I

1. 日付ベース固定バージョン(Stripeのモデル)

StripeはAPIバージョニングのブログ記事でそのアーキテクチャを公開しています:

ユーザーが初めてAPIリクエストを行うと、そのアカウントは自動的にその時点で利用可能な最新バージョンに固定されます。以降、そのユーザーが行うすべてのAPI呼び出しには、そのバージョンが暗黙的に割り当てられます。

[バージョンは]リリースされた日付で名前が付けられたローリングバージョンです(例:2017-05-24)。

主な特性:

プロパティなぜうまくいくか
アカウントごとのデフォルトバージョン(最初の呼び出し時に設定)新規顧客は自動的に最新バージョンに固定され、変更をリリースしても既存顧客は影響を受けない
Stripe-Versionヘッダーによるリクエストごとの上書き段階的なクライアント移行が可能:SDKはアカウントのデフォルトより前に新しいバージョンを試せる
日付ベースの名前(2024-04-10)新しさが伝わる。「v3」の意味について議論が不要。大きなv3まで貯めずに、小さな変更を何度でも行える
ダッシュボードによるアップグレードパス顧客は差分をプレビューし、アカウントのデフォルトバージョンをアップグレードできる

これは、真に長期運用されるパブリックAPI(Stripeは10年前のバージョンも維持)にスケールする唯一のアプローチです。内部の複雑さ(§4のトランスフォーマーパターン)がかかりますが、顧客に永続的な/v1/ → /v2/ 移行サイクルを強いることを避けられます。


2. バージョン管理戦略比較

戦略バージョンの配置場所メリットデメリット最適な用途
URIセグメント(/v1/、/v2/)パスキャッシュフレンドリー(URLが異なるとキャッシュエントリも異なる)。クライアント設定不要小さな変更ができない。ツリーのフォークを強制。FieldingによるとURLが「安定したリソース識別子」でなくなる内部API、稀にしか変更しないパブリックAPI
カスタムヘッダー(Stripe-Version: 2024-04-10)リクエストヘッダー多くのバージョンを安価に扱える。リクエストごとの細かい粒度URLにバージョンを含められない。ブラウザのアドレスバーでテストしにくい大規模なパブリックAPI
Acceptメディアタイプ(Accept: application/vnd.foo.v2+json)標準のAcceptヘッダーHTTPの仕様に準拠。コンテンツネゴシエーションの仕組みを再利用設定が面倒。ツールのサポートにばらつきがある。curlでのデバッグが冗長ハイパーメディアAPI、深いRESTful設計
クエリパラメータ(?version=2)URLテストが簡単。ログに表示されるURLを汚染する。意味的に間違っている(バージョンはリソースのプロパティではない)迅速なプロトタイピングのみ
バージョン管理なし、追加のみなしオーバーヘッドゼロ。クライアントの調整不要新しいエンドポイントなしでは破壊的変更が一切できない共有デプロイの内部マイクロサービス

制約に応じて選択:

  • 「頻繁に小さな変更を行う」→ 日付ベースヘッダー(Stripe)
  • 「5年に一度大きな書き換えをする」→ URIセグメント(/v1/、/v2/)
  • 「決して変更せず、追加のみ」→ バージョン管理なし+追加的進化

3. Deprecation/Sunset ヘッダーペア

2つのIETF RFCがライフサイクルシグナルをカバーしています:

Sunset ヘッダー — RFC 8594

Sunset値は、RFC 7231のセクション7.1.1.1で定義されているHTTP-dateタイムスタンプであり、将来のタイムスタンプであるべきです(SHOULD)。

Sunset: Sat, 31 Dec 2026 23:59:59 GMT

「リソースが将来の特定の時点で応答しなくなることが予想される」ことを示します。クライアントはこのタイムスタンプをヒントとして扱うべきであり(SHOULD)、厳格な契約として扱うべきではありません。

Deprecation ヘッダー — RFC 9745

Deprecation: @1735689599
Sunset: Sun, 31 Dec 2026 23:59:59 GMT
Link: <https://api.example.com/docs/migrate-v1-to-v2>; rel="deprecation"

Deprecationの値はUnixタイムスタンプ(秒、構造化フィールドに従い@を接頭辞)です。過去(「すでに非推奨」)でも未来(「非推奨になる予定」)でも構いません。必須事項(MUST):

  • RFC 9651に従い、構造化フィールドの日付形式を使用しなければならない(MUST)
  • SunsetはDeprecationより前であってはならない(MUST NOT) — 仕様は明示的。これは時間的な順序の制約
  • rel="deprecation"を持つ**Linkを含めるべき(SHOULD)**、移行ドキュメントを指すこと

Deprecationを送信してもリソースの動作は変わりません — これはシグナルであり、機能低下ではありません。サーバーは、緊急時を除き、Sunset日付までリソースを機能させ続けるべきです(SHOULD)。

推奨タイムライン

T+0      最初の非推奨通知: ヘッダーを本番環境で送信開始
T+30d    公開告知(変更履歴、メール、ドキュメント)
T+90d    非推奨パスの使用状況に関するログ/メトリクスを追加
T+180d   廃止日を90日後に設定
T+270d   廃止日到来 — エンドポイントは移行リンクとともに410 Goneを返す

メジャーバージョン固定APIでの軽微な破壊的変更の場合:中央値は6ヶ月。完全なv1→v2の廃止の場合:12〜24ヶ月。


4. バージョントランスフォーマーパターン

Stripeの内部アーキテクチャは、「本番環境に50のバージョンがある」問題を解決しています:

[システムは]APIリソースクラス(現在のAPI応答構造を定義)と、バージョン変更モジュール(後方互換性のない変換をカプセル化)を組み合わせています。応答を処理する際、システムは時間を逆向きにたどり、対象のバージョンに到達するまで各バージョン変更モジュールを適用します。

形は以下の通り:

// resource: 正規(最新)の表現
const charge = {
  id: 'ch_123',
  amount: 1000,
  payment_method_details: { card: { brand: 'visa', last4: '4242' } },
}

// 各破壊的変更は1つのトランスフォーマーモジュール:
const v_2024_03_01 = {
  // payment_method_details下の'card'の入れ子を削除し、フィールドをフラット化
  apply(resource) {
    return {
      ...resource,
      card_brand: resource.payment_method_details?.card?.brand,
      card_last4: resource.payment_method_details?.card?.last4,
    }
  },
}

const v_2023_10_15 = {
  // 'amount'を'amount_cents'にリネーム
  apply(resource) {
    const { amount, ...rest } = resource
    return { ...rest, amount_cents: amount }
  },
}

// パイプラインはトランスフォーマーを逆時系列順に適用
// 要求されたバージョンに達するまで
function transform(resource, requestedVersion) {
  const chain = transformers.filter(t => t.date > requestedVersion)
  return chain.reduceRight((r, t) => t.apply(r), resource)
}

メリット:

  • コアコードは最新のまま — すべてのエンドポイントは最新のスキーマに対して記述。ビジネスロジックにif (version < ...)が散らばらない。
  • 各変更は1ファイル — レビューが容易、単独でテストが容易、最後のユーザーがそのバージョンを超えたら削除が容易。
  • テレメトリー — 各トランスフォーマーが1日に何回起動するかをカウントし、実際の使用状況に基づいて非推奨化を計画できる。

コスト:トランスフォーマーフレームワークの構築。年間3回以上の破壊的変更があり、1万以上のAPIコンシューマーがいる場合に価値があります。50未満の顧客しかいない内部APIには過剰です。


5. 内部API vs パブリックAPI

非対称性が重要です:

内部パブリック
調整されたデプロイが可能?はい — アトミックスワップいいえ — クライアントは独立してデプロイ
スキーマ進化追加的+Slackメッセージ厳格なバージョン管理+メール+ダッシュボード+ブログ投稿
廃止期間数日〜数週間6〜24ヶ月
バージョン管理の必要性多くの場合不要 — Deprecationヘッダーだけで十分必須
最適な戦略追加的進化。書き換え時のみURIバージョン日付固定ヘッダー(規模に見合う場合)、大規模書き換えにはURI

落とし穴:すべてのAPIを「パブリック」とみなし、3つの内部サービスだけが使用するAPIに重いバージョン管理インフラを構築してしまうこと。逆の落とし穴:内部APIが外部に漏れ、実際には変更できなくなること。

防御策:「パブリック」をサービスのバイナリタグにする。パブリックサービスは完全なバージョン管理手続きを取得。内部サービスは取得しないが、誰が呼んでいるかの積極的な監視を取得。


アンチパターン

アンチパターンなぜ問題か修正方法
1つの破壊的変更で/v1/を/v2/に上げる1つのフィールドのためにクライアントにすべてを移行させる日付ベースバージョン、または追加的進化
Sunsetヘッダーなしでエンドポイントを削除クライアントに予告なく影響が出る。サポートチケットが急増削除には常に90日以上の事前にDeprecationを設定
Deprecationを送信するがLinkがないクライアントは非推奨と分かってもどうすればいいか分からない常にLink: <migration-doc>; rel="deprecation"を含める
顧客ごとにハードコードされたバージョン例外メンテナンス不能。動作を推論できないトランスフォーマーパターンを使用。「例外」はバージョン固定として扱う
内部APIをパブリックAPIのようにバージョン管理見返りのないプロセスオーバーヘッド追加的進化+アトミックデプロイ+Slack
REST APIでセマンティックバージョニング(v1.2.3)を使用当てはまらない意味を暗示する(JSONスキーマにとって「パッチ」とは?)日付ベースの名前、またはメジャーのみ(v1)
強制のない廃止日エンドポイントが永遠に存続、コードが腐るカレンダーリマインダー、廃止日の7日前に失敗するCIテスト

初心者/エキスパート/タイムライン

初心者エキスパート
最初の破壊的変更/v1を/v2に上げ、ツリー全体をコピーペースト日付ベース固定を検討し、変更が実際に破壊的かを評価
クライアントへの非推奨通知メール一斉送信Deprecation+Sunsetヘッダー+Link+メール+ダッシュボードバナー
5つのバージョンの管理各コントローラーに5つのif/else分岐トランスフォーマーモジュール、最新のみのコアコード
廃止の強制「そのうちやる」CIに廃止日。その日が来たらエンドポイントは410 Goneを返す
内部APIの変更パブリックAPIと同じ手続き — 遅い追加的進化+アトミックデプロイ。重いプロセスはパブリックAPIのみに予約

タイムラインテスト:「フィールドXを削除したい」から「フィールドXが本番環境から削除された」までどれくらいかかるか? エキスパート組織には単一の反復可能な答えがある(例:90日)。初心者組織にはプロセスがないため答えがない。


品質ゲート

バージョン管理の変更が出荷される条件:

  • テスト: 外部から見えるフィールドの削除またはリネームは、少なくともN日前(Nは文書化された廃止期間)の非推奨告知によってゲートされている。
  • テスト: すべての非推奨エンドポイントがDeprecation: @<unix-ts>およびSunset: <HTTP-date>ヘッダーを送信していることを統合テストで確認。
  • テスト: Sunset値がDeprecation値より前になっていないこと(RFC 9745のMUSTに従う)。
  • テスト: すべての非推奨告知にLink: <docs-url>; rel="deprecation"ヘッダーが含まれ、そのURLに公開移行ドキュメントが存在すること(CIでHEADチェック)。
  • テスト: バージョンごとの使用状況テレメトリーが存在すること — v2を削除する前に「昨日v2パスへのリクエスト数」に答えられること。
  • テスト(日付固定のみ): 新しいAPIキーは最新バージョンがデフォルトになる。既存のキーはデプロイをまたいでも固定を維持する。
  • 手動: 廃止強制計画:カレンダーリマインダー、CIチェック、または自動化された410 Gone — 日付が来たときに何かが発火すること。

このスキルの対象外

  • GraphQLスキーマ進化(graphql-schema-evolution を使用)
  • gRPC / Protobuf ワイヤー互換性(protobuf-evolution-rules を使用)
  • データベーススキーマバージョン管理(zero-downtime-database-migration を使用)
  • ライブラリ / SDK セマンティックバージョニング(npm-package-versioning を使用)
  • イベントストリームスキーマ進化(kafka-schema-registry-design を使用)

出典

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

curiositech/windags-skills

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

curiositech/windags-skills

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

curiositech/windags-skills

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

curiositech/windags-skills

Implement WCAG 2.2 AA/AAA compliance with automated testing, keyboard navigation, screen reader support, and focus management. Activate on: accessibility audit, WCAG compliance, keyboard navigation, screen reader, aria attributes, axe-core, focus trap. NOT for: design-level accessibility review (use design-accessibility-auditor), color contrast only (use css-in-js-architect).

curiositech/windags-skills

Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that actually work for neurodivergent minds.

curiositech/windags-skills

Designs digital experiences for ADHD brains using neuroscience research and UX principles. Expert in reducing cognitive load, time blindness solutions, dopamine-driven engagement, and compassionate design patterns. Activate on 'ADHD design', 'cognitive load', 'accessibility', 'neurodivergent UX', 'time blindness', 'dopamine-driven', 'executive function'. NOT for general accessibility (WCAG only), neurotypical UX design, or simple UI styling without ADHD context.

curiositech/windags-skills

>- Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

curiositech/windags-skills

Extend and modify the admin dashboard, developer portal, and operations console. Use when adding new admin tabs, metrics, monitoring features, or internal tools. Activates for dashboard development, analytics, user management, and internal tooling.

curiositech/windags-skills

Conversation patterns and interaction protocols for multi-agent systems. Covers request/response, pub/sub, blackboard, delegation chains, debate, critique, consensus, fan-out/fan-in, supervisor-worker, and peer negotiation. Deep analysis of AutoGen conversation patterns, CrewAI delegation, LangGraph state passing, and FIPA-ACL performatives. Teaches how to design what agents say to each other and in what order. Activate on: "agent conversation", "agent protocol", "multi-agent debate", "agent delegation", "supervisor worker pattern", "agent voting", "consensus protocol", "fan-out fan-in", "agent negotiation", "blackboard pattern", "agent dialogue", "conversation topology", "agent handoff". NOT for: wire format or serialization (use agent-interchange-formats), orchestration infrastructure (use agentic-infrastructure-2026), single agent behavior (use agentic-patterns).

curiositech/windags-skills

Meta-agent for creating new custom agents, skills, and MCP integrations. Expert in agent design, MCP development, skill architecture, and rapid prototyping. Activate on 'create agent', 'new skill', 'MCP server', 'custom tool', 'agent design'. NOT for using existing agents (invoke them directly), general coding (use language-specific skills), or infrastructure setup (use deployment-engineer).

curiositech/windags-skills

AI-powered calendar management and agent-based scheduling coordination. Covers calendar APIs (Google Calendar, CalDAV/iCal), AI scheduling assistants (Reclaim, Clockwise, Motion, Cal.com), building custom calendar agents with MCP, multi-calendar merging, timezone management, focus block protection, meeting fatigue detection, and agent-to-agent meeting negotiation protocols. Activate on: "calendar agent", "AI scheduling", "calendar coordination", "meeting scheduling", "calendar API", "focus time protection", "calendar optimization", "Google Calendar MCP", "Reclaim", "Clockwise", "Motion", "Cal.com", "smart scheduling", "calendar-aware agent", "timezone scheduling", "agent negotiation meetings". NOT for: manual calendar UI component design (use form-validation-architect), project management scheduling or Gantt charts (use project-management-guru-adhd), general time-tracking or pomodoro apps (use adhd-daily-planner for time-awareness), building the agent itself from scratch (use agent-creator).

curiositech/windags-skills

Build and adopt production AI agent infrastructure in 2026. Covers framework selection (LangGraph, CrewAI, AutoGen, MCP), orchestration patterns, evaluation, observability, memory systems, and tool use. Also covers the SOCIAL dimension: how to sell agent infrastructure internally, change management, measuring ROI, building trust in autonomous systems, and scaling adoption across teams. Activate on: "agent infrastructure", "agent framework comparison", "which agent framework", "sell AI tools internally", "agent adoption", "agent observability", "agent evaluation", "MCP architecture", "agentic mesh", "enterprise AI agents", "AI change management", "agent ROI". NOT for: building specific agents (use ai-engineer), designing agent behavior patterns (use agentic-patterns), prompt tuning (use prompt-engineer).

curiositech/windags-skills

Fundamental patterns for effective agentic behavior. Teaches decomposition, tool orchestration, error recovery, context management, quality self-assessment, and knowing when to stop. Model-agnostic principles that make any agent more effective regardless of domain. Activate on: "how should I structure this agent", "agentic workflow", "agent patterns", "multi-step task", "tool orchestration", "/agentic-patterns", "decompose this", "agent best practices", "chain of actions", "when should the agent stop", "agent loop design". NOT for: creating agent infrastructure (use agent-creator), building DAGs (use windags-architect), specific tool implementation.

curiositech/windags-skills

Automated discovery and matching of agent skills for dynamic task routing and capability assessment

curiositech/windags-skills

Cryptographic security for agentic systems — zero-trust agent networking, signed message envelopes (JWS/JWE), capability-based security (ocaps), Merkle tree audit trails, WASM sandboxing, and formal verification. Covers CLI dev tool security, mTLS between agents, permission boundaries (least privilege for AI agents), and supply chain security for skills/plugins. Activate on: "agent security", "zero trust agents", "secure agent communication", "capability-based security", "ocap", "signed messages between agents", "agent audit trail", "sandbox agent execution", "agent permissions", "mTLS agents", "cryptographic verification", "agent supply chain", "OWASP agentic", "prove agent did X", "tamper-proof agent logs". NOT for: application-level SAST scanning (use security-auditor), network firewall rules (use infrastructure), SOC2/HIPAA compliance (organizational), or prompt injection defense (use prompt-engineer).

curiositech/windags-skills

Data structures and serialization formats for agent-to-agent communication. Covers message envelopes, structured output schemas, capability declarations, task handoff payloads, error/retry signaling, and context windows as data structures. Deep comparison of A2A protocol, MCP, OpenAI function calling, and LangChain message types. Teaches when to use rigid schemas vs free-form with validation, typed vs untyped, streaming vs batch. Activate on: "agent message format", "agent communication schema", "agent-to-agent protocol", "A2A protocol", "MCP message format", "structured output for agents", "agent interop", "interchange format", "agent serialization", "task handoff format", "capability declaration". NOT for: what agents say to each other (use agent-conversation-protocols), orchestration topology (use multi-agent-coordination), building agent infrastructure (use agentic-infrastructure-2026).

curiositech/windags-skills

Logic-based agent programming language implementing BDI architecture for practical autonomous agent development

curiositech/windags-skills

>- Design AgentSpeak(L)-style BDI agents with context-guarded plans, selection functions, and intention stacks. Use for interruptible autonomy, agent policy, and multi-agent orchestration in dynamic environments. NOT for simple rule engines, static planners, or centralized workflows.

curiositech/windags-skills

Foundational concurrent computation model where actors communicate exclusively through asynchronous message passing

curiositech/windags-skills

license: Apache-2.0 NOT for unrelated tasks outside this domain.

関連スキル