Skills

Rails Dev

Opinionated Rails conventions: rich models, concerns, CRUD-everything...

Install

npx skills add tech-leads-club/agent-skills --skill rails-dev -g -a claude-code -y
Category
Design
Updated
3d ago
License
See repository
Context cost
Mediumabout 1,915 tokens
Runs scripts
No, instructions only

What it does

Opinionated Rails conventions: rich models, concerns, CRUD-everything, state-as-records, minimal dependencies, Minitest with fixtures. Load this skill BEFORE any code-level thinking, not only before editing a file. It is required the moment a task touches Rails code in ANY way: designing or even just discussing a data model, schema, migration, entity, association, field, validation, class, or method name; writing, planning, reviewing, analyzing, testing, debugging, or refactoring; or proposing any model, table, column, route, or code snippet inline in chat. If you are about to name a model or sketch a column you are already in scope, even in an exploratory back-and-forth where no file is written yet. Do not let a \"we're just discussing\" framing defer it. Do NOT use for non-Rails backends, NestJS, or general architecture (use nestjs-modular-monolith or coding-guidelines).

Rails Conventions

Core Philosophy

  • Rich models - Business logic lives in models, not service objects
  • Everything is CRUD - New resource over new action (resource :closure not post :close)
  • State as records - Closure model instead of closed: boolean
  • Concerns for composition - Closeable, Watchable, Commentable
  • Explicit over clever - Inline until repetition is real; an abstraction earns its place, it isn't built on speculation
  • Small interfaces - No public method without a caller
  • Let it crash - Bang methods (create!), handle failures at the boundary, not by pre-guarding (references/error-handling.md)
  • Invariants in the schema - Hard rules (presence, uniqueness, ranges) are NOT NULL / unique / check constraints; validations are for user-facing messages, not the source of truth. References stay soft: no foreign keys, integrity at the model layer
  • Minimal dependencies - Build it yourself before reaching for gems. No Devise, Pundit, RSpec, FactoryBot, ViewComponent, service/form objects, or decorators
  • Database-backed - Solid Queue/Cache/Cable, no Redis
  • Test coverage - Maintain roughly 1:1 test ratio (1 line test per line of code)

Reference Selection

This table is an index, not the content. The conventions live in the reference files, not in this table, the codebase, or general Rails knowledge. Match the task to the rows below and read those files end to end before you design, write, review, or analyze the code. Reading the row is not reading the reference; guessing from the codebase is how the wrong convention gets shipped.

Read the whole SKILL.md on GitHub

More in Design