rails-idioms

Enforce idiomatic Rails patterns for Active Record models, controllers, and Hotwire.

150|48|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/irahardianto/awesome-agv --skill rails-idioms-irahardianto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-idioms
Source: https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/rails-idioms
Command: npx skills add https://github.com/irahardianto/awesome-agv --skill rails-idioms-irahardianto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents Rails codebases from drifting into non-idiomatic patterns that create security risks, maintenance pain, and performance issues.

Core Features & Use Cases

  • Active Record best practices: use chainable scopes, model-level validations, and eager loading (includes) to avoid N+1 queries.
  • Thin controllers with strong parameters: keep controllers focused on routing, move business logic into service objects, and strictly permit params.
  • Hotwire-aware UI updates: use Turbo Frames/Streams and keep Stimulus for small JS enhancements.
  • Safer error handling and security: apply rescue_from appropriately, define domain errors, avoid rescue Exception, and prevent SQL injection by avoiding string interpolation in queries.

Quick Start

Use the rails-idioms skill to rewrite your controller and model code into conventional Rails patterns, including strong parameters, service objects, and correct eager loading for any app routes under app/**/*.rb and config/routes.rb.

Frequently Asked Questions about rails-idioms

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor fat controllers in Rails to use service objects?

Refactoring fat controllers involves moving business logic into service objects, keeping controllers focused on routing, and strictly permitting params with strong parameters. This ensures thin controllers and improves maintainability.

What is the best way to handle errors in Rails without rescuing Exception?

Handling errors safely in Rails means avoiding `rescue Exception` and defining specific domain errors instead. You should apply `rescue_from` appropriately in controllers to catch expected failures without masking critical system errors.

How do I prevent SQL injection when constructing Active Record queries?

Preventing SQL injection in Rails requires avoiding string interpolation in queries. Construct safe Active Record queries using parameterized methods and chainable scopes to ensure database interactions remain secure.

How do I structure Hotwire UI updates with Turbo Frames and Stimulus?

Structuring Hotwire UI updates involves using Turbo Frames and Streams for partial page rendering. Keep Stimulus controllers minimal for small JavaScript enhancements, ensuring idiomatic Hotwire-aware integrations in Rails.