agentleFS
gerard-labsgerard-labs/superpowers-api-platform/skills/api-platform-versioning/SKILL.md

api-platform-versioning

Skill2 starsChanged 6 months agoMITView on GitHub

Plan and implement API Platform 4.3 versioning — URI versioning (`/v1/`, `/v2/`), separate Output DTOs per version (with dedicated Providers), header-based versioning (`X-API-Version` resolved in a versioned Provider), additive group-based versioning for minor changes, deprecation with the 4.x attribute (`deprecationReason`, `sunset`, `openapi: new \\ApiPlatform\\OpenApi\\Model\\Operation(deprecated: true)`), `Sunset` / `Deprecation` / `Link` headers via a Response subscriber, and a per-version DTO changelog. Trigger when introducing a breaking change, planning a v2 endpoint, marking an operation as legacy, or migrating older versioning code from `openapiContext` (deprecated) to `openapi: new Model\\Operation`.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add a KernelEvents::RESPONSE subscriber to emit Sunset / Deprecation / Link: ….

    line 25
  2. Distinctive:

    Document the diff at the top of each new DTO (changelog comment).

    line 26
  3. Distinctive:

    Always announce a sunset date: when retiring an operation.

    line 31

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

API Platform 4.3 — Versioning

Use when

  • Adding a new operation or resource that breaks the contract.
  • Carving out a /v2/ set of endpoints next to /v1/.
  • Marking an operation deprecated with a Sunset date.
  • Migrating older code that still uses openapiContext: ['deprecated' => true] (deprecated 4.x) to the modern attribute.

Default workflow

  1. Decide the strategy — URI versioning (breaking), Output DTOs per version (when payload shape diverges), header-based, or group additive (minor additions only).
  2. Implement the chosen strategy with explicit uriTemplate, dedicated DTOs / Provider, or new group.
  3. On retired operations: set deprecationReason, sunset, and openapi: new Model\Operation(deprecated: true).
  4. Add a KernelEvents::RESPONSE subscriber to emit Sunset / Deprecation / Link: …; rel="successor-version" headers.
  5. Document the diff at the top of each new DTO (changelog comment).

Guardrails

  • URI versioning for breaking changes. Clearest signal for clients.
  • Group additive only for additions — never to remove or rename.
  • Always announce a sunset date when retiring an operation.
  • Limit active versions — keep 2-3 at most. Beyond that, the maintenance burden explodes.
  • Test every active version — no silent regression on v1.

Progressive disclosure

  • SKILL.md lists strategies and rules.
  • reference.md carries full examples for each strategy, the openapi 4.x attribute (Rector migration script for openapiContext), Sunset / Deprecation / Link headers, the DTO changelog header, multi-version functional tests, and best practices.

Output contract

  • New resources / DTOs / Providers per version with explicit uriTemplate.
  • Deprecated operations carry deprecationReason, sunset, and openapi: new Model\Operation(deprecated: true).
  • A response subscriber emits Sunset headers.
  • Functional tests cover every active version.

References

  • reference.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.