API Compatibility
Own the lifecycle of a public API: who breaks when you ship, how long old behavior lives, and how clients discover what’s next. Pair with http-api for how requests look today; this skill is about time and promises.
When to use
- - Adding/removing fields, routes, or semantics that existing clients rely on.
- Choosing URL vs header vs package versioning—or when no formal version and only additive JSON.
- Deprecation: timelines, metrics (who still calls old paths?), and removal gates.
Core ideas
- - Additive first — nullable new fields beat silent behavior changes.
- Explicit contracts — integration tests or consumer-driven checks for critical partners.
- Communicate — changelog, developer email, in-response Sunset / warnings where standards allow.
Avoid
- - “We’ll just bump the version” without a migration story for slow-moving apps.
- Breaking auth or pagination with no coordination window.
- Deprecating without usage data—you’ll cut traffic you didn’t know existed.
Checklist before breaking
- - [ ] Who is affected (internal only vs third parties)?
- [ ] Minimum notice period and rollback if telemetry spikes errors?
- [ ] Docs + examples updated before the flag day?
Done when
- - Old and new behaviors are measurable; removal is gated on evidence, not hope.
API 兼容性
掌控公共API的生命周期:发布时谁会受影响,旧行为保留多久,以及客户端如何发现后续变化。与描述当前请求样式的http-api技能配合使用;本技能关注的是时间与承诺。
何时使用
- - 添加/移除现有客户端依赖的字段、路由或语义。
- 选择URL vs 请求头 vs 包版本控制——或者不采用正式版本,仅使用增量JSON。
- 弃用:时间线、指标(谁还在调用旧路径?)以及移除条件。
核心思想
- - 增量优先——可空的新字段优于静默的行为变更。
- 明确契约——针对关键合作伙伴进行集成测试或消费者驱动的检查。
- 沟通——更新日志、开发者邮件、在响应中按标准允许的方式添加Sunset/警告信息。
避免事项
- - 在没有为更新缓慢的应用提供迁移方案的情况下,我们只需升级版本。
- 在没有协调窗口期的情况下,破坏认证或分页功能。
- 在没有使用数据的情况下进行弃用——你可能会切断自己未曾意识到的流量。
破坏性变更前的检查清单
- - [ ] 谁将受影响(仅内部还是包括第三方)?
- [ ] 最低通知期限,以及当遥测数据显示错误激增时的回滚方案?
- [ ] 在切换日之前是否已更新文档和示例?
完成标准