Home › Ruby on Rails › Ruby on Rails 8 CLAUDE.md

Ruby on Rails 8 CLAUDE.md

CLAUDE.md for Rails 8 apps: Solid Queue/Cache, built-in authentication, Hotwire, params.expect, and the test suite.

Claude Code (CLAUDE.md)Ruby on Rails

How to use

Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

CLAUDE.mdDownload  
# CLAUDE.md: Rails 8

## Commands
`bin/dev` · `bin/rails test` (or `bundle exec rspec`) · `bin/rails test:system` · `bin/rubocop` · `bin/brakeman` · `bin/rails db:migrate` (development only)

## Conventions
- Follow Rails defaults (the "Rails way"): RESTful resources, fat models / thin controllers, concerns for shared behavior. Use generators (`bin/rails g model`, `g controller`) for new files.
- Strong params with `params.expect(post: [:title, :body])` (Rails 8) in controllers.
- Authentication from the built-in generator (`bin/rails generate authentication`) if present: use `Current.user` and `allow_unauthenticated_access` explicitly for public actions.
- Authorization per record (scoped queries like `Current.user.posts.find(params[:id])` or the policy gem in use).
- Background jobs with Active Job on Solid Queue (`perform_later`); jobs take ids and are idempotent. Caching via Solid Cache; real-time via Turbo Streams over Solid Cable.
- Front end with Hotwire: Turbo Frames/Streams for partial updates, small Stimulus controllers for behavior. No SPA framework unless the app already has one. Assets via Propshaft + importmap (or the configured bundler).
- Avoid N+1 with `includes`; enable `strict_loading` where the project uses it.
- Migrations are reversible; add DB constraints and indexes alongside model validations.
- Credentials via `bin/rails credentials:edit`; never commit `master.key`.

## Before finishing
`bin/rubocop`, `bin/brakeman --no-pager`, and the full test suite pass. Deploys (Kamal: `bin/kamal deploy`) only when asked.

More: all Ruby on Rails rules · all Claude Code (CLAUDE.md) rules

Related rules

Ruby on Rails Copilot instructions

GitHub Copilot custom instructions for Rails 8 apps with Hotwire, RSpec and Rubocop.

GitHub CopilotRuby on Rails

Bun runtime CLAUDE.md

CLAUDE.md for TypeScript projects on Bun 1.2+: bun test, Bun.serve, built-in SQLite/Postgres, and bundling.

Claude Code (CLAUDE.md)Bun

Django CLAUDE.md

CLAUDE.md for Django 5 projects with DRF, pytest-django and PostgreSQL.

Claude Code (CLAUDE.md)Django

Django models & migrations .claude/rules file

A path-scoped Claude Code rules file for Django models, migrations, and ORM queries, loaded only for those files.

Claude Code (CLAUDE.md)Django

Elixir Phoenix CLAUDE.md

CLAUDE.md for Phoenix 1.8 + LiveView 1.x apps in Elixir: contexts, Ecto changesets, and ExUnit tests.

Claude Code (CLAUDE.md)Elixir / Phoenix

Go backend CLAUDE.md

CLAUDE.md for idiomatic Go HTTP services using the standard library, sqlc and table-driven tests.

Claude Code (CLAUDE.md)Go

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.