packages/skills-catalog/skills/(development)/rails-dev/SKILL.md
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).
npx skillsauth add tech-leads-club/agent-skills rails-devInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
resource :closure not post :close)Closure model instead of closed: booleanCloseable, Watchable, Commentablecreate!), handle failures at the boundary, not by pre-guarding (references/error-handling.md)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.
| Task | Reference |
|------|-----------|
| Models, validations, associations, business logic | references/model.md |
| Custom validators, validation rules reused across models | references/validator.md |
| Error handling, rescue boundaries, reporting, retries | references/error-handling.md |
| Controllers, CRUD actions | references/crud.md |
| Routes, config/routes.rb, resource mapping | references/routes.md |
| Concerns, shared behavior | references/concerns.md |
| State tracking (not booleans) | references/state-records.md |
| Authentication, authorization, sessions, IDOR scoping | references/auth.md |
| Database migrations | references/migration.md |
| Minitest, fixtures, testing | references/test.md |
| Views, ERB, partials, helpers, presentation logic | references/view.md |
| Turbo Frames, Turbo Streams, real-time | references/turbo.md |
| Stimulus controllers, JS sprinkles | references/stimulus.md |
| Background jobs, Solid Queue | references/jobs.md |
| Concurrency, fibers, Async, external I/O | references/async.md |
| Mailers, email notifications | references/mailer.md |
| Fragment caching, HTTP caching | references/caching.md |
| REST API, JSON responses | references/api.md |
| Multi-tenancy, account scoping | references/multi-tenant.md |
| Event tracking, activity logs | references/events.md |
| Webhooks (inbound/outbound), inbox, idempotency | references/webhooks.md |
| Code review, consistency check | references/review.md |
| HTTP clients, external APIs, Faraday | references/http-client.md |
| Logging, log messages, Rails.logger | references/logging.md |
These are cross-cutting rules: they apply to every file, regardless of area. They do not replace the references. For anything area-specific (models, controllers, jobs, views, tests, …) you MUST ALWAYS load the matching reference from the table above before writing or reviewing the code.
Use an expanded if/else over a value-returning guard clause. A guard clause at the top of a method is fine when the body is non-trivial.
# Don't: value-returning guard clause for a simple branch
def status_label
return "closed" if closed?
"open"
end
# Do: expanded if/else
def status_label
if closed?
"closed"
else
"open"
end
end
Class methods, then public (with initialize first), then private. Order methods vertically by invocation: a caller sits above its callees.
# Don't: callee above its caller, public after private
class Signup
def create_member = Member.create!(email:)
def call = create_member
end
# Do: class method, then the caller, then its callees
class Signup
def self.call(...) = new(...).call
def call = create_member
private
def create_member = Member.create!(email:)
end
No blank line after private; indent the methods beneath it. A module of only private methods marks private at the top with a blank line after, not indented.
# Don't: blank line after private, methods not indented
class Card
private
def closure_exists? = closure.present?
end
# Do: no blank line, indented under private
class Card
private
def closure_exists? = closure.present?
end
Use ! only when a non-bang counterpart exists (like save/save!). Never add ! just to flag a destructive or important action.
# Don't: unpaired bang used to signal "this is destructive"
def revoke! = update!(revoked_at: Time.current)
# Do: plain domain verb; the ! belongs to the paired persistence call
def revoke = update!(revoked_at: Time.current)
Public methods are domain verbs. When a verb collides with a scope, predicate, or core method (Kernel#fail), prefix with mark_ (no bang): mark_failed. Class and concept naming live in references/model.md.
# Don't: mark_ prefix when the plain verb is free
def mark_published = update!(published_at: Time.current)
# Do: plain verb; reserve mark_ for a real collision (fail -> Kernel#fail)
def publish = update!(published_at: Time.current)
def mark_failed = update!(failed_at: Time.current)
Default to none. Most comments are noise: the code and naming should carry the meaning.
Add one only when the code can't carry it:
Don't:
# ----- some_method ----- banners in tests).When a comment earns its place:
# Don't: restates what the code already says; section banner
# increment the attempts counter
attempts += 1
# ----- private helpers -----
# Do: explains the non-obvious why
# Circle returns 422 on duplicate emails, so we reconcile instead of recreating.
reconcile_member(email)
Don't swallow errors. Make the failure accessible to the caller, usually by recording it on a returned object rather than logging and returning false. Full handling conventions (record vs raise, reporting, wrapping, retries) live in references/error-handling.md.
# Don't: swallow the error; the caller can't tell it failed
def provision_circle
circle_client.create_community_member(...)
rescue Circle::AdminClient::ApiError
false
end
# Do: record the failure on the returned object
def provision_circle
circle_client.create_community_member(...)
circle_access.mark_successful(external_id: response.dig(:community_member, :id))
rescue Circle::AdminClient::ApiError => e
circle_access.mark_failed(error: e.message) # caller checks access.failed?
end
These conventions are adapted from, and may diverge from, these reference apps:
tools
Feature planning and implementation with 4 adaptive phases (Specify, Design, Tasks, Execute). Auto-sizes depth by complexity. Writes testable requirements in EARS notation, atomic tasks, atomic Conventional Commits, and requirement traceability. Ships deterministic Python validation scripts so structural gates are enforced by code, not memory. Features an independent Verifier (author != verifier, evidence-or-zero), a discrimination sensor, a decision log (STATE.md), a test-coverage matrix, and a self-improving lessons layer. Stack-agnostic and tool-agnostic. Use when (1) planning features, (2) implementing with verification and atomic commits, (3) validating an implementation against a spec. Triggers on "specify feature", "discuss feature", "design", "tasks", "implement", "validate", "verify work", "UAT", "record decision", "pause work", "resume work". Do NOT use for pure architecture decomposition analysis or standalone technical design documents.
tools
Autonomous senior-operator mode for AI agents that resolve tasks end to end without babysitting and never create new problems. The agent verifies every claim against real evidence (web search dated to the current month and year, the codebase, and available tools, MCPs, and CLIs); it never guesses, never fakes confidence, and never claims something is done without proof. It stays silent and keeps working, interrupting the user only on three stops, namely a destructive or irreversible action, a dead-end with no evidence after exhausting sources, or genuine ambiguity that changes the outcome. Output is short, literal, and human. Use when the user says "not-your-babysitter", "nanny mode", "work autonomously", "stop babysitting", or "no hand-holding", or wants an agent that solves problems on its own, especially hands-on engineering and operational tasks. Do not use when the user explicitly wants a tutorial, a verbose walkthrough, or open-ended brainstorming.
development
Use when a question, decision, plan, tradeoff, or claim needs a rigorous verdict and one perspective is not enough. Spawns a panel of 3 to 5 subagent jurors that form independent blind opinions, deliberate anonymously under an anti-anchoring and anti-sycophancy protocol, and return one committed verdict with confidence, preserved dissent, and a concrete next action. Domain-agnostic across engineering, architecture, data, product, hiring, strategy, vendor choice, build-vs-buy, and research design. Trigger phrases include "convene a jury", "have agents debate and decide", "get a panel to decide", "multi-agent decision", "stress-test this and decide", "monte um juri", "tribunal de agentes", "painel para decidir". Do NOT use to only critique without deciding (use the-fool for that), to build a plan or write the solution itself, or for simple factual lookups.
development
Guides design and implementation of evolutionary modular-monolith platforms with DDD (strategic + tactical), flat-by-aggregate organization, an Anti-Corruption Layer for vendor independence, a transactional outbox for events, smart resilience (backoff with jitter, circuit breakers, idempotency), and a polished architecture HTML document with elegant SVG diagrams. Use when designing a platform or backend, defining bounded contexts, organizing modules and folders, choosing monolith vs microservices, decoupling from an external service (ERP, storage, AI), making calls resilient, adding real-time push, picking a 2026 TypeScript stack (Nx, NestJS, React), or producing an architecture document or diagram. Also triggers on 'modular monolith', 'bounded contexts', 'flat-by-aggregate', 'ports and adapters', 'architecture diagram'. Do NOT use for simple CRUD, NestJS-only deep implementation (use nestjs-modular-monolith), or pure domain-model review (use tactical-ddd).