agentsclimarketplace

Api versioning

Skill iceflower/agent-skills/api-versioning

Agent Skills 오픈 표준 기반 AI 코딩 에이전트용 스킬 컬렉션 (Java, Kotlin, Spring, NestJS, K8s, Terraform, GraphQL, gRPC, OpenTelemetry, a11y, i18n 등 60개)

Install
npx -y skills add iceflower/agent-skills --skill api-versioning

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

API versioning strategies and lifecycle management including URL path, header, and content negotiation versioning, breaking change classification, deprecation policies (RFC 9745, RFC 8594), API lifecycle stages, evolution patterns (expand-and-contract, tolerant reader), and API gateway version routing. Use when designing API versioning strategies, managing breaking changes, planning deprecation timelines, or implementing version routing.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

9.0 KB, as published. Nobody here has run it

API Versioning Rules

1. Versioning Strategy Selection

Strategy Comparison

StrategyCachingRoutingGateway SupportExample
URL pathExcellent (URL-based key)SimpleAll gateways/v1/users
Query parameterNeeds care (cache key)SimpleMost gateways/users?version=1
Custom headerGood (Vary header)MediumConfig neededApi-Version: 2
Content negotiationGood (Vary: Accept)ComplexLimitedAccept: application/vnd.api.v1+json
Date-basedGoodMediumConfig neededStripe-Version: 2024-09-30

Decision Guide

  • Default choice: URL path versioning — simplest, most widely understood
  • When to use header versioning: Same resource, multiple representations; fine-grained version control needed; internal APIs
  • When to use date-based: Frequent incremental changes; need account-level version pinning (like Stripe)
  • When to use content negotiation: Strict REST/HATEOAS; limited use cases

Rules

  • Expose only major version externally (e.g., /v1/, /v2/)
  • Minor/patch versions are internal — transparent to clients
  • Never run more than 2-3 major versions concurrently
  • Set a sunset date when releasing a new major version

2. Breaking vs Compatible Changes

Breaking Changes (require new major version)

CategoryExamples
RemovalRemove field, endpoint, enum value, HTTP method
Type changeChange field type (string → int), rename field
Constraint tighteningMake optional field required, reduce allowed values
Semantic changeChange meaning/algorithm of existing field
Auth escalationRequire higher permissions for existing endpoint
Default value changeChange default behavior clients depend on

Grey Area (may be breaking depending on clients)

ChangeRiskMitigation
Add new enum valueBreaks exhaustive switchDocument enums as extensible
Change error codesBreaks error handlingVersion error responses
Change sort orderBreaks position-dependent clientsDocument ordering contract
Add required headerBreaks existing integrationsMake optional with fallback first
Add required field to request bodyExisting clients get 400 errorsMake optional with default, or new version

Backward Compatible Changes (safe without version bump)

  • Add new endpoint
  • Add optional request parameter
  • Add field to response body (requires Tolerant Reader clients)
  • Add new HTTP method to existing resource
  • Relax validation rules
  • Add optional header

3. Deprecation Policy

HTTP Headers (RFC 9745 + RFC 8594)

HTTP/1.1 200 OK
Deprecation: @1688169599
Sunset: Sun, 30 Jun 2024 23:59:59 GMT
Link: <https://api.example.com/v2/migration>; rel="successor-version"
Link: <https://api.example.com/deprecation-policy>; rel="deprecation"
HeaderRFCFormatPurpose
DeprecationRFC 9745Unix timestamp (@1688169599)When deprecated
SunsetRFC 8594HTTP-dateWhen it will stop working
Link rel="successor-version"URLWhere to migrate
Link rel="deprecation"RFC 9745URLDeprecation details
  • Sunset date MUST NOT be earlier than Deprecation date
  • Past Deprecation date = already deprecated
  • Future Deprecation date = advance notice

Deprecation Timeline

PhaseTimingAction
AnnounceD-12 monthsDocs, email, dashboard notification
Deprecation headerD-6 monthsAdd Deprecation header to responses
Migration guideD-6 monthsPublish migration documentation
Usage monitoringD-3 monthsTrack old version usage, contact lagging consumers
Sunset headerD-3 monthsAdd Sunset header with final date
Rate limitingD-1 monthGradually reduce rate limits (optional)
RetirementD-dayReturn 410 Gone or 301 Redirect

