Api versioning strategy

From aj-geddes/useful-ai-prompts · View interactive version

Api versioning strategy is an AI agent skill from the GitHub repository aj-geddes/useful-ai-prompts. Implement API versioning strategies including URL versioning, header versioning, backward compatibility, deprecation strategies, and migration guides. Use when dealing with API versions, deprecating endpoints, or managing breaking changes.

How to use this skill

Skill file

API Versioning Strategy

Table of Contents

Overview

Comprehensive guide to API versioning approaches, deprecation strategies, backward compatibility techniques, and migration planning for REST APIs, GraphQL, and gRPC services.

When to Use

Quick Start

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)

Reference Guides

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 | 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 |

Best Practices

✅ DO

❌ DON'T

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.