Communitygithub.com

API 版本管理与向后兼容性

设计 API 版本管理策略,优雅地演进而不破坏现有消费者。涵盖 URL 路径、标头和内容协商等版本管理方法,以及弃用工作流。

API 版本管理与向后兼容性 是什么?

该技能专注于 API 版本管理与向后兼容性的设计策略,帮助开发者在修改 API 时避免破坏现有消费者。它支持 URL 路径版本管理(如 `/api/v2/`)、标头版本管理(如 `API-Version`)和内容协商(如 `Accept: application/vnd.myapi.v2+json`)三种主流方式,并严格按照 RFC 8594 实现 Sunset 标头来推进弃用流程。技能提供了一个决策树,帮助开发者判断变更类型(新增、修改、删除),并选择相应策略。同时,通过 TypeScript 示例展示了 Express 路由中的版本并行部署和 Sunset 标头中间件。它特别强调“应避免过度版本化”,大多数变更应为向后兼容的新增;弃用时必须设定具体的关停日期,并借助监控和差异工具(如 Optic、Bump.sh)跟踪迁移进度。该技能适用于 Cursor、Claude Code 和 Codex 等平台。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/curiositech/windags-skills/tree/HEAD/skills/api-versioning-backward-compatibility

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

API 版本管理与向后兼容性 是做什么的?

设计 API 版本管理策略,优雅地演进而不破坏现有消费者。

激活触发器

激活于: "API 版本管理"、"向后兼容性"、"弃用"、"破坏性变更"、"API 迁移"、"v1 v2"、"sunset 标头"、"API 演进"、"非破坏性变更"

不适用于: 数据模式演进 → schema-evolution-manager | 网关版本路由 → api-gateway-reverse-proxy-expert | GraphQL 弃用 → graphql-server-architect

快速开始

  1. 分类变更 — 新增(安全)、修改(可能破坏)、删除(破坏性)
  2. 选择策略 — URL 路径(/v2/)、标头(API-Version)或内容协商
  3. 实现 Sunset 标头 — RFC 8594 告知消费者旧版本何时消亡
  4. 并行运行版本 — 主版本至少保持 6 个月重叠
  5. 监控采纳情况 — 追踪每版本的流量以知道何时退役

核心能力

领域技术
URL 版本管理/api/v1/、/api/v2/ 基于路径的路由
标头版本管理API-Version: 2024-01-15、Accept-Version
内容协商Accept: application/vnd.myapi.v2+json
弃用Sunset 标头(RFC 8594)、Deprecation 标头
工具OpenAPI 3.1 overlays、Optic、Bump.sh

架构模式

版本管理策略决策树

是纯新增吗?(新字段、新端点)
  ├─ 是 → 无需版本升级(向后兼容)
  └─ 否 → 是字段重命名/类型变更吗?
       ├─ 是 → 能否同时保留新旧字段?
       │    ├─ 是 → 新增字段,弃用旧字段(小版本)
       │    └─ 否 → 主版本升级(v1 → v2)
       └─ 否 → 是删除操作吗?
            └─ 是 → 主版本升级并附带 sunset 期限

并行版本部署

// 基于版本的路由的 Express 路由器
import { Router } from 'express';

const v1Router = Router();
const v2Router = Router();

// v1:返回 { name: string }
v1Router.get('/users/:id', async (req, res) => {
  const user = await getUser(req.params.id);
  res.json({ name: user.fullName }); // 遗留格式
});

// v2:返回 { firstName, lastName, displayName }
v2Router.get('/users/:id', async (req, res) => {
  const user = await getUser(req.params.id);
  res.json({
    firstName: user.firstName,
    lastName: user.lastName,
    displayName: user.fullName,
  });
});

app.use('/api/v1', v1Router);
app.use('/api/v2', v2Router);

// v1 的 Sunset 标头中间件
v1Router.use((req, res, next) => {
  res.set('Sunset', 'Sat, 01 Nov 2026 00:00:00 GMT');
  res.set('Deprecation', 'true');
  res.set('Link', '</api/v2>; rel="successor-version"');
  next();
});

基于日期的版本管理(Stripe 模型)

API-Version: 2026-03-15

变更与日期绑定,而非整数:
  2026-01-01 → 基线
  2026-03-15 → 将 `name` 重命名为 `display_name`
  2026-06-01 → 移除 `legacy_field`

服务器将对无版本请求固定到账户的默认版本。
每个版本是规范内部模型之上的一个转换层。

反模式

  1. 过度版本化 — 大多数变更是附加性的,不需要版本升级;自由添加字段
  2. 没有 sunset 时间线 — 弃用而没有具体的关闭日期会导致版本永远存活
  3. 复制整个控制器 — 使用转换/适配器层,而不是每个版本复制业务逻辑
  4. 忽略未知字段 — API 应容忍读取;在输入中忽略未知字段(Postel 定律)
  5. 在小版本中引入破坏性变更 — 如果消费者依赖了某个内容,移除它就是破坏性的,无论你的意图如何

质量检查清单

  • 附加性变更(新字段、新端点)无需版本升级即可发布
  • 破坏性变更需要主版本升级并附带 6 个月以上的 sunset 期限
  • 在已弃用版本上设置 Sunset 标头(RFC 8594)
  • Link 标头指向后续版本
  • 按版本监控流量以跟踪迁移进度
  • 每个版本发布 OpenAPI 规范,并配套差异工具(Optic/Bump.sh)
  • 消费者通知计划:变更日志、邮件、仪表盘警告
  • 版本路由在网关层处理,而非应用代码中
  • 集成测试验证向后兼容性(契约测试)

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.

相关技能