Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add sandeepmvl/rails-skills --skill 06-rails-api-designgit clone --depth 1 https://github.com/sandeepmvl/rails-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/sandeepmvl/rails-skills/06-rails-api-design)<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/06-rails-api-design"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/06-rails-api-design/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/06-rails-api-design"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/06-rails-api-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00137 | $0.04490 |
| Opus 5.5 | $0.00055 | $0.01796 |
| Sonnet 5.5 | $0.00027 | $0.00898 |
| Haiku 4.5 | $0.00014 | $0.00449 |
Grade A, and why
rails-api-design scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
| Debuggability | curl shows the version in the URL | requires correct header to see anything | How it starts
The opening of the file, as written. The whole thing — 480 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rails API Design
Build a JSON API that ages well. AI agents generate Rails APIs by reflex:
respond_to :json,to_json, no versioning, no rate limiting, no consistent error shape. This skill encodes the choices senior Rails API authors make when the API has to live for years.
Why this matters
A REST API is a contract. Once clients depend on it, every change is a coordination cost. Get the foundations right at the start — versioning strategy, serialization layer, pagination, error format — or pay for it later in deprecation pain.
The opinion
URL versioning (
/api/v1). jsonapi-serializer for JSON:API; alba for plain JSON. pagy for pagination (faster than kaminari). JWT for stateless third-party / mobile clients; session cookies for first-party SPAs on the same domain. rack-attack for rate limiting + brute-force. Structured errors per RFC 9457 (problem-details) or JSON:API errors. rswag for OpenAPI generation from request specs.
Counter-positions:
- GraphQL over REST: legitimate for highly-relational read APIs with many client variants. We default to REST because the tooling is broader and the operational burden is lower. If you have GraphQL needs, use
graphql-ruby. - Accept-header versioning (
Accept: application/vnd.myapp+json; version=2): cleaner in theory; in practice harder to debug, caches awkwardly, and devs hate it. URL versioning wins on operational ergonomics. - active_model_serializers (AMS): widely used historically. We default to
jsonapi-serializer(formerly Fast JSONAPI) oralbabecause both are 10–50× faster.
Core patterns
Pattern 1: URL versioning
Route structure:
# config/routes.rb
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :posts, only: %i[index show create update destroy] do
resources :comments, only: %i[index create]
end
resource :session, only: %i[create destroy]
end
end
end
Controller structure:
# app/controllers/api/v1/base_controller.rb
class Api::V1::BaseController < ActionController::API
include ActionController::HttpAuthentication::Token::ControllerMethods
before_action :authenticate_user!
rescue_from ActiveRecord::RecordNotFound, with: :not_found
rescue_from ActiveRecord::RecordInvalid, with: :unprocessable_entity
rescue_from Pundit::NotAuthorizedError, with: :forbidden
private
def authenticate_user!
authenticate_or_request_with_http_token do |token, _options|
@current_user = User.find_by(api_token: token)
end
end
def current_user
@current_user
end
def not_found(error)
render json: { errors: [{ status: "404", title: "Not Found", detail: error.message }] },
status: :not_found
end
def unprocessable_entity(error)
render json: { errors: error.record.errors.map { |e| { status: "422", title: "Validation Failed", detail: "#{e.attribute} #{e.message}", source: { pointer: "/data/attributes/#{e.attribute}" } } } },
status: :unprocessable_entity
end
def forbidden(_error)
render json: { errors: [{ status: "403", title: "Forbidden" }] }, status: :forbidden
end
end
class Api::V1::PostsController < Api::V1::BaseController
def index
posts = policy_scope(Post).includes(:author).order(created_at: :desc)
pagy_obj, paginated = pagy(posts, limit: 25)
render json: PostSerializer.new(paginated, meta: pagination_meta(pagy_obj)).serializable_hash
end
end
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 480 lines · 137 tokens per session scan A ccfd014247a0
rails-api-design is a skill published in the GitHub repository sandeepmvl/rails-skills (22 stars, last pushed 2mo ago), licensed MIT. It adds 137 tokens to every session and 4,490 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
rails-api-design compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| rails-api-designsandeepmvl/rails-skills | Skill | 22 | 2mo ago | MIT | A | 137 | Claude Code, Codex |
| rails-expertJeffallan/claude-skills | Skill | 13k | 2d ago | MIT | A | 104 | Claude Code |
| newclacky-ai/openclacky | Skill | 1.2k | yesterday | MIT | A | 10 | Claude Code |
| rails-conventionsrootstrap/rails_api_base | Skill | 635 | 19d ago | MIT | A | 71 | Claude Code |
| rails-devtech-leads-club/agent-skills | Skill | 7.2k | yesterday | none | A | 199 | Claude Code, Codex |
| draper-decoratorshoblin/claude-ruby-marketplace | Skill | 38 | 3d ago | MIT | A | 131 | Claude Code |
| ruby-railsj4flmao/agent-skills | Skill | 47 | 16d ago | MIT | A | 69 | Claude Code, Codex |