rails-programmer

Write and review Rails 8 code following DHH philosophy and Rails conventions.

Updated Nov 10, 2013
One-click install
npx skills add https://github.com/bnferguson/dotfiles --skill rails-programmer-bnferguson
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rails-programmer
Source: https://github.com/bnferguson/dotfiles/tree/main/.agents/skills/rails-programmer
Command: npx skills add https://github.com/bnferguson/dotfiles --skill rails-programmer-bnferguson

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rails codebases often drift into over-engineered patterns with unnecessary service objects, fat controllers, and non-idiomatic abstractions. This Skill keeps Rails development aligned with DHH's philosophy and official Rails conventions so code stays simple, conventional, and maintainable. ## Core Features & Use Cases - Convention-Driven Controllers: Enforces thin RESTful controllers with standard actions, before_action setup, and strong parameters. - Rich Model Guidance: Pushes business logic into models using validations, associations, scopes, and sparing use of callbacks and concerns. - Testing Discipline: Promotes TDD with Rails' built-in Minitest framework for controller and model tests run via bin/rails test. - Use Case: When implementing a new feature like a commenting system, the Skill guides you to put authorization in associations, business rules in model validations, and keep the controller to standard RESTful actions. ## Quick Start Review this Rails controller and refactor it to follow Rails 8 conventions with fat models and skinny controllers.

Frequently Asked Questions about rails-programmer

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

FAQPage Schema
How do I write idiomatic Rails 8 controllers?▼

Keep controllers thin with standard RESTful actions: index, show, new, create, edit, update, destroy. Use before_action for shared record lookup and strong parameters for input filtering, delegating all business logic to models.

Where should business logic go in a Rails application?▼

Business logic belongs in models, not controllers or service classes. Use Rails validations for business rules, associations for authorization, and scopes for common queries. Service objects are only acceptable when orchestrating across multiple models or external systems.

Should I use RSpec or Minitest for Rails testing?▼

This approach uses Rails' built-in Minitest framework, not RSpec. Write tests first following TDD, with controller tests for request/response behavior and model tests for validations, associations, and business logic, running them with bin/rails test.

When are service objects appropriate in Rails?▼

Default to models instead of service objects. Service objects are acceptable only when orchestrating across multiple models or external systems, and should follow existing patterns in app/services/ when genuinely warranted.

When should I avoid using Rails concerns?▼

Use concerns only for behavior truly shared across multiple models. For single-model behavior, keep the code directly in the model to avoid unnecessary abstraction and indirection.