Rails patterns for params.expect, Active Record queries and callbacks, migrations, Zeitwerk, and security. Load before any edit in a Rails app, however small, and for Rails questions.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rails Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ku5ic-rails-patterns)
---
name: rails-patterns
description: Rails patterns for params.expect, Active Record queries and callbacks, migrations, Zeitwerk, and security. Load before any edit in a Rails app, however small, and for Rails questions.
---
# Rails patterns
Default assumption: Rails 8.1, per the Rails release notes. The maintenance page lists 8.1, with security fixes until 2027-10-10, and 8.0, whose listed security support ran to 2026-11-07.
A row applies when the `rails` version in `Gemfile.lock` is at least the row's version. A new-app default applies when `config.load_defaults` is at least its version.
## Reference files
Loading this skill isn't enough. Before your next edit, read the file of every row that matches it. The rules live in those files, and this one only points at them.
| Before | Read |
| --------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| Writing Rails code, or raising the Rails version or `load_defaults` | [reference/upgrades.md](reference/upgrades.md) |
| Writing, changing, or reviewing Rails code, views, or config | [reference/anti-patterns.md](reference/anti-patterns.md) |
| Writing a query, a job, a class under `app/` or `lib/`, credentials, or security config | [reference/practices.md](reference/practices.md) |
| Configuring Brakeman, RuboCop, or `zeitwerk:check` | [reference/tooling.md](reference/tooling.md) |
| Writing or changing a file in `app/controllers/` | [reference/controllers.md](reference/controllers.md) |
| Writing or changing a file in `app/models/` | [reference/models.md](reference/models.md) |
| Writing a migration in `db/migrate/`, or changing the schema format | [reference/migrations.md](reference/migrations.md) |