version-api
Skill26 starsChanged 4 months agoMITView on GitHub
Use when versioning a Rails REST API (v1/v2, deprecation, Sunset headers). Never break a public version in place. Trigger words: API version, v1, v2, versioning, deprecation.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- apply-code-conventionsSkill
- apply-stack-conventionsSkill
- code-reviewSkill
- create-engine-installerSkill
- create-engineSkill
- document-engineSkill
- extract-engineSkill
- generate-api-collectionSkill
- implement-authorizationSkill
- implement-background-jobSkill
- implement-graphqlSkill
- implement-hotwireSkill
- load-contextSkill
- optimize-performanceSkill
- plan-testsSkill
- rails-featureSkill
- rails-maintenanceSkill
- rails-reviewSkill
- refactor-codeSkill
- release-engineSkill
- review-architectureSkill
- review-engineSkill
- review-migrationSkill
- security-checkSkill
- seed-databaseSkill
- setup-environmentSkill
- test-engineSkill
- test-serviceSkill
- upgrade-engineSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 83
When asked to implement API versioning, your output MUST include:
≈ “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.
Files
Version API
Implement versioning strategies for Rails APIs.
Quick Reference
| Concern | File |
| Route namespaces | config/routes.rb |
| Header versioning | app/controllers/concerns/api_versioning.rb |
| Deprecation headers | app/controllers/concerns/deprecatable.rb |
| Compatibility specs | spec/requests/api/backward_compatibility_spec.rb |
HARD-GATE
GENERATED CODE SAFETY:
- NEVER generate code that constantizes or evaluates caller-supplied version strings
(e.g. "V#{params[:version]}".constantize is forbidden — use an explicit allowlist).
- NEVER generate code that passes request headers or paths unsanitized into class
instantiation, eval, or dynamic dispatch.
- Allowlist-only version resolution: generated routing/concern code MUST resolve
version identifiers from a fixed set (V1, V2, ...), not from free-form input.
ALWAYS maintain backward compatibility for at least one major version
NEVER remove endpoints without deprecation period
ALWAYS version in URL path (/api/v1/) or Accept header, never in bodyCore Process
- Choose strategy — URL path (
/api/v1/) for public APIs; Accept header for internal/private APIs. See strategies.md for header-based versioning details and trade-offs. - Add route namespace — Wrap new version resources in a
namespace :v2block inconfig/routes.rb:namespace :v1 do resources :users end namespace :v2 do resources :users end - Create controllers — Inherit from the previous version's controller and override only changed actions:
See EXAMPLES.md for additional inheritance patterns.module V2 class UsersController < V1::UsersController def index render json: User.all, only: [:id, :name, :email, :phone] end end end - Apply deprecation — Include
Deprecatablein old-version controllers to emitSunsetandDeprecationresponse headers automatically via abefore_action:module V1 class UsersController < ApplicationController include Deprecatable # Override sunset_date on the class to set the retirement date: # def self.sunset_date = Date.new(2025, 6, 1) end end - Run compatibility specs — Execute
bundle exec rspec spec/requests/api/backward_compatibility_spec.rbto confirm no regressions before merging. - Update documentation — Record the sunset date and migration guide for deprecated endpoints. See workflow.md for the full deprecation communication workflow.
Output Style
When asked to implement API versioning, your output MUST include:
- Versioning strategy — Explicitly state whether using URL path (/api/v1/) or Accept header versioning
- Inheritance strategy — Document how new version controllers inherit from previous version
- Route definition — Show the namespace route configuration in config/routes.rb
- Deprecation headers — Include Deprecatable concern with sunset date configuration
- Compatibility specs — Include the command to run backward compatibility specs
- Language — Must be in English unless explicitly requested otherwise
Extended Resources (Progressive Disclosure)
Load these files only when their specific content is needed:
- EXAMPLES.md — Use when you need complete API versioning examples with route definitions and controller inheritance
- references/strategies.md — Use when comparing versioning strategies (URL path vs header vs query param)
- references/workflow.md — Use when implementing the deprecation communication workflow and sunset scheduling
Integration
| Skill | When to chain |
| generate-api-collection | When generating the updated API endpoints |
| test-engine | When verifying specs for regressions |
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
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.

