skills/rails-upgrade/SKILL.md
Use when upgrading a Rails application from one version to another, assessing upgrade readiness, planning a multi-hop upgrade path, or investigating breaking changes, deprecation warnings, gem compatibility issues, or config.load_defaults transitions between any Rails versions from 5.2 through the latest release.
npx skillsauth add lucianghinda/superpowers-ruby rails-upgradeInstall 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.
This skill provides a systematic workflow for upgrading Rails applications, covering versions 5.2 through the latest release. It fetches live configuration diffs from railsdiff.org via the GitHub API, performs direct codebase detection using Grep, Glob, and Read tools, and compiles structured upgrade reports — all without requiring external skill dependencies.
Announce at start: "I'm using the rails-upgrade skill to guide this upgrade."
| Rails | Minimum Ruby | Recommended Ruby | |-----------|-------------|-----------------| | 5.2 | 2.2.2 | 2.5+ | | 6.0–6.1 | 2.5.0 | 2.7+ | | 7.0–7.1 | 2.7.0 | 3.1+ | | 7.2 | 3.1.0 | 3.3+ | | 8.0+ | 3.2.0 | 3.3+ |
Gemfile and Gemfile.lock to find the current Rails gem versionconfig/application.rb to find the current config.load_defaults value.ruby-version or Gemfile for the Ruby version — verify against the compatibility table aboveHARD GATE: Run the test suite before ANY upgrade work.
If tests fail: STOP. Report failures. Do NOT proceed until baseline is green.
A failing baseline makes post-upgrade failures ambiguous.
spec/ (RSpec) or test/ (Minitest)bundle exec rspec or bundle exec rails testFetch the live config diff from railsdiff.org via its GitHub data source:
URL: https://api.github.com/repos/railsdiff/rails-new-output/compare/v{CURRENT}...v{TARGET}
Example: https://api.github.com/repos/railsdiff/rails-new-output/compare/v7.2.0...v8.0.0
Use WebFetch with this prompt: "List every file that changed between these versions. For each file: its name, status (added/modified/removed), and a 1-2 sentence summary of what changed."
Categorize results into:
config/, config/environments/, config/initializers/)Dockerfile, bin/, Gemfile template)Fallback if API fetch fails: Note it, proceed using references/detection-patterns.md and references/breaking-changes.md static data only.
For multi-step upgrades: Fetch the diff only for the current hop being executed.
references/detection-patterns.mdreferences/gem-compatibility.md — check Gemfile.lock for gems with known issuesskills/rails-guides/references/upgrading_ruby_on_rails.md for the relevant "Upgrading from X to Y" sectionHARD GATE: Verify config.load_defaults status before proceeding.
If new_framework_defaults_*.rb exists with uncommitted changes from a PREVIOUS upgrade: STOP.
Those must be resolved before starting a new upgrade.
config/application.rb — confirm the config.load_defaults valueconfig/initializers/new_framework_defaults_*.rbreferences/load-defaults-guide.md for the relevant version transitionCompile all findings into a structured report BEFORE making any changes:
## Rails Upgrade Report: {CURRENT} → {TARGET}
### Environment
- Current Rails: {version}
- Target Rails: {version}
- Ruby: {version} (compatible: yes/no)
- Test baseline: {N} tests, all passing
### Configuration Changes (from railsdiff.org)
{Categorized list from Step 2, or "Could not fetch — using static reference" if API failed}
### Code Changes Required
#### Must Fix Before Version Bump
{Findings from Step 3 with file:line references}
#### Must Fix After Version Bump (Deprecations Becoming Errors)
{Findings}
#### Deprecation Warnings to Address
{Findings}
### Gem Updates Required
| Gem | Current | Required | Notes |
|-----|---------|----------|-------|
{From Step 3 gem check}
### load_defaults Transition Plan
{From Step 4}
### Recommended Approach
- Direct upgrade (changes are minimal) OR
- Dual-boot with next_rails (changes are substantial — see references/dual-boot-guide.md)
### Estimated Effort
{Based on number and severity of findings}
HARD GATE: Present the upgrade report to the user and get explicit approval.
Do NOT modify any files until the user approves the report.
Execution sequence after approval:
git checkout -b rails-{TARGET}-upgradebundle update rails (fix conflicts as they arise)bin/rails app:update (review each change, do not auto-accept)config.load_defaults per the transition plan from Step 4When jumping more than one minor version (e.g., 6.1 → 8.0):
config.load_defaults is updated before moving onreferences/breaking-changes.mdUse dual-boot (next_rails gem) when:
Skip dual-boot when:
See references/dual-boot-guide.md for setup.
| File | Contents |
|------|----------|
| references/breaking-changes.md | Breaking changes by version pair (5.2+), HIGH/MEDIUM/LOW tables |
| references/deprecation-timeline.md | When deprecations were introduced, warned, and removed |
| references/gem-compatibility.md | ~50 popular gems with required versions per Rails release |
| references/load-defaults-guide.md | Every load_defaults setting 5.2+, risk tiers, transition guidance |
| references/detection-patterns.md | Grep/Glob patterns for code-level detection, organized by version pair |
| references/dual-boot-guide.md | next_rails dual-boot setup, NextRails.next? patterns, CI config |
| references/troubleshooting.md | Common upgrade errors and their solutions |
| scripts/fetch-changelogs.sh | Fetches component CHANGELOGs from GitHub for any version |
Also cross-references:
skills/rails-guides/references/upgrading_ruby_on_rails.md — Official Rails upgrading guide (3,000+ lines)Based on work by:
Both used under MIT license. Original sources:
development
Use when writing, reviewing, or debugging pure Ruby code — idiomatic patterns, modern 3.x+ features (pattern matching, Data.define, endless methods), error handling conventions (raise vs fail, result objects), memoization, and performance idioms. For Rails use rails-guides. For testing use minitest. For code style use sandi-metz-rules.
testing
Official Rails documentation. Use when asked about any Rails-specific topic including ActiveRecord, routing, controllers, views, mailers, jobs, Action Cable, Action Text, Active Storage, migrations, validations, callbacks, associations, caching, security, or internals.
tools
--- name: ruby-upgrade description: Use when upgrading the Ruby interpreter version of a Bundler/Rails app — especially "upgrade to Ruby 4", "bump Ruby to 4.0", "audit Ruby 4 compatibility", "what breaks on Ruby 4", or a specific target like "Ruby 4.0.5". Triggers on Ruby-major risk symptoms: CGI.parse/CGI::Cookie removal, Net::HTTP implicit Content-Type dropped, demoted default gems (ostruct/logger/benchmark/irb), SortedSet, Set#inspect changes, native-extension recompile crashes, openssl 4 pin
development
Use when stuck after multiple debug attempts and want to escalate to a stronger one-shot model (GPT-5 Pro, Opus, Gemini Pro) — packages a self-contained "oracle prompt" with Ruby/Rails project briefing, verbatim error, what-was-tried, constraints, and just-enough attached files. Triggers include "ask the oracle", "write a letter to GPT-5", "I'm stuck, draft a prompt for another model", "/tmp/letter.md".