api-versioning-strategy by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill api-versioning-strategy关于 REST API、GraphQL 和 gRPC 服务的 API 版本控制方法、弃用策略、向后兼容技术以及迁移规划的全面指南。
最小工作示例:
// express-router.ts
import express from "express";
const app = express();
// Version 1
app.get("/api/v1/users", (req, res) => {
res.json({
users: [{ id: 1, name: "John Doe" }],
});
});
// Version 2 - Added email field
app.get("/api/v2/users", (req, res) => {
res.json({
users: [{ id: 1, name: "John Doe", email: "john@example.com" }],
});
});
// Shared logic with version-specific transformations
app.get("/api/:version/users/:id", async (req, res) => {
const user = await userService.findById(req.params.id);
if (req.params.version === "v1") {
res.json({ id: user.id, name: user.name });
// ... (see reference guides for full implementation)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/ 目录下的详细实现:
| 指南 | 内容 |
|---|---|
| 版本控制方法 | 版本控制方法 |
| 向后兼容模式 | 向后兼容模式 |
| 弃用策略 | 弃用策略 |
| 迁移指南示例 | 迁移指南示例 |
| 响应结构 | 响应结构 |
| 日期格式 | 日期格式,错误格式 |
| JavaScript/TypeScript | JavaScript/TypeScript,Python |
| GraphQL 版本控制 | GraphQL 版本控制 |
| gRPC 版本控制 | gRPC 版本控制 |
| 版本检测与路由 | 版本检测与路由 |
| 测试多个版本 | 测试多个版本 |
| 模式 1:版本无关核心 | 模式 1:版本无关核心,模式 2:用于渐进式推出的功能标志,模式 3:API 版本指标 |
每周安装量
114
代码仓库
GitHub 星标数
121
首次出现
2026 年 1 月 21 日
安全审计
安装于
gemini-cli95
opencode95
codex91
claude-code88
cursor87
github-copilot77
Comprehensive guide to API versioning approaches, deprecation strategies, backward compatibility techniques, and migration planning for REST APIs, GraphQL, and gRPC services.
Minimal working example:
// express-router.ts
import express from "express";
const app = express();
// Version 1
app.get("/api/v1/users", (req, res) => {
res.json({
users: [{ id: 1, name: "John Doe" }],
});
});
// Version 2 - Added email field
app.get("/api/v2/users", (req, res) => {
res.json({
users: [{ id: 1, name: "John Doe", email: "john@example.com" }],
});
});
// Shared logic with version-specific transformations
app.get("/api/:version/users/:id", async (req, res) => {
const user = await userService.findById(req.params.id);
if (req.params.version === "v1") {
res.json({ id: user.id, name: user.name });
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Versioning Approaches | Versioning Approaches |
| Backward Compatibility Patterns | Backward Compatibility Patterns |
| Deprecation Strategy | Deprecation Strategy |
| Migration Guide Example | Migration Guide Example |
| Response Structure | Response Structure |
| Date Format | Date Format, Error Format |
| JavaScript/TypeScript |
Weekly Installs
114
Repository
GitHub Stars
121
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli95
opencode95
codex91
claude-code88
cursor87
github-copilot77
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
163,300 周安装
| JavaScript/TypeScript, Python |
| GraphQL Versioning | GraphQL Versioning |
| gRPC Versioning | gRPC Versioning |
| Version Detection & Routing | Version Detection & Routing |
| Testing Multiple Versions | Testing Multiple Versions |
| Pattern 1: Version-Agnostic Core | Pattern 1: Version-Agnostic Core, Pattern 2: Feature Flags for Gradual Rollout, Pattern 3: API Version Metrics |