Deprecation Rules

  • Never remove an API version without the full deprecation process
  • Minimum deprecation period: 6 months for public APIs, 3 months for internal
  • Monitor usage metrics before retirement — contact active consumers
  • Provide machine-readable deprecation info (headers) alongside human-readable (docs)

4. API Lifecycle

StageStabilityBreaking ChangesSLAProduction Use
AlphaNoneAnytimeNo supportNot recommended
BetaLimitedWith noticeLimitedConditional
GAFullMajor version onlyFull SLARecommended
DeprecatedFrozenNone (frozen)Maintenance onlyMigrate away
RetiredNoneN/ANo supportUnavailable (410)

Stage Transition Requirements

  • Alpha → Beta: Design review complete, basic documentation
  • Beta → GA: Compatibility policy defined, performance tested, SLA defined
  • GA → Deprecated: Successor exists, migration guide provided, 6-12 month notice
  • Deprecated → Retired: Usage below threshold, sunset date passed

5. API Evolution Patterns

Expand-and-Contract

Safely introduce breaking changes in three phases:

  1. Expand: Add new field/endpoint alongside existing one (both work)
  2. Migrate: Clients switch to new field/endpoint (monitor progress)
  3. Contract: Remove old field/endpoint (after all clients migrated)
# Example: Split fullName into firstName + lastName

Phase 1 (Expand):
  { "fullName": "John Doe", "firstName": "John", "lastName": "Doe" }

Phase 2 (Migrate):
  Clients switch to firstName/lastName. Monitor fullName usage → 0.

Phase 3 (Contract):
  { "firstName": "John", "lastName": "Doe" }

Tolerant Reader

Client-side defensive design:

  • Ignore unknown fields (never fail on extra data)
  • Use defaults for missing fields
  • Do not depend on field ordering
  • Use lenient deserialization (e.g., @JsonIgnoreProperties(ignoreUnknown = true))

Additive-Only Strategy

  • Add new features as new fields/endpoints only
  • Never remove or modify existing fields
  • Avoids major version bumps for extended periods
  • Trade-off: API surface grows over time

6. Implementation Patterns

For detailed implementation examples, see references/implementation-patterns.md.

Spring Framework 7 / Spring Boot 4+

Note: Requires Spring Boot 4.0+ (Spring Framework 7). Not available in Boot 3.x.

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void configureApiVersioning(ApiVersionConfigurer configurer) {
        configurer.useRequestHeader("Api-Version");
    }
}

@RestController
@RequestMapping("/accounts")
public class AccountController {
    @GetMapping(path = "/{id}", version = "1")
    public AccountV1 getV1(@PathVariable Long id) { /* ... */ }

    @GetMapping(path = "/{id}", version = "2")
    public AccountV2 getV2(@PathVariable Long id) { /* ... */ }
}

Express.js

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

7. API Gateway Version Routing

Route versions at the gateway layer to decouple backend services.

Client → API Gateway → /v1/* → Backend v1 (port 8081)
                     → /v2/* → Backend v2 (port 8082)

Benefits

  • Backend services don't need version routing logic
  • Independent deployment and scaling per version
  • Combine with canary deployment for gradual version transitions
  • Centralized rate limiting and monitoring per version

Gateway-Specific Patterns

GatewayVersioning Approach
KongRoute objects with path/header matching
AWS API GatewayStages + resource paths, canary support
NginxLocation blocks with proxy_pass
EnvoyRoute match rules, weighted clusters

8. Common Anti-Patterns

Anti-PatternProblemFix
No versioning at allAny change risks breaking clientsVersion from day one
Too many concurrent versionsMaintenance burdenMax 2-3 active versions
Breaking change without version bumpClient breakageFollow breaking change rules
Skipping deprecation processSurprise removalFull deprecation timeline
Version in every URL segment/v1/users/v2/ordersSingle version at API root
Over-versioning (new version for minor changes)Unnecessary migrationsUse additive changes
Client-specific versionsUnmaintainableUse feature flags instead
No usage monitoring before retirementActive consumers cut offTrack and notify

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.