Skip to content
Back to skills

Rails Apps

ASecurity

Change Ruby on Rails apps: migrations, Active Record queries, strong params, background jobs and tests

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
developmentgorubysqlrailsdatabase

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill rails-apps --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rails Apps?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rails Apps
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-rails-apps/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-rails-apps)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rails-apps
description: "Change Ruby on Rails apps: migrations, Active Record queries, strong params, background jobs and tests"
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# Rails apps

Use in projects with a `Gemfile` that includes `rails`.

## Migrations
- Generate with `bin/rails g migration`, read the file, run `bin/rails db:migrate`, and commit `db/schema.rb` (or `structure.sql`) with it.
- On large tables, add indexes concurrently in PostgreSQL (`disable_ddl_transaction!` plus `algorithm: :concurrently`), and add columns before backfilling and constraining them.
- Never change a migration that has already run in shared environments.

## Active Record
- Avoid N+1: `includes`/`preload`, and check with the Bullet gem if the project uses it.
- Never interpolate input into SQL strings: use `where(name: value)` or `where("name = ?", value)`.
- Use `find_each` for batch processing, not `all.each`.
- Wrap multi-record writes in `transaction`. Prefer validations plus database constraints for invariants that matter.

## Controllers
- Strong parameters (`params.require(:user).permit(...)`) for every mass assignment.
- Scope records to the current user (`current_user.projects.find(params[:id])`) for authorization, or use Pundit/CanCanCan policies.
- Keep controllers thin; move logic into models or service objects.

## Jobs
Make Active Job/Sidekiq jobs idempotent and pass ids, not objects. Enqueue after the transaction commits (`after_commit`).

## Verify
`bin/rails test` or `bundle exec rspec`, `bundle exec rubocop` if configured, and `bin/rails db:migrate:status` after migration changes.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.