rails-idioms

rails-idioms is a skill for Claude Code from slbug/claude-ruby-grape-rails. It costs 52 tokens per session (1,131 once invoked), scanned A, original, MIT.

A guide to common Rails ways of structuring controllers, callbacks, routes, background jobs, and automatic code loading.

In plain words
What is it for?
Use it when deciding how Rails controllers, callbacks, routes, jobs, and autoloaded constants should work.
Why use it?
It helps developers choose framework-supported patterns and avoid misplaced logic or confusing application behaviour.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the ruby-grape-rails plugin — 52 skills, 19 agents, 17 hooks shipped together

Good fit Use it when deciding how Rails controllers, callbacks, routes, jobs, and autoloaded constants should work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/slbug/claude-ruby-grape-rails/rails-idioms
Install

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.

Any agent
npx skills add slbug/claude-ruby-grape-rails --skill rails-idioms
Clone the repo
git clone --depth 1 https://github.com/slbug/claude-ruby-grape-rails

Made for: Claude Code.

Or install ruby-grape-rails, the plugin that ships this one along with the rest of its 52 skills, 19 agents, 17 hooks.

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

agentmods badge for rails-idioms

README.md
[![agentmods](https://agentmods.dev/badge/skills/slbug/claude-ruby-grape-rails/rails-idioms/github.svg)](https://agentmods.dev/skills/slbug/claude-ruby-grape-rails/rails-idioms)
Your own site
<a href="https://agentmods.dev/skills/slbug/claude-ruby-grape-rails/rails-idioms"><img src="https://agentmods.dev/badge/skills/slbug/claude-ruby-grape-rails/rails-idioms/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.

agentmods 80×15 button for rails-idioms

Your own site · 80×15
<a href="https://agentmods.dev/skills/slbug/claude-ruby-grape-rails/rails-idioms"><img src="https://agentmods.dev/badge/skills/slbug/claude-ruby-grape-rails/rails-idioms.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,131 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.01131
Opus 5 $0.00026 $0.00566
Sonnet 5 $0.00010 $0.00226
Haiku 4.5 $0.00005 $0.00113

Measured 7d ago against content hash 03a93477f42c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

rails-idioms scanned grade A with 0 findings 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 7d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/ruby-grape-rails/skills/rails-idioms/SKILL.md · 140 lines

How it starts

The opening of the file, as written. The whole thing — 140 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rails Idioms

Iron Laws

  1. Controllers orchestrate; they do not own domain logic.
  2. Use explicit params shaping and authorization.
  3. Keep callbacks boring; push external side effects to after_commit or application services.
  4. Prefer built-in Rails capabilities before adding infrastructure gems.
  5. Use Sidekiq for high-throughput background jobs (this plugin's recommended stack).
  6. Consider Solid Queue for simpler ops when throughput needs are moderate (Rails 8 default).
  7. Choose cache/cable backends based on infrastructure — Redis for multi-server, Solid for single-server simplicity.

Overview

Rails 8 brings database-backed infrastructure (Solid Queue, Solid Cache, Solid Cable) that eliminates Redis dependency for many applications. This skill covers modern Rails patterns from Rails 7 through 8.x.

Rails 8 Solid Stack

Rails 8 introduces three database-backed alternatives to Redis infrastructure:

Component Replaces Best For
Solid Queue Sidekiq/Redis Moderate throughput, simpler ops
Solid Cache Redis Single-server or replicated setups
Solid Cable Redis Most real-time features

See Solid Trifecta Guide for setup and migration.

Quick Reference

Controllers

# Modern controller structure
class PostsController < ApplicationController
  before_action :set_post, only: [:show, :edit, :update, :destroy]
  before_action :authorize_post!, only: [:edit, :update, :destroy]
  
  def index
    @posts = Post.recent.includes(:author, :tags)
  end
  
  def create
    @post = Post.new(post_params)
    
    if @post.save
      redirect_to @post, notice: "Post created"
    else
      render :new, status: :unprocessable_entity
    end
  end
  
  private
  
  def post_params
    params.require(:post).permit(:title, :body, :published, tag_ids: [])
  end
end

See Controllers Guide for patterns and anti-patterns.

Read the full file on GitHub · 140 lines

Changes

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.

  1. 7d ago First seen · 140 lines · 52 tokens per session scan A 03a93477f42c

Subscribe to this mod's changes

rails-idioms is a skill published in the GitHub repository slbug/claude-ruby-grape-rails (7 stars, last pushed 5d ago), licensed MIT. It adds 52 tokens to every session and 1,131 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

draper-decorators

This skill should be used when the user asks to "create a decorator", "write a decorator", "move logic into decorator", "clean logic out of the view", "isn't it decorator logic", "test a decorator", or mentions Draper, keeping views clean, or representation logic in decorators. Should also be used when editing…

hoblin/claude-ruby-marketplace · 131 tokens

rails-expert

Rails 7+ specialist that optimizes Active Record queries with includes/eagerload, implements Turbo Frames and Turbo Streams for partial page updates, configures Action Cable for WebSocket connections, sets up Sidekiq workers for background job processing, and writes comprehensive RSpec test suites. Use when building…

Jeffallan/claude-skills · 104 tokens

new

Create a new project to start development quickly.

clacky-ai/openclacky · 10 tokens

pinme-email

Use this skill when a PinMe project (Worker TypeScript) needs to integrate email sending (sendemail). Guides AI to generate correct Worker TS code.

glitternetwork/pinme · 35 tokens

rails-conventions

Rootstrap Rails conventions. Use when writing, reviewing, or editing any Rails code — controllers, models, migrations, routes, views, mailers, initializers, locale files, or Rails config. Covers routing, ActiveRecord, migrations, i18n, time zones, mailers, assets, Bundler groups, and logging.

rootstrap/rails_api_base · 71 tokens

networking-layer

Generates a protocol-based networking layer with async/await, error handling, and swappable implementations. Use when user wants to add API client, networking, or HTTP layer.

rshankras/claude-code-apple-skills · 39 tokens