# rails-upgrade

Adopt this skill: https://proskills.md/skills/other/ombulabs-claude-code-rails-upgrade-skill-rails-upgrade

Page: https://proskills.md/skills/other/ombulabs-claude-code-rails-upgrade-skill-rails-upgrade
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: rails-upgrade/SKILL.md
size: 11229
sha: f49e6aee2633331319e0d1481de0d9a016fc5419
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/SKILL.md

```text
---
name: rails-upgrade
description: Analyzes Rails applications and generates comprehensive upgrade reports with breaking changes, deprecations, and step-by-step migration guides for Rails 2.3 through 8.1. Use when upgrading Rails applications, planning multi-hop upgrades, querying version-specific changes, or answering what stands between the app and the next Rails version. Based on FastRuby.io methodology and "The Complete Guide to Upgrade Rails" ebook.
---

# Rails Upgrade Assistant Skill

## Skill Identity
- **Name:** Rails Upgrade Assistant
- **Purpose:** Intelligent Rails application upgrades from 2.3 through 8.1
- **Skill Type:** Modular with external workflows and examples
- **Upgrade Strategy:** Sequential only (no version skipping)
- **Methodology:** Based on FastRuby.io upgrade best practices and "The Complete Guide to Upgrade Rails" ebook
- **Attribution:** Content based on "The Complete Guide to Upgrade Rails" by FastRuby.io (OmbuLabs)

---

## Terminology

| Term | Meaning | Where |
|------|---------|-------|
| **Workflow** | One numbered unit of the upgrade flow, one file | `workflows/<NN>-<name>-workflow.md` |
| **Step** | A `Step N` header inside a workflow file | inside the workflow |
| **Reference** | Material loaded on demand: lookup tables, playbooks, conditional branches | `references/<name>-reference.md` |

No sub-steps: a "Step 4.1" is either two sequential steps or a conditional branch inside one step (`### A.` / `### B.` headers). Refer to a whole workflow as Workflow NN; refer to a step as file path plus step, e.g. `workflows/01-run-test-suite-workflow.md` Step 4. Not used in headings: Stage, Phase, Sub-step, dotted step numbers.

---

## Dependencies

- **dual-boot skill** ([github.com/ombulabs/claude-code_dual-boot-skill](https://github.com/ombulabs/claude-code_dual-boot-skill)) — Sets up and manages dual-boot environments using the `next_rails` gem. Covers setup, `NextRails.next?` code patterns, CI configuration, and post-upgrade cleanup. Must be installed for Workflow 04.
  - Workflow 04 file: `workflows/04-setup-next-rails-workflow.md`
- **rails-load-defaults skill** ([github.com/ombulabs/claude-code_rails-load-defaults-skill](https://github.com/ombulabs/claude-code_rails-load-defaults-skill)) — Handles incremental `load_defaults` updates with tiered risk assessment (Tier 1: low-risk, Tier 2: needs codebase grep, Tier 3: requires human review). Used as the final step after the Rails version upgrade is complete.

---

## Core Methodology (FastRuby.io Approach)

This skill follows the proven FastRuby.io upgrade methodology:

1. **Incremental Upgrades** - Always upgrade one minor/major version at a time
2. **Assessment First** - Understand scope before making changes
3. **Dual-Boot Testing** - Test both versions during transition using `next_rails` gem
4. **Test Coverage** - Ensure adequate test coverage before upgrading (aim for 80%+)
5. **Gem Compatibility** - Check gem compatibility at each step using RailsBump
6. **Deprecation Warnings** - Address deprecations before upgrading
7. **Backwards Compatible Changes** - Deploy small changes to production before version bump

**Key Resources:**
- **DELEGATE** to the `dual-boot` skill for dual-boot setup with `next_rails` (see Dependencies)
- See `references/deprecation-warnings-reference.md` for managing deprecations
- See `references/staying-current-reference.md` for maintaining upgrades over time

---

## CRITICAL: Dual-Boot Code Pattern with `NextRails.next?`

When proposing code fixes that must work with both the current and target Rails versions (dual-boot), **always use `NextRails.next?` from the `next_rails` gem** — never use `respond_to?` or other feature-detection patterns.

**DELEGATE** to the `dual-boot` skill for:
- Setup and initialization (`next_rails --init`, `Gemfile.next`)
- `NextRails.next?` code patterns and examples
- CI configuration for dual-boot testing
- Post-upgrade cleanup (removing dual-boot branches)

**DEPENDENCY:** Requires the [dual-boot skill](https://github.com/ombulabs/claude-code_dual-boot-skill)

---

## Available Resources

### Core Documentation
- `SKILL.md` - This file (entry point)

### Version-Specific Guides (Load as needed)

**Legacy Rails:**
- `version-guides/upgrade-3.2-to-4.0.md` - Rails 3.2 → 4.0 (Strong Parameters)
- `version-guides/upgrade-4.0-to-4.1.md` - Rails 4.0 → 4.1 (Spring, secrets.yml, enums)
- `version-guides/upgrade-4.1-to-4.2.md` - Rails 4.1 → 4.2 (ActiveJob, Web Console)
- `version-guides/upgrade-4.2-to-5.0.md` - Rails 4.2 → 5.0 (ApplicationRecord)

**Modern Rails:**
- `version-guides/upgrade-5.0-to-5.1.md` - Rails 5.0 → 5.1 (Encrypted secrets)
- `version-guides/upgrade-5.1-to-5.2.md` - Rails 5.1 → 5.2 (Active Storage, Credentials)
- `version-guides/upgrade-5.2-to-6.0.md` - Rails 5.2 → 6.0 (Zeitwerk)
- `version-guides/upgrade-6.0-to-6.1.md` - Rails 6.0 → 6.1 (Horizontal sharding)
- `version-guides/upgrade-6.1-to-7.0.md` - Rails 6.1 → 7.0 (Hotwire/Turbo)
- `version-guides/upgrade-7.0-to-7.1.md` - Rails 7.0 → 7.1 (Composite keys)
- `version-guides/upgrade-7.1-to-7.2.md` - Rails 7.1 → 7.2 (Transaction jobs)
- `version-guides/upgrade-7.2-to-8.0.md` - Rails 7.2 → 8.0 (Propshaft)
- `version-guides/upgrade-8.0-to-8.1.md` - Rails 8.0 → 8.1 (bundler-audit)

### Examples (Load when user needs clarification)
- `examples/simple-upgrade.md` - Single-hop upgrade example
- `examples/multi-hop-upgrade.md` - Multi-hop upgrade example

### External Dependencies
- **dual-boot skill** - Dual-boot setup and management with next_rails (Workflow 04) (https://github.com/ombulabs/claude-code_dual-boot-skill)
- **rails-load-defaults skill** - Incremental load_defaults alignment (Workflow 12) (https://github.com/ombulabs/claude-code_rails-load-defaults-skill)
- **`upgrade-cleanup` companion plugin** - User-triggered. Removes dual-boot scaffolding and drops `NextRails.next?` / `NextRails.current?` branches. Deprecation triage stays with this skill for the next hop.

### Reference Materials
- `references/sequential-strategy-reference.md` - Sequential upgrade rule (no version skipping) and the supported upgrade paths tables. Load in Workflow 03.
- `references/request-patterns-reference.md` - Which workflows run for each request shape (full upgrade, multi-hop, analysis only, reports only). Read at the start of a session.
- `references/next-hop-readiness-reference.md` - Read-only answer to "what do I need for the next Rails version?". Load for the Next-Hop Readiness request shape.
- `references/no-test-suite-smoke-reference.md` - **Load from Workflow 01 when no runnable RSpec/Minitest suite exists** - Rails boot, routes, migration-status, and build smoke baseline with partial-confidence reporting
- `references/deprecation-warnings-reference.md` - Finding and fixing deprecations
- `references/staying-current-reference.md` - Keeping up with Rails releases
- `references/breaking-changes-by-version-reference.md` - Quick lookup
- `references/multi-hop-strategy-reference.md` - Multi-version planning
- `references/testing-checklist-reference.md` - Comprehensive testing
- `references/gem-compatibility-reference.md` - Gem update order and the "no compatible version" playbook (fork / vendor / replace). Load only when Workflow 06's compatibility check produced blockers.
- `references/js-compressor-sprockets-mismatch-reference.md` - Keeping terser working when the target Rails pins Sprockets to the 2.x line. Load only when JS_COMPRESSOR_GEM_MISMATCH fires.

### Detection Pattern Resources
- `detection-scripts/patterns/rails-*.yml` - Version-specific patterns for direct detection
- `detection-scripts/scan_patterns.rb` - Runs every pattern for a hop against the app and prints a findings table. Run it in Workflow 05 instead of one Grep per pattern.
- `detection-scripts/gem_limits.rb` - Lists the locked gems whose gemspec excludes the target Rails, from the lockfile alone. First pass of Workflow 06.

### Report Templates
- `templates/upgrade-report-template.md` - Main upgrade report structure
- `templates/app-update-preview-template.md` - Configuration preview

---

## Workflow index

When user requests an upgrade, follow this workflow. Sequential Process is Critical: run in order, read each file when you reach it. Gates block.

| #  | Name | Purpose | File |
|----|------|---------|------|
| 00 | Verify latest patch | MANDATORY PRE-STEP. App on the latest patch of its current series before any minor/major hop | `workflows/00-verify-latest-patch-workflow.md` |
| 01 | Run test suite | MANDATORY FIRST STEP. How to run and verify test suite; blocks on any failure | `workflows/01-run-test-suite-workflow.md` |
| 02 | Resolve deprecation warnings | Make warnings visible, collect what the current version emits, fix them on the current version | `workflows/02-resolve-deprecation-warnings-workflow.md` |
| 03 | Validate upgrade path | Single-hop or multi-hop, individual hops planned | `workflows/03-validate-upgrade-path-workflow.md` |
| 04 | Set up next_rails | EARLY SETUP. Delegated to the skill listed under External Dependencies | `workflows/04-setup-next-rails-workflow.md` |
| 05 | Detect breaking changes | How to run breaking change detection directly | `workflows/05-detect-breaking-changes-workflow.md` |
| 06 | Check gem compatibility | Per-lockfile gem compatibility check against the target Rails version | `workflows/06-check-gem-compatibility-workflow.md` |
| 07 | Boot smoke test | Boot under `Gemfile.next` and run the models suite there, to catch what the resolver and the grep can't see | `workflows/07-boot-smoke-test-workflow.md` |
| 08 | Generate upgrade report | How to generate upgrade reports | `workflows/08-generate-upgrade-report-workflow.md` |
| 09 | Generate app:update preview | How to generate app:update previews | `workflows/09-generate-app-update-preview-workflow.md` |
| 10 | Implement and upgrade | Present reports, apply fix-before-bump changes, bump the Gemfile, run tests against both versions | `workflows/10-implement-and-upgrade-workflow.md` |
| 11 | Sync CI config | MANDATORY before opening the upgrade PR. How to verify CI config matches the upgraded Gemfile | `workflows/11-sync-ci-workflow.md` |
| 12 | Align load_defaults | AFTER THE UPGRADE IS COMPLETE. Delegates to the rails-load-defaults skill | `workflows/12-align-load-defaults-workflow.md` |
| 13 | Mention cleanup | USER-TRIGGERED. Delegates to the `upgrade-cleanup` plugin only when the user explicitly asks | `workflows/13-mention-cleanup-workflow.md` |

The Purpose column is a summary. Gates live only in each workflow's `## Gates` section. Which workflows run depends on the request shape (full upgrade, multi-hop, analysis only, reports only): `references/request-patterns-reference.md`.

---

## Key Principles

1. **Run Detection Directly** (run `detection-scripts/scan_patterns.rb`, then Read the affected files; never generate a detection script for the user to run)
2. **Load Workflows as Needed** (don't hold everything in memory)
3. **Follow FastRuby.io Methodology** (incremental upgrades, assessment first)

Everything else that used to be listed here lives in the workflow it governs: see each workflow's Purpose and Gates.
```

## File: rails-upgrade/references/breaking-changes-by-version-reference.md
size: 3968
sha: afb9eeea9a0f7c7e967c9320a9bca1b1bcef3986
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/breaking-changes-by-version-reference.md

```text
# Breaking Changes by Version - Quick Reference

**Complete comparison table for Rails 5.0 → 8.1**

---

## Summary Statistics

| Version | Total Changes | HIGH | MEDIUM | LOW | Difficulty | Ruby Requirement |
|---------|--------------|------|--------|-----|------------|------------------|
| **5.0 → 5.1** | 8 | 2 | 4 | 2 | ⭐ Easy | 2.2.2+ |
| **5.1 → 5.2** | 10 | 3 | 5 | 2 | ⭐⭐ Medium | 2.2.2+ |
| **5.2 → 6.0** | 15 | 5 | 6 | 4 | ⭐⭐⭐ Hard | 2.5.0+ |
| **6.0 → 6.1** | 12 | 3 | 6 | 3 | ⭐⭐ Medium | 2.5.0+ |
| **6.1 → 7.0** | 18 | 5 | 8 | 5 | ⭐⭐⭐ Hard | 2.7.0+ |
| **7.0 → 7.1** | 12 | 5 | 4 | 3 | ⭐⭐ Medium | 2.7.0+ |
| **7.1 → 7.2** | 15 | 5 | 7 | 3 | ⭐⭐ Medium | 3.1.0+ |
| **7.2 → 8.0** | 13 | 5 | 5 | 3 | ⭐⭐⭐⭐ Very Hard | 3.2.0+ |
| **8.0 → 8.1** | 8 | 3 | 3 | 2 | ⭐ Easy | 3.2.0+ |

---

## Rails 5.2 → 6.0 (HIGH Impact)

| Change | Impact | Fix |
|--------|--------|-----|
| Zeitwerk autoloader | ALL apps | Remove require_dependency, fix naming |
| Ruby 2.5+ required | ALL apps | Upgrade Ruby first |
| belongs_to required | Models | Add optional: true where needed |
| update_attributes deprecated (removed in 6.1) | ALL apps | Change to update |
| protect_from_forgery default | Controllers | Review CSRF settings |

---

## Rails 6.1 → 7.0 (HIGH Impact)

| Change | Impact | Fix |
|--------|--------|-----|
| Ruby 2.7+ required | ALL apps | Upgrade Ruby first |
| Webpacker → Import Maps | Frontend | Migrate JS bundling strategy |
| Turbolinks → Turbo | Frontend | Update event listeners |
| rails-ujs removed | Forms | Use Turbo for remote forms |
| secrets → credentials | Config | Migrate secrets to credentials |

---

## Rails 7.1 → 7.2 (HIGH Impact)

| Change | Impact | Fix |
|--------|--------|-----|
| Transaction-aware jobs | Models with jobs | Test job timing in transactions |
| show_exceptions symbols | ALL envs | true → :all, false → :none |
| params comparison | Controllers | Use params.to_h == hash |
| AR.connection deprecated | Database code | Use with_connection block |
| secrets removed | ALL apps | Migrate to credentials |

---

## Rails 7.2 → 8.0 (HIGH Impact)

| Change | Impact | Fix |
|--------|--------|-----|
| Sprockets → Propshaft | ALL apps | Migrate asset pipeline |
| Solid gems defaults | Optional | Keep Redis or migrate |
| assume_ssl setting | Production | Add to production.rb |
| Multi-database config | Database | Restructure database.yml |
| Docker/Kamal | Deployment | Review deployment config |

---

## Rails 8.0 → 8.1 (HIGH Impact)

| Change | Impact | Fix |
|--------|--------|-----|
| SSL commented out | Production | Uncomment if not using Kamal |
| pool → max_connections | Database | Update database.yml |
| bundler-audit required | Security | Add gem and script |

---

## Most Impactful Changes (All Versions)

1. **Zeitwerk autoloader** (6.0) - Fundamental change to code loading
2. **Propshaft asset pipeline** (8.0) - Complete asset system replacement
3. **Webpacker → Import Maps** (7.0) - JavaScript bundling overhaul
4. **Transaction-aware jobs** (7.2) - Behavior change in job timing
5. **Ruby version jumps** - Required at 6.0, 7.0, 7.2

---

## Pre-Upgrade Checklist

Before ANY upgrade:

- [ ] Ruby version meets minimum requirement
- [ ] Test coverage is adequate (aim for 70%+)
- [ ] All current tests pass
- [ ] Database is backed up
- [ ] Git branch created for upgrade
- [ ] Bundle outdated reviewed
- [ ] Deprecation warnings addressed

---

## Quick Decision Matrix

| Scenario | Recommendation |
|----------|----------------|
| 5.2 app, active development | Upgrade through all versions to 8.x |
| 6.0 app, moderate changes | Upgrade to 7.x minimum |
| 7.0 app, light maintenance | Upgrade to 7.2 |
| 7.2 app, ready for change | Upgrade to 8.0/8.1 |
| Any app, no test coverage | Add tests before upgrading |

---

**For detailed information, see version-specific guides in `version-guides/`**
```

## File: rails-upgrade/references/deprecation-warnings-reference.md
size: 11000
sha: 0a3a5512e1e667f6093321664107a59be2635371
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/deprecation-warnings-reference.md

````text
# Deprecation Warnings Guide

**Based on "The Complete Guide to Upgrade Rails" by FastRuby.io (OmbuLabs)**

---

## Overview

Deprecation warnings notify you that a specific feature (method, class, or API) will be removed in a future version and should be replaced. Features are deprecated rather than immediately removed to:

- Provide backward compatibility
- Give developers time to update their code
- Allow gradual migration to new patterns

---

## Finding Deprecation Warnings

### Check Existing Deprecation Behavior First

Before reading test logs, sweep for places that already override deprecation behavior. Otherwise "no deprecation warnings in the log" can mean "they're being silenced", and "every test fails" can mean "they've been raising the whole time, unrelated to the upgrade." `config/application.rb` and `config/environments/*.rb` are not the only places this is configured: apps also use the `config.active_support.deprecation =` env DSL, Rails 7.1+ apps use the `deprecators` registry, RSpec autoloads `-r` requires from `.rspec`, and test helpers can install hooks like `RSpec.configure { |c| c.raise_errors_for_deprecations! }`. Minitest apps wire the same behavior from `test/test_helper.rb` and `test/support/`.

```bash
grep -rnE "raise_errors_for_deprecations|(ActiveSupport::Deprecation|Rails\.application\.deprecators|[A-Z]\w*\.deprecator)\.(behavior|disallowed_behavior|silenced)\s*=|(ActiveSupport::Deprecation|Rails\.application\.deprecators|[A-Z]\w*\.deprecator)\.silence\b|config\.active_support\.(deprecation|disallowed_deprecation|disallowed_deprecation_warnings|report_deprecations)\s*=" \
  .rspec spec/.rspec spec/spec_helper.rb spec/rails_helper.rb Rakefile \
  config/ spec/support/ lib/tasks/ \
  test/test_helper.rb test/support/ test/minitest/ 2>/dev/null
```

The trailing `silence\b` alternation catches the block form `ActiveSupport::Deprecation.silence do ... end` (or `{ ... }`), which is the recommended way to scope a silence to a single noisy call site. The `\b` word boundary keeps it from matching `silenced` (which is already covered by the assignment branch).

Which forms appear depends on the app's Rails version:

- `config.active_support.deprecation=` / `ActiveSupport::Deprecation.behavior=` — Rails 3+ (classic global config)
- `.rspec` `-r raise_errors_for_deprecations` / `raise_errors_for_deprecations!` — RSpec hook, any version
- `Rails.application.deprecators` / `<Framework>.deprecator` (e.g. `ActiveRecord.deprecator`) — Rails 7.1+ (deprecators registry)

Running this against a Rails 5–7.0 app and seeing no `deprecators` hits is expected, not a gap.

A common gotcha is a single line in `.rspec`:

```
# .rspec
-r raise_errors_for_deprecations
```

That installs an RSpec hook that raises on every `ActiveSupport::Deprecation.warn`. Easy to miss because nothing about it lives under `config/`.

### In Test Suite Logs

If you have good test coverage, run your test suite and check the logs:

```bash
# Run tests and capture output
bundle exec rspec 2>&1 | tee test_output.log

# Search for deprecation warnings
grep "DEPRECATION WARNING" test_output.log
```

All Rails deprecation warnings start with `DEPRECATION WARNING:`.

### In CI Services

Most CI services (CircleCI, GitHub Actions, Travis CI) display full test output. After the build finishes, search the logs for `DEPRECATION WARNING`.

### In Test Log File

```bash
# After running tests
grep "DEPRECATION WARNING" log/test.log
```

### In Production

The best way to discover production deprecation warnings is through a monitoring tool like [Honeybadger](https://www.honeybadger.io/), [Sentry](https://sentry.io/), or [Airbrake](https://airbrake.io/).

**Configure Rails to notify on deprecations:**

```ruby
# config/environments/production.rb
config.active_support.deprecation = :notify
```

**Subscribe to deprecation events:**

```ruby
# config/initializers/deprecation_warnings.rb

ActiveSupport::Notifications.subscribe('deprecation.rails') do |name, start, finish, id, payload|
  # Honeybadger
  Honeybadger.notify(
    error_class: "DeprecationWarning",
    error_message: payload[:message],
    backtrace: payload[:callstack]
  )

  # Or Sentry
  # Sentry.capture_message(
  #   payload[:message],
  #   level: :warning,
  #   backtrace: payload[:callstack]
  # )

  # Or Airbrake
  # Airbrake.notify(
  #   error_class: "DeprecationWarning",
  #   error_message: payload[:message],
  #   backtrace: payload[:callstack]
  # )
end
```

See the [ActiveSupport Instrumentation Guide](https://guides.rubyonrails.org/active_support_instrumentation.html#subscribing-to-an-event) for more details.

### Alternative: Log to Production Log

```ruby
# config/environments/production.rb
config.active_support.deprecation = :log
```

Then check `log/production.log`, but this can be noisy on high-traffic applications.

---

## Tracking Deprecation Warnings

Once you've collected deprecation warnings, track them systematically:

### 1. Create Issues for Each Root Cause

Use your project management tool (Jira, Linear, GitHub Issues) to create a story for each unique deprecation warning. This helps with:

- Code review organization
- Progress tracking
- Team visibility

### 2. Prioritize by Frequency

Address the most common deprecation warnings first. They often fix the largest number of occurrences with a single change.

### 3. Group Related Warnings

Some warnings share a root cause. For example, `update_attributes` being deprecated affects multiple files but has one fix pattern.

---

## Fixing Deprecation Warnings

### Process

1. **Pick a warning** from the top of your backlog
2. **Understand the fix** - Most warnings clearly state what to replace
3. **Search for all occurrences** in the project
4. **Apply the fix** consistently
5. **Run tests** for affected code
6. **Create a pull request**
7. **Move to the next warning**

### Example Fix

**Warning:**
```
DEPRECATION WARNING: update_attributes is deprecated and will be removed
from Rails 6.1 (please, use update instead)
```

**Search and Replace:**
```bash
# Find all occurrences
grep -r "update_attributes" app/ lib/ --include="*.rb"

# In your editor, replace:
# object.update_attributes(params)
# with:
# object.update(params)
```

### Warnings from Gems

Sometimes deprecation warnings come from gems, not your code. In this case:

1. Check if a newer version of the gem fixes the issue
2. Run `bundle outdated` to see available updates
3. Update the gem: `bundle update gem_name`
4. If no fix exists, consider contributing a patch or finding an alternative

---

## Preventing Future Deprecation Debt

### Treat Warnings as Errors

Configure test and development environments to raise on deprecation:

```ruby
# config/environments/test.rb
config.active_support.deprecation = :raise

# config/environments/development.rb
config.active_support.deprecation = :raise
```

This immediately surfaces deprecations during development and in CI.

### Use Rubocop for Regression Prevention

Write custom Rubocop cops to prevent deprecated patterns. See [Lint/DeprecatedClassMethods](https://github.com/rubocop-hq/rubocop/blob/master/lib/rubocop/cop/lint/deprecated_class_methods.rb) for examples.

Example custom cop:

```ruby
# lib/rubocop/cop/custom/no_update_attributes.rb

module RuboCop
  module Cop
    module Custom
      class NoUpdateAttributes < Base
        MSG = 'Use `update` instead of `update_attributes`.'

        def_node_matcher :update_attributes?, <<~PATTERN
          (send _ {:update_attributes :update_attributes!} ...)
        PATTERN

        def on_send(node)
          return unless update_attributes?(node)
          add_offense(node)
        end
      end
    end
  end
end
```

---

## Rails 6.1+ Disallowed Deprecations

Rails 6.1 introduced a feature to disallow specific deprecations. Once you fix a deprecation, you can prevent it from reappearing:

```ruby
# config/environments/test.rb

# Treat disallowed deprecations as failures
ActiveSupport::Deprecation.disallowed_behavior = [:raise]

# List of disallowed deprecation patterns
ActiveSupport::Deprecation.disallowed_warnings = [
  # String match
  "update_attributes",

  # Symbol match
  :update_attributes,

  # Regex match
  /(update_attributes)!?/,

  # Multiple patterns
  "before_filter",
  "after_filter",
]
```

### How It Works

- **Allowed deprecations**: Logged normally (warning level)
- **Disallowed deprecations**: Raise an exception in development/test, logged as error in production

### Recommended Workflow

1. Fix a deprecation warning
2. Add it to `disallowed_warnings`
3. Any reintroduction will fail tests

---

## Deprecation Configuration Options

| Setting | Behavior |
|---------|----------|
| `:raise` | Raise an exception (stops execution) |
| `:log` | Log to Rails logger |
| `:notify` | Send to `ActiveSupport::Notifications` |
| `:silence` | Ignore (not recommended) |
| `:stderr` | Print to stderr |
| `:report` | Report via error reporter (Rails 7.1+) |

**Recommended settings:**

```ruby
# config/environments/development.rb
config.active_support.deprecation = :raise

# config/environments/test.rb
config.active_support.deprecation = :raise

# config/environments/production.rb
config.active_support.deprecation = :notify
```

---

## Common Deprecation Patterns by Rails Version

### Rails 5.0 → 5.1
- `render :text` → `render :plain`
- `redirect_to :back` → `redirect_back`

### Rails 5.1 → 5.2
- `secrets.yml` → `credentials.yml.enc`
- `config.active_record.belongs_to_required_by_default`

### Rails 5.2 → 6.0
- `update_attributes` → `update`
- Classic autoloader → Zeitwerk

### Rails 6.0 → 6.1
- `Rails.application.secrets` → `Rails.application.credentials`

### Rails 6.1 → 7.0
- `to_s(:format)` → `to_fs(:format)`
- Turbolinks → Turbo

### Rails 7.0 → 7.1
- `before_action` callback order changes
- `config.cache_classes` → `config.enable_reloading`

### Rails 7.1 → 7.2
- `show_exceptions` boolean → symbol
- `params == hash` → `params.to_h == hash`

---

## Quick Reference

### Find Deprecations
```bash
# In test logs
grep "DEPRECATION WARNING" log/test.log

# In CI output
# Search the build log for "DEPRECATION WARNING"

# Run tests with verbose output
RAILS_ENV=test bundle exec rspec 2>&1 | grep "DEPRECATION"
```

### Configure Strict Mode
```ruby
# config/environments/test.rb
config.active_support.deprecation = :raise
```

### Track in Production
```ruby
# config/environments/production.rb
config.active_support.deprecation = :notify

# config/initializers/deprecation_warnings.rb
ActiveSupport::Notifications.subscribe('deprecation.rails') do |*, payload|
  YourErrorTracker.notify(payload[:message])
end
```

---

## Resources

- [Rails Deprecation Behavior](https://guides.rubyonrails.org/configuring.html#config-active-support-deprecation)
- [ActiveSupport Instrumentation](https://guides.rubyonrails.org/active_support_instrumentation.html)
- [Rubocop](https://github.com/rubocop-hq/rubocop)
````

## File: rails-upgrade/references/gem-compatibility-reference.md
size: 8389
sha: 26eb38282c7fe08e292665635f4f7d5c019c66d9
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/gem-compatibility-reference.md

````text
# Gem Compatibility Reference

**When to read this:** Workflow 06's compatibility check returned at least one blocker (a gem with no released version that supports the target Rails). This file is the playbook for resolving those.

For the compatibility check itself, see Workflow 06 (primary: `next_rails` `bundle_report compatibility`; secondary: `workflows/06-check-gem-compatibility-workflow.md`). Don't load this file unless you're already past the check and have blockers to work through.

This file used to carry static `gem × Rails-version` lookup tables. They drifted out of date and ignored the user's actual lockfile, so they were removed in favor of the live checks.

---

## Update order

When applying the bumps the compatibility check produced:

1. **Ruby** — meet the target Rails version's minimum.
2. **Rails** — update to the target version.
3. **Auth / authorization gems** — `devise`, `pundit`, `cancancan`, `doorkeeper`. Boot-blocking when wrong.
4. **Testing gems** — `rspec-rails`, `factory_bot_rails`, `capybara`, `shoulda-matchers`. Required to validate the upgrade.
5. **Everything else** — incrementally, one gem at a time (`bundle update <gem> --conservative`).

The compatibility check tells you the minimum target for each gem. Use it to decide which gems can stay on their current version and which need an explicit bump.

---

## Playbook: gem has no compatible version

When `bundle_report` lists a gem under "with no new compatible versions" or "with no new versions", or railsbump returns `incompatible` with no `earliest_compatible_version`, you have a blocker. Options, in order of preference:

1. **Look for a maintained fork** that adds Rails support — search GitHub for "fork of <gem>" with the target Rails in recent commits.
2. **Check the gem's open PRs / issues** for in-flight Rails support. If a PR is close to merging, ask the user whether to vendor the branch as a temporary `git:` source.
3. **Wait for an upstream release** if the gem is actively maintained and the next release is imminent.
4. **Switch to an alternative** when the gem is abandoned, OR when a Rails-removed API has a back-compat gem and you'd rather use it than refactor. Examples:
   - `paperclip` → `shrine` / Active Storage (paperclip is abandoned).
   - When moving Rails 3 → 4, `attr_accessible` was removed from core. Two paths: refactor controllers to strong parameters, OR add `protected_attributes` to keep `attr_accessible` working. The shim is a valid choice when the controller surface is large and the upgrade timeline is tight; refactoring later is still possible.
5. **Fork and patch** as a last resort. Document the fork in the Gemfile and open an upstream PR.

Surface the choice to the user — do not silently swap gems. Each option has a different long-term cost.

A common false-blocker pattern: gems that became unnecessary in a specific Rails release. They show up under "with no new versions" in `bundle_report`, but the fix is to remove them, not to find a compatible version.

- **Merged into Rails core**: `strong_parameters` was extracted from Rails 3.x as a backport, and is built into Rails ≥ 4.0 (`ActionController::Parameters`). Just remove the gem when targeting Rails 4 or newer.
- **Replaced by core / a successor gem**: `turbo-sprockets-rails3` is replaced by `sprockets-rails` in Rails 4. `paperclip` is unmaintained and replaced by Active Storage / Shrine.
- **Extracted as a back-compat shim**: `protected_attributes` is the *opposite* shape — it was extracted from Rails 4.0 specifically as a transitional shim for the old mass-assignment API and was never re-merged. It still exists as a separate gem, but if your code is moving to `strong_parameters` you can remove it once the controllers are converted.

If `bundle_report` flags one of these, check the target version guide before assuming you need a fork.

---

## Known Gotchas

Real issues hit during actual upgrades, not generic advice. Add to this list as new ones surface.

### `concurrent-ruby` >= 1.3.5 breaks Rails' logger require order on Ruby < 3.5

**Symptom:** `NameError: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger`, raised from `active_support/logger_thread_safe_level.rb` on boot. `bundle install` / `bundle_report` show nothing wrong — this is a pure require-order bug, not a version constraint conflict.

**Cause:** `activesupport/lib/active_support/logger.rb` requires `active_support/logger_thread_safe_level` *before* it requires the stdlib `logger` gem. Versions of `logger_thread_safe_level.rb` prior to the fix reference the bare `Logger` constant without requiring it themselves, relying on something else in the load path having already pulled in `logger` — which `concurrent-ruby` < 1.3.5 happened to do as a side effect, and 1.3.5+ no longer does.

**Confirmed via source diff:** `activesupport/lib/active_support/logger_thread_safe_level.rb` at tags `v6.1.7.10` and `v7.0.8.7` has no `require "logger"` at the top (only `require "concurrent"` and `require "fiber"`) — vulnerable. The same file at `v7.0.10` and `v7.1.6` adds an explicit `require "logger"` — fixed. **The fix is per-Rails-patch-release, not per-Rails-minor** — check the specific patch you're on, not just the major.minor. A 7.0.x app can be on either side of the line. All four tags checked directly against GitHub source.

**Fix:** Pin `gem "concurrent-ruby", "< 1.3.5"` in the Gemfile. Safe to apply unconditionally across a dual-boot Gemfile (both sides) even if only the older side actually needs it — confirmed empirically that Rails 7.0.10 boots fine with either the pin or `concurrent-ruby` 1.3.7.

**How to verify whether your target Rails patch needs the pin:** `curl -s https://raw.githubusercontent.com/rails/rails/v<VERSION>/activesupport/lib/active_support/logger_thread_safe_level.rb | head -10` and check for `require "logger"` near the top.

### Accidentally narrow legacy Gemfile pins

Distinct from "gem has no compatible version" above: these are gems where a *compatible* version genuinely exists, but the app's own Gemfile pins below it — usually a leftover constraint from years earlier that nobody has revisited. `bundle_report` may not flag these clearly since the gem itself isn't the blocker; the app's own version constraint is. Bundler's resolver error will look like a normal dependency conflict, e.g.:

```
font-awesome-rails was resolved to 4.7.0.7, which depends on
  railties (>= 3.2, < 7)
```

Check the Gemfile for pins that predate the target Rails version's release by years — `~> 1.8.2` on a gem now at `1.15.x`, an unpinned gem still resolving to a several-years-old version because nothing forced a re-resolve. Bump the floor (`bundle lock --update <gem>`) rather than assuming it's a real blocker requiring a fork/replace.

Real example (6.1 -> 7.0): `nokogiri "~> 1.8.2"` (pinned circa 2018) blocked resolution once `loofah`/`rails-html-sanitizer` needed a newer `nokogiri` for Rails 7.0. `font-awesome-rails` (unpinned, but locked at `4.7.0.7` since nothing had bumped it) capped `railties < 7`; `4.7.0.9` relaxed that to `< 9.0`. Neither gem was actually incompatible with Rails 7.0 — the lockfile just hadn't moved in years.

### Dev-only gems with an independent Ruby floor

When a gem's Rails-N-compatible release also raises its own Ruby floor higher than the Ruby version this specific hop targets, and the gem is dev/test-only (doesn't affect production boot or the test suite itself), the pragmatic move is usually to drop it for this hop rather than force an unplanned Ruby bump — Ruby upgrades are their own separate, independently-sequenced piece of work.

Real example (6.1 -> 7.0, staying on Ruby 2.7.2): `spring` 2.x (Rails-6-era) works fine on Ruby 2.7, but `spring-watcher-listen` 2.1.0 requires `spring >= 4`, and `spring` 4.x requires Ruby >= 3.1. Since `spring` is dev-only tooling (faster local boot times, not loaded in CI or by the deployed app), the resolution was to drop `spring` / `spring-watcher-listen` from the Gemfile's `next?` (target-Rails) branch entirely, with a comment noting they come back once Ruby is separately upgraded past 3.1. Confirm a gem is safe to drop this way by checking it's declared only inside `group :development` (or `:development, :test`) and isn't required by any file the test suite or production boot path loads.
````

## File: rails-upgrade/references/js-compressor-sprockets-mismatch-reference.md
size: 4771
sha: b5e39902752498248222e43366763b1bcc431722
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/js-compressor-sprockets-mismatch-reference.md

````text
# JS Compressor vs Sprockets During a Dual-Boot Upgrade

**When to read this:** the `JS_COMPRESSOR_GEM_MISMATCH` detection pattern fired, i.e. the
Gemfile has `gem "terser"` and you are dual-booting across a Rails
version that locks Sprockets to the 2.x line (Rails 4.0 via `sprockets-rails`).

If the app uses plain `uglifier`, you do not need this file. The standard
`config.assets.js_compressor = :uglifier` fix is enough.

---

## The problem in one paragraph

terser's `Terser::Compressor` (`lib/terser/compressor.rb`) does `require "sprockets/digest_utils"`, and
its railtie references that class at boot. `sprockets/digest_utils` exists only in **Sprockets >= 3**. Rails 4.0 pins Sprockets to **2.x**.
The next bundle *resolves* fine (so `railsbump` / `next_rails` report nothing), but at **boot**
Bundler auto-requires the gem, the railtie runs, and you get:

```
LoadError: cannot load such file -- sprockets/digest_utils
```

The failure is require-time, not resolve-time, which is why dependency checkers miss it.

## Why not just use uglifier on the next side?

Because apps add terser on purpose. Uglifier's last release (4.2.0, Sep 2019) is abandoned and
cannot compile modern JS:

- ES2020 optional chaining `?.` and nullish coalescing `??` — not parsed at all, even with
  `harmony: true`.
- UTF-8 source files — uglifier defaults to US-ASCII and errors on smart quotes, em-dashes, etc.

Swapping terser for uglifier on the next side would drop exactly the assets that motivated
terser. The goal is to keep terser working on **both** sides.

---

## The recipe

### Gemfile

```ruby
group :assets do
  if next?
    gem "uglifier", ">= 1.3.0"   # ONLY so the :uglifier symbol resolves in env configs
    gem "terser", require: false  # the real compressor; require: false is MANDATORY (see below)
  else
    gem "terser"                  # current side: railtie is harmless on Sprockets 2.x there
  end
end
```

**Why `require: false` on the next side is mandatory.** Without it, Bundler auto-requires
terser at boot, the railtie runs `config.assets.configure { ... }`, that block references
`Terser::Compressor`, which autoloads and `require "sprockets/digest_utils"` — and boot dies.
With `require: false`, the railtie never runs; you load terser yourself at compile time.

**Why uglifier is still present on the next side.** Env configs set
`config.assets.js_compressor = :uglifier` (see below). Sprockets 2.x resolves `:uglifier` to its
built-in `UglifierCompressor`. The gem must be installed for the symbol to resolve, even though
its JS engine never actually runs in production — the rake task replaces it with Terser first.

### Environment configs (production / staging / etc.)

```ruby
config.assets.js_compressor = :uglifier
```

Unconditional is fine: `:uglifier` resolves on both Sprockets 2.x (next) and the current side.

### Rake task: swap in Terser at compile time

Hook on `assets:environment` (runs before compilation) and replace the registered `:uglifier`
processor with Terser:

```ruby
# lib/tasks/assets.rake
Rake::Task["assets:environment"].enhance do
  require "terser"
  env = Rails.application.assets
  env = env.instance_variable_get(:@environment) if env.is_a?(Sprockets::Index)

  terser = Terser.new(output: { ecma: 2015 })
  env.js_compressor = nil  # unregisters the :uglifier bundle processor set in env configs
  env.register_bundle_processor("application/javascript", :js_compressor) do |context, data|
    if context.pathname.to_s.include?("/webpack/") || context.pathname.basename.to_s.include?(".min.")
      data            # already minified — skip
    else
      terser.compile(data)
    end
  end
  Rails.application.assets = env.index if Rails.application.assets.is_a?(Sprockets::Index)
end
```

On a current Rails 3.2 side the equivalent uses `Sprockets::LazyCompressor` (defined in
ActionPack 3.2, not the Sprockets gem) wrapping a `Terser.new`, gated on `config.assets.compress`
so it only runs in production-like environments.

---

## Cleanup on the next hop (when Sprockets reaches 3/4)

Once the app is fully on a Rails version that ships Sprockets 3/4, unwind the workaround:

1. Drop `uglifier` — it was only a symbol shim.
2. Drop `require: false` on terser — Sprockets 3/4 integrates `Terser::Compressor` natively via
   the railtie.
3. Delete the rake-task swap — terser registers itself.
4. Remove the `:uglifier` assignment / any `NextRails.next?` guards in env configs.

---

## Notes

- Use `NextRails.next?` for any runtime branching, never `respond_to?` or `Gem::Version`
  comparisons.
- The exact hop where this bites is wherever Sprockets is still pinned to 2.x — for the
  3.2 → 4.0 upgrade that is the 4.0 side. An app that already has Sprockets 3/4 will not hit it.
````

## File: rails-upgrade/references/multi-hop-strategy-reference.md
size: 9012
sha: 2d91474eb1b348b5c56cda18faed8c681e2d9ecd
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/multi-hop-strategy-reference.md

````text
# Multi-Hop Upgrade Strategy

**FastRuby.io methodology for large version jumps**

---

## Core Principles

1. **Never skip Rails versions.** Upgrade sequentially, one minor/major version at a time.
2. **Always start from the latest patch of your current version.** Before hopping to the next minor/major, upgrade to the latest patch release of your current series first.

---

## Upgrade to Latest Patch Release

Before beginning any minor or major version hop, ensure you are on the **latest patch release** of your current Rails series. For example, if you are on Rails 3.2.19, upgrade to 3.2.22.5 first.

### Why This Matters

- **Security fixes** — Patch releases contain critical security patches that may also exist in the next minor version. Starting from the latest patch ensures you're not carrying known vulnerabilities.
- **Bug fixes** — Later patches fix bugs that could cause confusing failures during an upgrade, making it harder to distinguish pre-existing issues from upgrade-related ones.
- **Deprecation warnings** — Later patch releases may include additional deprecation warnings that prepare you for the next version.
- **Smaller delta** — The jump to the next minor/major is smaller and better tested from the latest patch than from an arbitrary earlier patch.

### How to Find the Latest Patch

1. Check [rubygems.org/gems/rails/versions](https://rubygems.org/gems/rails/versions) for all releases in your series
2. Or run: `gem search rails --versions | grep "^rails "` to see available versions
3. The latest patch for each series is the target before hopping

### Latest Patch Versions Reference

#### End-of-Life Series (static — these versions are frozen)

| Series | Latest Patch |
|--------|-------------|
| 2.3.x | 2.3.18 |
| 3.0.x | 3.0.20 |
| 3.1.x | 3.1.12 |
| 3.2.x | 3.2.22.5 |
| 4.0.x | 4.0.13 |
| 4.1.x | 4.1.16 |
| 4.2.x | 4.2.11.3 |
| 5.0.x | 5.0.7.2 |
| 5.1.x | 5.1.7 |
| 5.2.x | 5.2.8.1 |
| 6.0.x | 6.0.6.1 |
| 6.1.x | 6.1.7.10 |
| 7.0.x | 7.0.10 |
| 7.1.x | 7.1.6 |

#### Active Series (look up dynamically — these receive new patches)

For series that are still maintained or receiving security updates, **always resolve the latest patch at runtime** using one of these methods:

**Option A — RubyGems API (preferred, structured JSON):**
```bash
curl -s https://rubygems.org/api/v1/versions/rails.json | \
  ruby -rjson -e '
    series = ARGV[0]
    versions = JSON.parse(STDIN.read)
      .map { |v| v["number"] }
      .select { |v| v.start_with?(series) }
      .sort_by { |v| Gem::Version.new(v) }
    puts versions.last
  ' "7.2."
```
Replace `"7.2."` with the target series prefix (e.g., `"8.0."`, `"8.1."`).

**Option B — gem search (works offline if gem sources are cached):**
```bash
gem search '^rails$' --versions | grep "^rails " | \
  ruby -e '
    series = ARGV[0]
    versions = STDIN.read.scan(/[\d.]+/).select { |v| v.start_with?(series) }
      .sort_by { |v| Gem::Version.new(v) }
    puts versions.last
  ' "7.2."
```

> **Why dynamic?** Active series receive new patch releases for security and bug fixes. A hard-coded table goes stale; querying RubyGems ensures the skill always targets the correct version.

### Process

```
1. Read Gemfile.lock to find exact current Rails version (e.g., 3.2.19)
2. Look up latest patch for that series (e.g., 3.2.22.5)
3. If current version < latest patch:
   a. Update Gemfile: gem 'rails', '3.2.22.5'
   b. Run: bundle update rails
   c. Run test suite — all tests must pass
   d. Review CHANGELOG for security fixes and behavioral changes
   e. Deploy patch upgrade to production
   f. Monitor for issues
4. Once on latest patch, proceed to Map Your Path below
```

---

## Why Sequential Upgrades?

1. **Deprecation warnings** - Each version provides warnings about the next
2. **Smaller changesets** - Easier to debug issues
3. **Gem compatibility** - Gems update incrementally too
4. **Migration paths** - Rails provides migration helpers per version
5. **Rollback safety** - Can revert to previous stable state

---

## Planning a Multi-Hop Upgrade

### Map Your Path

Example: Rails 5.2 → 8.1

```
5.2 → 6.0 → 6.1 → 7.0 → 7.1 → 7.2 → 8.0 → 8.1
 |     |     |     |     |     |     |     |
 |     |     |     |     |     |     |     +-- Easy (1-2 days)
 |     |     |     |     |     |     +-------- Very Hard (1-2 weeks)
 |     |     |     |     |     +-------------- Medium (3-5 days)
 |     |     |     |     +-------------------- Medium (3-5 days)
 |     |     |     +-------------------------- Hard (1-2 weeks)
 |     |     +-------------------------------- Medium (3-5 days)
 |     +-------------------------------------- Hard (1-2 weeks)
 +-------------------------------------------- Start
```

### Prioritize Critical Hops

**Hardest upgrades (plan extra time):**
- 5.2 → 6.0 (Zeitwerk)
- 6.1 → 7.0 (Hotwire/Turbo)
- 7.2 → 8.0 (Propshaft)

**Easier upgrades (can move quickly):**
- 5.0 → 5.1
- 6.0 → 6.1
- 7.0 → 7.1
- 8.0 → 8.1

### Create Milestones

```
Milestone 1: Rails 6.0 (Zeitwerk working)
  - Remove require_dependency
  - Fix autoload issues
  - All tests pass

Milestone 2: Rails 7.0 (Modern frontend)
  - Migrate from Webpacker
  - Turbo/Stimulus working
  - All tests pass

Milestone 3: Rails 8.0 (Current stable)
  - Propshaft or Sprockets
  - SSL configuration correct
  - All tests pass

Milestone 4: Rails 8.1 (Latest)
  - Bundler-audit integrated
  - Database config updated
  - All tests pass
```

---

## Upgrade Process Per Hop

### For Each Version Jump:

1. **Prepare**
   ```bash
   git checkout -b rails-X.Y-upgrade
   ```

2. **Update Gemfile**
   ```ruby
   gem 'rails', '~> X.Y.0'
   ```

3. **Bundle Update**
   ```bash
   bundle update rails
   # Fix gem conflicts as they arise
   ```

4. **Run app:update**
   ```bash
   rails app:update
   # Review each change carefully
   ```

5. **Fix Breaking Changes**
   - Address HIGH priority first
   - Then MEDIUM priority
   - Skip LOW priority if time-constrained

6. **Run Tests**
   ```bash
   bundle exec rspec  # or rails test
   ```

7. **Manual Testing**
   - Test critical user flows
   - Check background jobs
   - Verify file uploads
   - Test emails

8. **Deploy to Staging**
   - Full integration testing
   - Performance monitoring
   - Error tracking

9. **Merge and Deploy**
   ```bash
   git checkout main
   git merge rails-X.Y-upgrade
   # Deploy to production
   ```

10. **Monitor**
    - Watch error rates
    - Check performance metrics
    - Be ready to rollback

---

## Time Estimates

| Path | Hops | Estimated Time | Key Challenges |
|------|------|----------------|----------------|
| 5.2 → 6.0 | 1 | 1-2 weeks | Zeitwerk, Ruby upgrade |
| 6.0 → 7.0 | 2 | 2-3 weeks | Hotwire migration |
| 7.0 → 8.0 | 3 | 3-4 weeks | Propshaft, Solid gems |
| 5.2 → 8.1 | 7 | 2-3 months | All of the above |

**Factors that increase time:**
- Low test coverage (+50%)
- Custom asset pipeline (+1 week)
- Many deprecated APIs (+25%)
- Large codebase (+25%)
- Complex gem dependencies (+25%)

---

## Dual-Boot Strategy (Optional)

For large applications, consider dual-boot testing:

```ruby
# Gemfile
if next?
  gem 'rails', '~> 7.0'
else
  gem 'rails', '~> 6.1'
end
```

```bash
# Run current version
bundle exec rspec

# Run next version
BUNDLE_GEMFILE=Gemfile.next bundle exec rspec
```

**Benefits:**
- Run tests against both versions
- Gradual migration of code
- Confidence before switching

**Use dual-boot for:**
- 6.0 → 6.1 → 7.0 transitions
- Large applications
- Risk-averse teams

---

## Common Pitfalls

### 1. Skipping Versions
❌ "Let's just go from 5.2 to 7.0"
✅ Go through 6.0 and 6.1 first

### 2. Upgrading Everything at Once
❌ Upgrading Rails + Ruby + all gems simultaneously
✅ Upgrade Ruby first, then Rails, then gems

### 3. Ignoring Deprecations
❌ Skipping deprecation warnings
✅ Fix deprecations before the next upgrade

### 4. No Test Coverage
❌ Upgrading without tests
✅ Add tests for critical paths first

### 5. Big Bang Deploys
❌ One massive PR with all changes
✅ Incremental PRs per version

---

## Gem Compatibility Matrix

Check these gems early in planning:

| Gem | Rails 6.0 | Rails 7.0 | Rails 8.0 |
|-----|-----------|-----------|-----------|
| Devise | 4.7+ | 4.8+ | 4.9+ |
| Sidekiq | 6.0+ | 6.0+ | 7.0+ |
| RSpec Rails | 4.0+ | 5.0+ | 6.0+ |
| Pundit | 2.0+ | 2.0+ | 2.3+ |
| Cancancan | 3.0+ | 3.3+ | 3.5+ |

**Check compatibility at:**
- https://rubygems.org (version requirements)
- GitHub issues (Rails X support)
- Gem changelogs

---

## Success Criteria Per Hop

Before moving to the next version:

- [ ] All tests passing
- [ ] No deprecation warnings from current version
- [ ] Application boots without errors
- [ ] Critical user flows work
- [ ] Background jobs process correctly
- [ ] File uploads work
- [ ] Emails send correctly
- [ ] Deployed to staging successfully
- [ ] No new errors in error tracking

---

**For version-specific details, see `version-guides/`**
````

## File: rails-upgrade/references/next-hop-readiness-reference.md
size: 2112
sha: e55f97555c6ae31b6a9a35b252e21964c2bd8177
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/next-hop-readiness-reference.md

````text
# Next-Hop Readiness Reference

**When to read this:** the user asks what stands between the app and the next Rails version ("what do I need to get to the next Rails version?"). A quick, read-only answer from the app's files, not an upgrade.

## Rules

- **One hop**: the next version the guides plan from the current one (`upgrade-<current>-to-*.md`). Never list what later versions remove. If the user names a farther target, say this covers the next hop on the way.
- **Read-only**: no Gemfile edits, no `bundle install`, no next_rails setup, no test suite, no fixes.
- **Only what ran**: what the steps cannot see goes under "Not checked".

## Steps

1. **Patch**: `workflows/00-verify-latest-patch-workflow.md` Steps 1 and 2. Report it, do not block.
2. **Gems**: `ruby <skill>/detection-scripts/gem_limits.rb` lists the locked gems whose gemspec excludes the next hop. If next_rails is already in the bundle, `bundle exec bundle_report compatibility --rails-version=<target>` adds the version to bump to. If `Gemfile.next.lock` already pins the target, the gem side is resolved: say so instead of listing caps.
3. **Code**: `ruby <skill>/detection-scripts/scan_patterns.rb --summary`. It names the same hop as step 2. If that hop has no patterns file, search by hand from its version guide, as `workflows/05-detect-breaking-changes-workflow.md` does, and say so. Read one site of each HIGH finding before listing it (`workflows/05-detect-breaking-changes-workflow.md` Step 3).

## Answer

No workflow numbers or skill paths.

```markdown
## Rails {CURRENT} → {TO}: what stands in the way

**Patch:** on the latest {X.Y} patch / upgrade to {X.Y.W} first.
**Gems capped below {TO}** ({N}): gem, locked version, limit, parent if not in the Gemfile. Or "None".
**Fix before the bump** ({N} patterns): one line each, HIGH first, with a site count and one file:line.
**Fix when ready** ({N} patterns): one line each.
**Not checked:** the test suite and its deprecation warnings, boot on {TO}, behavior no pattern can find.
```

End with one offer: start the upgrade to {TO} (a Full Upgrade, from Workflow 00).
````

## File: rails-upgrade/references/no-test-suite-smoke-reference.md
size: 4819
sha: 5a17f912acfafae77ea58331d72c5d3cb46b24fd
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/no-test-suite-smoke-reference.md

````text
# No-Test-Suite Smoke Reference

**Purpose:** Provide a concrete baseline check when a Rails app has no RSpec or Minitest suite.

**When to use:** Workflow 01 (`workflows/01-run-test-suite-workflow.md`), only after test-suite detection finds no runnable `spec/` or `test/` suite.

This is not a replacement for adding tests. It is a minimum boot and routing baseline so the upgrade report can say exactly what was checked before proceeding.

---

## 1. Confirm There Is No Runnable Suite

Check for actual test **files**, not just gem presence. `minitest` ships with every Rails app (it is a transitive dependency of `activesupport` in virtually every `Gemfile.lock`), so a gem match alone does not mean a runnable suite exists. Relying on it sends abandoned-test-setup apps back to `workflows/01-run-test-suite-workflow.md`, which finds nothing to run and bounces them right back here, an infinite loop.

```bash
# Test file presence (the deciding signal)
test -d spec && find spec -name "*_spec.rb" | grep -q .
test -d test && find test -name "*_test.rb" | grep -q .

# Gemfile only (never Gemfile.lock), explicit test gems only
grep -E "rspec-rails|minitest-rails" Gemfile
```

Treat the app as having **no runnable suite** unless at least one test file is found. If test files do exist, return to `workflows/01-run-test-suite-workflow.md` and run the real suite. Use this fallback only when no runnable suite exists.

---

## 2. Run Rails Boot Checks

Start with the cheapest command that loads the Rails environment:

```bash
bundle exec rails runner "puts Rails.version"
```

If the app has multiple environments or credentials constraints, also check test-mode boot:

```bash
RAILS_ENV=test bundle exec rails runner "puts Rails.env"
```

Record PASS or FAIL and the exact error. A boot failure blocks the upgrade until the user decides whether to fix the baseline first.

---

## 3. Check Routes And Migrations

These commands catch common baseline failures without needing a test suite:

```bash
bundle exec rails routes > tmp/rails-routes.txt 2>&1
bundle exec rails db:migrate:status
```

Redirect both stdout and stderr (`2>&1`): routing errors such as a bad constant in `routes.rb` print to stderr, and dropping them lets the command look like it succeeded with an empty output file. Write to the app's own `tmp/` directory rather than `/tmp`, which can be read-only or sandboxed in CI, Docker, and macOS App Sandbox contexts and would fail the check for the wrong reason.

If `db:migrate:status` cannot run because the database is unavailable, report it as "not verified" rather than fabricating a pass. Do not create or migrate a database unless the user asked for that setup.

---

## 4. Run Asset Or Build Checks When Available

Only run commands that already exist in the app:

```bash
bundle exec rails assets:precompile
bin/vite build
yarn build
npm run build
```

Pick the app's actual build path from its files (`package.json`, `vite.config.*`, `app/assets`, `config/webpacker.yml`, or Propshaft/Sprockets config). If no asset build exists, record "not applicable."

---

## 5. Optional Manual Smoke URLs

If the app can boot locally, start the server in the background, capture its PID, and **always shut it down afterward** so an orphaned server does not hold port 3000 and cause conflicts in later steps:

```bash
bundle exec rails server &
SERVER_PID=$!
sleep 5  # wait for boot

# Check only safe, read-only endpoints, for example:
curl -I http://localhost:3000/
curl -I http://localhost:3000/users/sign_in

kill $SERVER_PID 2>/dev/null
```

Do not submit forms, mutate data, or hit admin/customer actions as part of this fallback.

---

## Output Format

```markdown
## No-Test-Suite Smoke Baseline

**Status:** PASS / FAIL / PARTIAL
**Reason this fallback ran:** No runnable RSpec or Minitest suite was detected.

| Check | Command | Result |
|---|---|---|
| Rails boot | `bundle exec rails runner "puts Rails.version"` | PASS |
| Test env boot | `RAILS_ENV=test bundle exec rails runner "puts Rails.env"` | PASS |
| Routes load | `bundle exec rails routes` | PASS |
| Migration status | `bundle exec rails db:migrate:status` | NOT VERIFIED - database unavailable |
| Asset/build check | `<actual command>` | PASS / NOT APPLICABLE |

**Upgrade risk:** High. This app has no automated suite. Add focused tests before or during the first upgrade hop, and treat every generated change as requiring manual verification.
```

---

## Stop Conditions

Stop and report instead of proceeding when:

- Rails cannot boot in the current environment.
- Routes cannot load.
- A required database or credential is missing and the user has not authorized setup.

If the fallback passes, continue with the upgrade workflow, but mark baseline confidence as `partial` and keep recommending real test coverage.
````

## File: rails-upgrade/references/request-patterns-reference.md
size: 3788
sha: 19b4d18db8821ac6204894bfdbf8a73bcfdf5545
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/request-patterns-reference.md

```text
# Request Patterns Reference

**When to read this:** At the start of a session, to classify the user's request and decide which workflows run. Every row is a workflow from the index in `SKILL.md`; every column is a request shape.

| Pattern | User says |
|---------|-----------|
| **Full Upgrade Request** | "Upgrade my Rails app to 8.1" |
| **Multi-Hop Request** | "Help me upgrade from Rails 5.2 to 8.1" |
| **Breaking Changes Analysis Only** | "What breaking changes affect my app for Rails 8.0?" |
| **Reports Only** | "Upgrade my app to 7.1 but stop once you have presented both reports, I will implement myself" |
| **Next-Hop Readiness** | "What do I need to do to get to the next Rails version?" |

| Workflow | Full Upgrade | Multi-Hop | Analysis Only | Reports Only |
|----------|--------------|-----------|---------------|--------------|
| 00 Verify latest patch | run, MANDATORY | run, MANDATORY. This check applies at the START and again after each hop | run. Check if on latest patch — warn if not, recommend patching first | run, MANDATORY |
| 01 Run test suite | run, MANDATORY. If tests FAIL → STOP and help fix tests first | run, MANDATORY. Run test suite BEFORE planning any upgrade work | run, MANDATORY. If tests fail → Warn user and recommend fixing first. If tests pass → Proceed with analysis | run, MANDATORY |
| 02 Resolve deprecation warnings | run | run, per hop | run: collect and report the warnings, apply fixes only if the user agrees | run: collect and inventory; the user said no fixes, so Step 4 is recorded in the report as the first implementation task |
| 03 Validate upgrade path | run | run. Explain sequential requirement, calculate hops (e.g. 5.2 → 6.0 → 6.1 → 7.0 → 7.1 → 7.2 → 8.0 → 8.1), see `references/multi-hop-strategy-reference.md` | skip | run |
| 04 Set up next_rails | run | run (if not already set up). Dual-boot stays active throughout the multi-hop process | skip | run. Adding `next_rails` and the `if next?` branch is not the bump the user declined |
| 05 Detect breaking changes | run | run, per hop | run. Present findings summary, offer to generate full upgrade report | run |
| 06 Check gem compatibility | run | run, per hop | skip | run |
| 07 Boot smoke test and models suite | run | run, per hop | skip | run the boot; if it fails, record the required gem bumps in the report instead of editing the Gemfile, since the user will implement |
| 08 Generate upgrade report | run | run, per hop | only if the user accepts the offer. 06 and 07 did not run, so generate the report without the gem compatibility and boot smoke sections and say so in the report | run |
| 09 Generate app:update preview | run | run, per hop | skip | run, then stop. Do not offer to implement; the user already said they will |
| 10 Implement and upgrade | run | run, per hop. After first hop complete, repeat for next hops | skip | skip |
| 11 Sync CI config | run | run, per hop | skip | skip |
| 12 Align load_defaults | run, FINAL | run, per hop. **IMPORTANT:** After each hop, align load_defaults to the new version before starting the next hop | skip | skip |
| 13 Mention cleanup | run | run, after the last hop | skip | skip |

Analysis Only intentionally skips Workflow 04 (Dual-Boot setup) and Workflow 03 (Validate Upgrade Path) because the user is not yet committing to an upgrade. Reports Only is a Full Upgrade that stops after Workflow 09: the user wants both deliverables and will do the implementation, CI sync and load_defaults work themselves.

Next-Hop Readiness is not in the table: it uses only the patch check of Workflow 00 and two scripts. It is a quick read-only answer for the next hop only, with no test suite, no next_rails setup and no report. Follow `references/next-hop-readiness-reference.md`.
```

## File: rails-upgrade/references/sequential-strategy-reference.md
size: 2101
sha: ac50aeff2806e8f331cb8ecb96b4a887403a9c59
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/sequential-strategy-reference.md

````text
# Sequential Strategy Reference

**When to read this:** `workflows/03-validate-upgrade-path-workflow.md`, when confirming the upgrade path and planning hops.

## Sequential Upgrade Strategy

### ⚠️ Version Skipping is NOT Allowed

Rails upgrades MUST follow a sequential path. Examples:

**For Rails 5.x to 8.x:**
```
5.0.x → 5.1.x → 5.2.x → 6.0.x → 6.1.x → 7.0.x → 7.1.x → 7.2.x → 8.0.x → 8.1.x
```

**You CANNOT skip versions.** Examples:
- ❌ 5.2 → 6.1 (skips 6.0)
- ❌ 6.0 → 7.0 (skips 6.1)
- ❌ 7.0 → 8.0 (skips 7.1 and 7.2)
- ✅ 5.2 → 6.0 (correct)
- ✅ 7.0 → 7.1 (correct)
- ✅ 7.2 → 8.0 (correct)

If user requests a multi-hop upgrade (e.g., 5.2 → 8.1):
1. Explain the sequential requirement
2. Break it into individual hops
3. Generate separate reports for each hop
4. Recommend completing each hop fully before moving to next

---

## Supported Upgrade Paths

### Legacy Rails (2.3 - 4.2)

| From | To | Key Changes | Ruby Required |
|------|-----|-------------|---------------|
| 2.3.x | 3.0.x | XSS protection, routes syntax | 1.8.7 - 1.9.3 |
| 3.0.x | 3.1.x | Asset pipeline, jQuery | 1.8.7 - 1.9.3 |
| 3.1.x | 3.2.x | Ruby 1.9.3 support | 1.8.7 - 2.0 |
| 3.2.x | 4.0.x | Strong Parameters, Turbolinks | 1.9.3+ |
| 4.0.x | 4.1.x | Spring, secrets.yml | 1.9.3+ |
| 4.1.x | 4.2.x | ActiveJob, Web Console | 1.9.3+ |
| 4.2.x | 5.0.x | ActionCable, API mode, ApplicationRecord | 2.2.2+ |

### Modern Rails (5.0 - 8.1)

| From | To | Key Changes | Ruby Required |
|------|-----|-------------|---------------|
| 5.0.x | 5.1.x | Encrypted secrets, yarn default | 2.2.2+ |
| 5.1.x | 5.2.x | Active Storage, credentials | 2.2.2+ |
| 5.2.x | 6.0.x | Zeitwerk, Action Mailbox/Text | 2.5.0+ |
| 6.0.x | 6.1.x | Horizontal sharding, strict loading | 2.5.0+ |
| 6.1.x | 7.0.x | Hotwire/Turbo, Import Maps | 2.7.0+ |
| 7.0.x | 7.1.x | Composite keys, async queries | 2.7.0+ |
| 7.1.x | 7.2.x | Transaction-aware jobs, DevContainers | 3.1.0+ |
| 7.2.x | 8.0.x | Propshaft, Solid gems, Kamal | 3.2.0+ |
| 8.0.x | 8.1.x | Bundler-audit, max_connections | 3.2.0+ |
````

## File: rails-upgrade/references/staying-current-reference.md
size: 7986
sha: b5151952d0a00751f0ce77e8405dd0b64258bb15
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/staying-current-reference.md

````text
# Staying Current with Rails

**Based on "The Complete Guide to Upgrade Rails" by FastRuby.io (OmbuLabs)**

---

## Overview

Congratulations on completing your Rails upgrade! Now the goal is to never fall behind again. This guide covers strategies to keep your Rails application current.

---

## Continuous Integration with Dual-Boot

Set up your CI to run tests against both your current Rails version and the next version. This way you're always prepared for the next upgrade.

### CircleCI Configuration

```yaml
# .circleci/config.yml

version: 2.1

jobs:
  build-current:
    docker:
      - image: cimg/ruby:3.2.0
        environment:
          RAILS_ENV: test
          DATABASE_URL: postgres://postgres@localhost/myapp_test
      - image: cimg/postgres:14.0
    steps:
      - checkout
      - run: bundle install
      - run: bundle exec rails db:create db:schema:load
      - run: bundle exec rspec

  build-next:
    docker:
      - image: cimg/ruby:3.2.0
        environment:
          RAILS_ENV: test
          DATABASE_URL: postgres://postgres@localhost/myapp_test
          BUNDLE_GEMFILE: Gemfile.next
      - image: cimg/postgres:14.0
    steps:
      - checkout
      - run: bundle install
      - run: bundle exec rails db:create db:schema:load
      - run: bundle exec rspec

workflows:
  version: 2
  test:
    jobs:
      - build-current
      - build-next:
          # Run next version tests, but don't block deploys
          requires:
            - build-current
```

### Travis CI Configuration

```yaml
# .travis.yml

language: ruby
cache: bundler

rvm:
  - 3.2.0

gemfile:
  - Gemfile
  - Gemfile.next

services:
  - postgresql

before_script:
  - bundle install
  - bundle exec rails db:create db:schema:load

script:
  - bundle exec rspec

# Allow next version failures (informational only)
jobs:
  allow_failures:
    - gemfile: Gemfile.next
```

### GitHub Actions Configuration

```yaml
# .github/workflows/ci.yml

name: CI

on: [push, pull_request]

jobs:
  test-current:
    runs-on: ubuntu-latest
    env:
      RAILS_ENV: test
      DATABASE_URL: postgres://postgres:postgres@localhost/myapp_test

    services:
      postgres:
        image: postgres:14
        env:
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432

    steps:
      - uses: actions/checkout@v3
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.2
          bundler-cache: true
      - run: bundle exec rails db:create db:schema:load
      - run: bundle exec rspec

  test-next:
    runs-on: ubuntu-latest
    continue-on-error: true  # Don't block PR merges
    env:
      RAILS_ENV: test
      DATABASE_URL: postgres://postgres:postgres@localhost/myapp_test
      BUNDLE_GEMFILE: Gemfile.next

    services:
      postgres:
        image: postgres:14
        env:
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432

    steps:
      - uses: actions/checkout@v3
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.2
          bundler-cache: true
      - run: bundle exec rails db:create db:schema:load
      - run: bundle exec rspec
```

---

## Tracking Outdated Dependencies

### Regular Dependency Audits

Schedule regular checks for outdated gems:

```bash
# Check all outdated gems
bundle outdated

# Check only direct dependencies
bundle outdated --only-explicit

# Check for security vulnerabilities
bundle audit check --update
```

### Automated Dependency Updates

Use tools like [Dependabot](https://docs.github.com/en/code-security/dependabot) or [Renovate](https://www.mend.io/renovate/) to automatically create PRs for dependency updates.

**Dependabot configuration:**

```yaml
# .github/dependabot.yml

version: 2
updates:
  - package-ecosystem: "bundler"
    directory: "/"
    schedule:
      interval: "weekly"
    open-pull-requests-limit: 5
    groups:
      rails:
        patterns:
          - "rails"
          - "actioncable"
          - "actionmailer"
          - "actionpack"
          - "actionview"
          - "activejob"
          - "activemodel"
          - "activerecord"
          - "activestorage"
          - "activesupport"
          - "railties"
```

### Test-Driven Updates

Create a workflow where every dependency update:

1. Creates a pull request
2. Runs the full test suite
3. Requires code review
4. Gets deployed to staging
5. QA verification
6. Production deployment

---

## Testing Against Rails Master

Stay ahead of releases by testing against Rails' main branch:

### Gemfile Configuration

```ruby
# Gemfile

def next?
  File.basename(__FILE__) == "Gemfile.next"
end

if next?
  # Test against Rails main branch
  gem 'rails', github: 'rails/rails', branch: 'main'
else
  gem 'rails', '~> 7.1.0'
end
```

### When to Test Against Main

- **Weekly**: Run CI against Rails main once a week
- **Before major releases**: Increase frequency before new Rails versions
- **After RC releases**: Test release candidates immediately

### Benefits

- Discover breaking changes early
- Contribute fixes to Rails
- Be ready on release day
- Understand upcoming features

---

## Release Monitoring

### Stay Informed

1. **Rails Blog**: https://rubyonrails.org/blog/
2. **Rails Twitter**: https://twitter.com/rails
3. **Rails GitHub Releases**: https://github.com/rails/rails/releases
4. **Ruby Weekly Newsletter**: https://rubyweekly.com/

### Version Monitoring Tools

```ruby
# Add to Gemfile
gem 'libyear-bundler', group: :development
```

```bash
# Check how "out of date" your dependencies are
bundle libyear
```

---

## Upgrade Schedule

### Recommended Cadence

| Cycle | Action |
|-------|--------|
| Weekly | Check `bundle outdated` |
| Monthly | Update patch versions |
| Quarterly | Update minor versions |
| Annually | Plan major version upgrade |

### When to Upgrade

**Upgrade immediately:**
- Security patches (x.y.Z releases)
- Critical bug fixes

**Upgrade soon (within 1-2 months):**
- Minor versions with important features
- Dependency requirements

**Plan for next quarter:**
- Major version upgrades
- Breaking changes

---

## Team Practices

### Ownership

Assign ownership for keeping dependencies current:

- **Rails version**: Senior developer or tech lead
- **Security gems**: Security-conscious team member
- **CI/CD tools**: DevOps or platform team

### Documentation

Maintain upgrade documentation:

- Record decisions made during upgrades
- Note workarounds for specific issues
- Track gems that commonly cause problems
- Document custom patches or forks

### Knowledge Sharing

After each upgrade:

- Hold a brief retrospective
- Share learnings with the team
- Update internal documentation
- Consider blog posts or conference talks

---

## Preventive Measures

### Don't Accumulate Debt

1. **Address deprecations immediately** - Don't let them pile up
2. **Update gems regularly** - Small updates are easier than big jumps
3. **Keep test coverage high** - Makes upgrades safe
4. **Review changelogs** - Understand what's changing

### Avoid Common Traps

- **Don't pin to old versions** without a plan to upgrade
- **Don't ignore CI warnings** about deprecated features
- **Don't skip testing** to save time
- **Don't deploy untested upgrades** directly to production

---

## Quick Reference

### Commands

```bash
# Check outdated gems
bundle outdated

# Security audit
bundle audit check --update

# Update a specific gem
bundle update gem_name --conservative

# Update all gems (careful!)
bundle update
```

### CI Environment Variables

```bash
# Run with next Rails version
BUNDLE_GEMFILE=Gemfile.next bundle exec rspec

# Enable deprecation warnings
RUBYOPT="-W:deprecated" bundle exec rspec
```

---

## Resources

- [RailsBump](https://railsbump.org/) - Gem compatibility checker
- [RailsDiff](https://railsdiff.org/) - Compare Rails versions
- [FastRuby.io Blog](https://www.fastruby.io/blog) - Upgrade guides and tips
- [next_rails gem](https://github.com/fastruby/next_rails) - Dual-boot tool
````

## File: rails-upgrade/references/testing-checklist-reference.md
size: 6404
sha: caa0c6688c617a88cd7fe4fa3820b948a61a8889
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/references/testing-checklist-reference.md

````text
# Testing Checklist for Rails Upgrades

**Comprehensive testing checklist based on FastRuby.io methodology**

---

## Pre-Upgrade Testing

### 1. Current State Verification

- [ ] All existing tests pass
- [ ] Run with deprecation warnings enabled:
  ```bash
  RUBYOPT="-W:deprecated" bundle exec rspec
  ```
- [ ] Note current test coverage percentage
- [ ] Document any known failing tests

### 2. Establish Baseline

- [ ] Record current boot time
- [ ] Record average request time
- [ ] Record memory usage
- [ ] Capture current error rate
- [ ] Screenshot key pages

---

## During Upgrade Testing

### 1. After Each Change

- [ ] Application boots without errors
- [ ] Run quick smoke test (5 critical flows)
- [ ] No new deprecation warnings introduced

### 2. After bundle update rails

- [ ] `rails console` works
- [ ] `rails server` starts
- [ ] Basic route works (hit homepage)

### 3. After rails app:update

- [ ] Review each config change
- [ ] Application still boots
- [ ] Run test suite

---

## Post-Upgrade Testing

### Automated Tests

#### Unit Tests
- [ ] Model tests pass
- [ ] Service object tests pass
- [ ] Library tests pass
- [ ] Concern tests pass

#### Controller Tests
- [ ] Index actions work
- [ ] Show actions work
- [ ] Create actions work
- [ ] Update actions work
- [ ] Delete actions work
- [ ] API endpoints work

#### Integration Tests
- [ ] Multi-step workflows pass
- [ ] Authentication flows work
- [ ] Authorization checks work

#### System/Feature Tests
- [ ] JavaScript interactions work
- [ ] Form submissions work
- [ ] File uploads work
- [ ] Navigation flows work

---

### Manual Testing Checklist

#### Authentication & Authorization
- [ ] User can sign up
- [ ] User can log in
- [ ] User can log out
- [ ] Password reset works
- [ ] OAuth login works (if applicable)
- [ ] Session timeout works
- [ ] Remember me works
- [ ] Role-based access works

#### Core Features
- [ ] Main dashboard loads
- [ ] Search functionality works
- [ ] Filtering works
- [ ] Sorting works
- [ ] Pagination works
- [ ] CRUD operations work

#### File Handling
- [ ] File upload works
- [ ] Image upload works
- [ ] File download works
- [ ] Image processing works (variants)
- [ ] Direct uploads work (if using)

#### Email
- [ ] Emails are sent
- [ ] Email templates render correctly
- [ ] Links in emails work
- [ ] Attachments work
- [ ] Mailer previews work

#### Background Jobs
- [ ] Jobs enqueue correctly
- [ ] Jobs process correctly
- [ ] Failed jobs retry
- [ ] Job callbacks fire
- [ ] Scheduled jobs run

#### Real-time Features (if applicable)
- [ ] ActionCable connections work
- [ ] WebSocket messages deliver
- [ ] Broadcast works
- [ ] Subscriptions work

#### API (if applicable)
- [ ] Authentication works
- [ ] JSON responses correct
- [ ] Status codes correct
- [ ] Rate limiting works
- [ ] CORS works

#### Assets
- [ ] CSS loads correctly
- [ ] JavaScript loads correctly
- [ ] Images load correctly
- [ ] Fonts load correctly
- [ ] Asset fingerprinting works
- [ ] Asset compilation works

#### Forms
- [ ] Simple forms submit
- [ ] Nested forms work
- [ ] File upload forms work
- [ ] Remote forms work (Turbo)
- [ ] Form validation displays
- [ ] CSRF protection works

#### Caching
- [ ] Page caching works (if used)
- [ ] Fragment caching works
- [ ] Russian doll caching works
- [ ] Cache invalidation works
- [ ] Session storage works

#### Database
- [ ] Queries execute correctly
- [ ] Transactions work
- [ ] Connection pooling works
- [ ] Multi-database works (if used)

---

### Performance Testing

- [ ] Boot time is acceptable
- [ ] Request times similar to baseline
- [ ] Memory usage similar to baseline
- [ ] No N+1 queries introduced
- [ ] Database query times acceptable

---

### Browser Testing

- [ ] Chrome works
- [ ] Firefox works
- [ ] Safari works
- [ ] Mobile responsive works
- [ ] No JavaScript console errors

---

### Security Testing

- [ ] CSRF protection enabled
- [ ] XSS protection works
- [ ] SQL injection protected
- [ ] Strong parameters work
- [ ] Secrets/credentials accessible
- [ ] SSL/HTTPS works

---

## Staging Deployment Checklist

- [ ] Deployment succeeds
- [ ] Database migrations run
- [ ] Asset compilation works
- [ ] Background workers start
- [ ] Application boots in production mode
- [ ] Environment variables correct
- [ ] External service connections work
- [ ] Error tracking works (Sentry, etc.)
- [ ] Logging works
- [ ] Monitoring dashboards show data

---

## Production Deployment Checklist

### Before Deploy
- [ ] Staging tests complete
- [ ] Rollback plan documented
- [ ] Team notified of deployment
- [ ] Low-traffic window chosen
- [ ] Database backup taken

### During Deploy
- [ ] Monitor deployment progress
- [ ] Watch for deployment errors
- [ ] Verify workers restart

### After Deploy (First 15 minutes)
- [ ] Application responds
- [ ] Check error tracking for spikes
- [ ] Verify key user flows work
- [ ] Monitor response times
- [ ] Check background jobs processing

### After Deploy (First hour)
- [ ] Error rate normal
- [ ] Performance metrics stable
- [ ] No user complaints
- [ ] Jobs backlog clearing

### After Deploy (First day)
- [ ] Review all errors
- [ ] Check for edge cases
- [ ] Monitor resource usage
- [ ] Gather user feedback

---

## Rollback Triggers

Rollback immediately if:

- [ ] Error rate > 2x normal
- [ ] Response time > 3x normal
- [ ] Critical feature broken
- [ ] Data integrity issues
- [ ] Security vulnerability discovered
- [ ] External service integration broken

---

## Test Environment Setup

```bash
# Run tests with Rails next version
BUNDLE_GEMFILE=Gemfile.next bundle exec rspec

# Run with verbose deprecation warnings
RUBYOPT="-W:deprecated" bundle exec rspec

# Run specific test file
bundle exec rspec spec/models/user_spec.rb

# Run with coverage
COVERAGE=true bundle exec rspec
```

---

## Common Test Fixes

### 1. Time-dependent tests
```ruby
# Use travel_to instead of fixed times
travel_to Time.zone.local(2024, 1, 1) do
  # test code
end
```

### 2. Database cleanup
```ruby
# Ensure proper cleanup between tests
RSpec.configure do |config|
  config.use_transactional_fixtures = true
end
```

### 3. Asset pipeline tests
```ruby
# Stub asset methods if needed
allow(helper).to receive(:asset_path).and_return("/assets/test.png")
```

---

**Keep this checklist visible throughout the upgrade process!**
````

## File: rails-upgrade/detection-scripts/gem_limits.rb
size: 6171
sha: eef33c7c0334f3c18498d53a777a9da8620c5c2f
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/gem_limits.rb

```text
# frozen_string_literal: true

# Lists the locked gems whose own gemspec excludes the target Rails: the gems
# to bump or replace before the bump can resolve. Reads only the lockfile, so
# no network, no next_rails, no bundle install. Runs with the app's Ruby:
# stdlib only, Ruby 2.1 compatible.
#
#   ruby <skill>/detection-scripts/gem_limits.rb [--target 4.2] [--lockfile Gemfile.next.lock]
#
# Only limits on the Rails framework gems count. A gem only the framework pulls
# in is skipped (the next rails resolves it), and a transitive gem names the
# gems that pull it in.

require "optparse"
require "rubygems"
require_relative "hop"

FRAMEWORK_GEMS = %w[
  rails railties actionpack actionview activerecord activemodel activesupport activeresource
  actionmailer activejob actioncable activestorage actiontext actionmailbox
].freeze

# { :specs => { name => { :version, :source, :deps => { dep => [req, ...] } } }, :direct => [names] }
def parse_lockfile(text)
  specs = {}
  direct = []
  section = current = nil
  text.each_line do |line|
    line = line.chomp
    if line =~ /\A(\S.*)\z/
      section = $1.strip
      current = nil
    elsif section == "DEPENDENCIES"
      direct << $1 if line =~ /\A  ([^\s!(]+)/
    elsif %w[GEM GIT PATH].include?(section)
      if line =~ /\A    (\S+) \(([^)]+)\)\z/
        # Platform variants (nokogiri 1.6.8-x86_64-linux) are one gem: show the
        # plain version and keep every variant's requirements.
        current = (specs[$1] ||= { :version => $2, :source => section.downcase, :deps => {} })
        current[:version] = $2 unless $2.include?("-")
      elsif current && line =~ /\A      (\S+)(?: \(([^)]+)\))?\z/
        reqs = (current[:deps][$1] ||= [])
        reqs << ($2 || ">= 0") unless reqs.include?($2 || ">= 0")
      end
    end
  end
  { :specs => specs, :direct => direct }
end

# A requirement allows "4.1" when any 4.1.x patch satisfies it.
def allows_minor?(requirement, minor)
  req = Gem::Requirement.new(*requirement.split(/,\s*/))
  (0..99).any? { |patch| req.satisfied_by?(Gem::Version.new("#{minor}.#{patch}")) }
end

def capped_gems(lock, target)
  specs = lock[:specs]
  parents = Hash.new { |h, k| h[k] = [] }
  specs.each { |name, s| s[:deps].each { |dep, reqs| parents[dep] << [name, reqs.join("; ")] } }

  specs.keys.sort.map do |name|
    next if FRAMEWORK_GEMS.include?(name)
    limits = []
    specs[name][:deps].each do |dep, reqs|
      reqs.each { |req| limits << "#{dep} #{req}" if FRAMEWORK_GEMS.include?(dep) && !allows_minor?(req, target) }
    end
    next if limits.empty?
    direct = lock[:direct].include?(name)
    pulled_by = parents[name].reject { |parent, _| FRAMEWORK_GEMS.include?(parent) }
    next if !direct && pulled_by.empty?
    { :name => name, :version => specs[name][:version], :source => specs[name][:source], :direct => direct,
      :limits => limits, :parents => pulled_by.map { |parent, req| req == ">= 0" ? parent : "#{parent} (#{req})" } }
  end.compact
end

def render(hop, lockfile, capped)
  out = ["# Gem limits: Rails #{hop[:from]} -> #{hop[:to]}", "",
         "- Lockfile: `#{lockfile}` (#{hop[:locked] || 'no rails'})", "- Hop source: #{hop[:source]}", ""]
  if capped.empty?
    out << "No locked gem declares a Rails limit that excludes #{hop[:to]}."
  else
    out << "## Capped below #{hop[:to]} (#{capped.length})" << ""
    out << "Each gem's gemspec excludes Rails #{hop[:to]}: bump it to a release that allows it, replace it, or drop it."
    out << "" << "| Gem | Locked | Source | Declared limit | In Gemfile | Pulled in by |"
    out << "|-----|--------|--------|----------------|------------|--------------|"
    capped.each do |g|
      out << "| #{g[:name]} | #{g[:version]} | #{g[:source]} | #{g[:limits].join('; ')} | " \
             "#{g[:direct] ? 'yes' : 'no'} | #{g[:parents].join(', ')} |"
    end
  end
  out << "" << "Not checked: limits on non-Rails gems, limits stated only in a README, and runtime breakage."
  out.join("\n") + "\n"
end

def self_test
  lock = parse_lockfile(<<-LOCK)
GEM
  specs:
    capped (1.0)
      actionpack (>= 3.1, < 4.1)
    floor (1.0)
      activerecord (>= 4.1.2)
    parent (1.0)
      child
    child (1.0)
      railties (< 4.1)
    rails (4.0.13)
      only_rails
    only_rails (1.0)
      actionpack (< 4.1)
    variant (1.0-java)
      railties (>= 4.0)
    variant (1.0)
      railties (>= 4.0, < 4.1)

DEPENDENCIES
  capped
  floor
  parent
  rails
  variant!
LOCK
  got = capped_gems(lock, "4.1")
  child = got.find { |g| g[:name] == "child" }
  failures = []
  failures << "capped gems: #{got.map { |g| g[:name] }.inspect}" unless got.map { |g| g[:name] } == %w[capped child variant]
  failures << "child should name its parent" unless child && child[:parents] == ["parent"] && !child[:direct]
  failures << "variant should show its plain version" unless lock[:specs]["variant"][:version] == "1.0"
  if failures.empty?
    puts "gem_limits: self-test OK"
    exit 0
  end
  failures.each { |f| warn "FAIL: #{f}" }
  exit 1
end

if $PROGRAM_NAME == __FILE__
  opts = { :root => ".", :lockfile => "Gemfile.lock" }
  OptionParser.new do |o|
    o.banner = "Usage: ruby gem_limits.rb [--target X.Y] [--root DIR] [--lockfile FILE]"
    o.on("--target VERSION", "target Rails version (default: next hop after the lockfile's rails)") { |v| opts[:target] = v }
    o.on("--root DIR", "app root (default: .)") { |v| opts[:root] = v }
    o.on("--lockfile FILE", "lockfile relative to --root (default: Gemfile.lock)") { |v| opts[:lockfile] = v }
    o.on("--self-test", "run built-in assertions and exit") { self_test }
  end.parse!

  lockfile = File.expand_path(opts[:lockfile], File.expand_path(opts[:root]))
  abort("gem_limits: #{lockfile} not found") unless File.file?(lockfile)
  text = File.read(lockfile, :encoding => "UTF-8")
  hop = Hop.resolve(text, opts[:target], File.basename(lockfile))
  abort("gem_limits: #{hop[:error]}") if hop[:error]
  abort("gem_limits: #{opts[:lockfile]} already resolves Rails #{hop[:to]}; check the other lockfile with --lockfile") if hop[:reached]
  print render(hop, opts[:lockfile], capped_gems(parse_lockfile(text), hop[:to]))
end
```

## File: rails-upgrade/detection-scripts/hop.rb
size: 2225
sha: e6a04b6f9d8cf99a8c0d39690190335136252cd7
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/hop.rb

```text
# frozen_string_literal: true

require "rubygems"

# The hop an app is on, shared by scan_patterns.rb and gem_limits.rb so both
# name the same hop. Runs with the app's Ruby: stdlib only, Ruby 2.1 compatible.
module Hop
  GUIDES_DIR = File.expand_path("../version-guides", __dir__)

  # The version guide whose hop ends at `target`, or nil.
  def self.guide_for(target)
    Dir[File.join(GUIDES_DIR, "upgrade-*-to-#{target}.md")].first
  end

  # The version a hop to `target` starts from (7.0 -> "6.1"), or nil.
  def self.from_for(target)
    g = guide_for(target)
    g ? File.basename(g)[/\Aupgrade-(\d+\.\d+)-to-/, 1] : nil
  end

  # { :from, :to, :locked, :source, :reached } or { :error }. The hop comes
  # from the version guides; the lockfile's rails (or railties, for apps
  # without the rails gem) is the current version. :reached is true when the
  # lockfile is already on the --target version or past it.
  def self.resolve(lock_text, target_arg, lock_name = "Gemfile.lock")
    name = %w[rails railties].find { |n| lock_text.to_s =~ /^    #{n} \((\d+\.\d+)[^)]*\)/ }
    current = name ? $1 : nil
    locked = name ? lock_text[/^    #{name} \(([^)\s]+)\)/, 1] : nil
    if target_arg
      t = target_arg.to_s.strip
      t = "#{t[0..-2]}.#{t[-1]}" if t =~ /\A\d{2,3}\z/
      target = t[/\A(\d+\.\d+)(?:\.\d+)*\z/, 1]
      return { :error => "--target #{target_arg.inspect} is not a Rails version like 4.1" } unless target
      from = from_for(target)
      return { :error => "no version guide ends at Rails #{target}" } unless from
      source = "--target"
    else
      return { :error => "no rails or railties in #{lock_name}; pass --target X.Y" } unless current
      g = Dir[File.join(GUIDES_DIR, "upgrade-#{current}-to-*.md")].first
      return { :error => "no version guide starts at Rails #{current}; pass --target X.Y" } unless g
      from, target = current, File.basename(g)[/-to-(\d+\.\d+)\.md\z/, 1]
      source = "#{lock_name} pins #{name} #{locked}"
    end
    reached = current && Gem::Version.new(target) <= Gem::Version.new(current) ? true : false
    { :from => from, :to => target, :locked => name ? "#{name} #{locked}" : nil, :source => source, :reached => reached }
  end
end
```

## File: rails-upgrade/detection-scripts/patterns/rails-40-patterns.expectations.yml
size: 44863
sha: adc79604b75eebea25871d33deb7642d96a35493
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-40-patterns.expectations.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-40-patterns.expectations.yml

## File: rails-upgrade/detection-scripts/patterns/rails-40-patterns.yml
size: 98814
sha: 363c4bda3b512d1e6cd5b2a1b5e5057bf7c945c4
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-40-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-40-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-41-patterns.expectations.yml
size: 26187
sha: 72587960643ce09a992af5cd8a39bd28b9c0fea4
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-41-patterns.expectations.yml

```text
# Fixture expectations for rails-41-patterns.yml.
#
# Keyed by variable_name (matching the entries in rails-41-patterns.yml). For
# each pattern you cover, list:
#   match     - lines the pattern MUST flag (the real breaking-change shapes)
#   no_match  - lines it MUST NOT flag (safe code + known false-positive traps)
#
# A line is "flagged" when the entry's `pattern` regex matches it AND the
# entry's `exclude` regex (when present) does not — a per-line grep + grep -v.
#
# Run with:
#   bin/test-patterns rails-upgrade/detection-scripts/patterns/rails-41-patterns.yml

DYNAMIC_FINDERS:
  match:
    # implicit receiver inside the model
    - "    find_all_by_email(email)"
    - "User.find_all_by_email(email)"
    - "User.find_last_by_email(email)"
    - "User.scoped_by_status(\"active\")"
    - "  owner.items.find_all_by_color_and_size(color, size)"
  no_match:
    - "  def self.find_all_by_status(status)"
    - "User.find_by_email(email)"
    - "User.find_by_email!(email)"
    - "User.find_by(email: email)"
    - "User.find_by_sql(sql)"
    - "User.where(email: email).last"

CACHE_DIGESTS_BACKPORT:
  match:
    - "gem 'cache_digests'"
    - "  gem \"cache_digests\", \"~> 0.3.1\""
    - "    CacheDigests::TemplateDigestor.digest(name, :html, lookup_context)"
    - "  CacheDigests.cache = ActiveSupport::Cache::MemoryStore.new"
  no_match:
    - "gem 'cache_digest'"
    - "# gem 'cache_digests'"
    - "gem 'cache_digests' unless NextRails.next?"
    - "  ActionView::Digestor.digest(name: name, finder: lookup_context)"
    - "  config.action_view.cache_template_loading = true"
    - "  <% cache [@post, 'v3'] do %>"

MULTI_JSON:
  match:
    # adapter setup and the decode alias also need the gem
    - "  MultiJson.use(:oj)"
    - "    data = MultiJson.decode(body)"
    - "    MultiJson.dump(payload)"
    - "  data = MultiJson.load(response.body, symbolize_keys: true)"
    - "require 'multi_json'"
    - "rescue MultiJson::ParseError => e"
  no_match:
    - "  payload.to_json"
    - "  JSON.parse(response.body)"
    - "  ActiveSupport::JSON.decode(str)"

# The pattern also spans up to four lines (a helper call whose confirm: sits
# on a continuation line after a trailing comma, never past %>). Fixtures are
# per line, so that multi-line shape is covered by the scanner, not by these
# fixtures. A bare `confirm:` line on its own is a no_match for that reason.
CONFIRM_OPTION:
  match:
    # button_tag and f.button converted confirm: on 4.0 too
    - "<%= button_tag \"Delete all\", confirm: \"Sure?\" %>"
    - "<%= f.button \"Go\", confirm: \"Sure?\" %>"
    # string keys were stringified and converted the same way
    - "<%= link_to \"Delete\", path, \"confirm\" => \"Sure?\" %>"
    - "<%= link_to \"Delete\", post_path(@post), method: :delete, confirm: \"Are you sure?\" %>"
    - "= link_to 'Remove', item_path(item), :confirm => 'Really remove?', :method => :delete"
    - "<%= button_to \"Destroy\", @post, method: :delete, confirm: t(\"posts.confirm_destroy\") %>"
    - "<%= submit_tag \"Save\", confirm: \"Save changes?\" %>"
    - "<%= f.submit \"Publish\", :confirm => \"Publish now?\" %>"
    - "<%= image_submit_tag \"go.png\", confirm: \"Continue?\" %>"
    - "<%= link_to \"Archive\", archive_path(@post), data: { method: :post }, confirm: \"Archive it?\" %>"
    - "= link_to \"Archive\", archive_path(@post), :data => { :confirm => \"Old\" }, :confirm => \"Archive it?\""
    - "<%= link_to \"Archive\", archive_path(@post), data: { a: { b: 1 } }, confirm: \"Archive it?\" %>"
    - "<%= link_to \"Archive\", archive_path(@post), 'data' => { method: :post }, confirm: \"Archive it?\" %>"
  no_match:
    # button_to's form: hash takes its own attributes
    - "<%= button_to \"Archive\", archive_path, form: { confirm: \"z\" } %>"
    - "<%= link_to \"Delete\", post_path(@post), method: :delete, data: { confirm: \"Are you sure?\" } %>"
    - "= link_to 'Remove', item_path(item), :data => { :confirm => 'Really remove?' }, :method => :delete"
    - "<%= button_to \"Destroy\", @post, \"data-confirm\" => \"Sure?\" %>"
    - "<%= link_to \"Confirm email\", confirm_email_path(token: @token) %>"
    - "<%= f.submit \"Save\", data: { disable_with: \"Saving...\", confirm: \"Save?\" } %>"
    - "<%= link_to \"Delete\", item, data: { title: \"#{item.name}\", confirm: \"Sure?\" } %>"
    - "<%= link_to \"Delete\", item, 'data' => { confirm: \"Sure?\" } %>"
    - "<%= link_to \"Delete\", item, :\"data\" => { :confirm => \"Sure?\" } %>"
    - "<%= link_to \"Delete\", item, data: { params: { id: 1 }, confirm: \"Sure?\" } %>"
    - "      confirm: \"Are you sure?\","
    - "<%= f.password_field :password_confirmation %>"
    - "<%= link_to \"Home\", root_path %> <%= render \"form\", options: { confirm: true } %>"

ABSTRACT_CONTROLLER_LAYOUTS:
  match:
    # ViewPaths moved with Layouts, and send(:include, ...) is common in hooks
    - "  include AbstractController::ViewPaths"
    - "  base.send(:include, AbstractController::Layouts)"
    - "  include AbstractController::Layouts"
    - "  include ::AbstractController::Layouts"
    - "    include AbstractController::Layouts # needed for layout \"pdf\""
    - "  include AbstractController::Rendering, AbstractController::Layouts"
    - "  include(AbstractController::Layouts)"
  no_match:
    - "  # include AbstractController::Layouts"
    - "  include ActionView::Layouts"
    - "  include(NextRails.next? ? ActionView::Layouts : AbstractController::Layouts)"
    - "  include AbstractController::Rendering"
    - "  include AbstractController::LayoutsHelper"

ACTS_AS_LIST_PRE_0_3:
  match:
    - "    acts_as_list (0.1.6)"
    - "    acts_as_list (0.2.0)"
    - "gem 'acts_as_list', '0.1.6'"
    - "gem \"acts_as_list\", \"~> 0.2.0\""
    - "gem 'acts_as_list', '~> 0.1.6'"
    - "gem 'acts_as_list', '< 0.3'"
    - "gem 'acts_as_list', '>= 0.1', '< 0.3'"
    - "      acts_as_list (~> 0.2.0)"
  no_match:
    # a commented-out pin, and a git ref that is not a release constraint
    - "# gem 'acts_as_list', '0.1.6'"
    - "gem 'acts_as_list', github: 'example/acts_as_list', ref: '0.1.4'"
    - "    acts_as_list (0.3.0)"
    - "    acts_as_list (0.7.7)"
    - "    acts_as_list (0.9.19)"
    - "    acts_as_list (1.0.4)"
    - "gem 'acts_as_list'"
    - "gem 'acts_as_list', '~> 0.7.7'"
    - "    active_admin-acts_as_list (0.0.8)"
    - "    acts_as_list_mongoid (0.2.5)"
    - "gem 'acts_as_list', '~> 0.1'"
    - "gem 'acts_as_list', '>= 0.2'"
    - "gem 'acts_as_list', '< 0.3.1'"
    - "      acts_as_list (>= 0.1)"

RELATION_ALL:
  # The pattern cannot tell a constant receiver from a relation, so
  # `Post.all` also matches. That hit is the replacement, not the problem;
  # triage each hit by its receiver.
  match:
    - "    Post.where(published: true).all.each do |post|"
    - "  @comments = @post.comments.all"
    - "    users = User.active.all"
    - "    records = scope.order(:created_at).all.sort_by!(&:id)"
    - "    Post.all"
    # Capybara without parentheses: only .all( right after the name is skipped.
    - "    rows = page.all \".row\""
  no_match:
    - "    Promise.all [a, b]"
    # Finder options: a separate change, and not the zero-argument call.
    - "    Post.where(published: true).all(limit: 5)"
    # Capybara's page.all takes a selector argument.
    - "    expect(page.all('.row').size).to eq 3"
    - "    return unless items.all? { |item| item.valid? }"
    - "    Post.all_published"
    - "    Post.where(published: true).to_a"

COUNT_MULTI_COLUMN_SELECT:
  # A hit is only a problem when the relation is later counted with no
  # argument. That caller is often on another line or in another file, so
  # the pattern flags the select and the triage traces the count.
  match:
    # symbols with digits or capitals, and a %i{} list
    - "    Post.select(:address_line1, :city).count"
    - "    Post.select(:ID, :Name).count"
    - "    Post.select(%i{id title}).count"
    - "    Post.select(\"title, version\").count"
    - "  scope :summary, -> { select('posts.id, posts.title') }"
    - "    Post.select(\"title\", \"version\")"
    - "    Post.select([:title, :version])"
    - "    Post.select(:title, :version)"
    # A table-qualified star: 4.1 runs COUNT(posts.*).
    - "    Post.joins(:author).select(\"posts.*\").count"
    - "  scope :with_author, -> { joins(:author).select(\"#{table_name}.*\") }"
    - "    Post.select(:id, \"title\")"
    - "    Post.select(%w[id title])"
    - "  scope :summary, -> { select \"id, title\" }"
  no_match:
    # Capybara's select with a from: field, and IO.select
    - "    select 'Canada', :from => 'Country'"
    - "    IO.select([reader, writer], nil, nil, 5)"
    - "    Post.select(:title).count"
    # A bare star becomes COUNT(*), which works on 4.1.
    - "    Post.select(\"*\").count"
    - "    Post.select(\"DISTINCT title\")"
    - "    Post.select(\"COUNT(*) AS total\")"
    - "    Post.select(\"title\").where(\"a, b\")"
    - "    items.select { |item| item.valid? }"
    # The lookbehind keeps the bare in-scope form while skipping longer names.
    - "    multiselect(\"title, version\")"
    # The ActionView select form helper, not a relation.
    - "<%= select(\"post\", \"person_id\", Person.all.collect { |p| [p.name, p.id] }) %>"
    - "  = f.select :category, :name"
    - "    IO.select([sock], nil, nil, 5)"

JOIN_DEPENDENCY_INTERNALS:
  match:
    - "    where(\"#{join.aliased_table_name}.account_id = #{join.parent_table_name}.account_id\")"
    - "  ActiveRecord::Associations::JoinDependency::JoinAssociation.send(:prepend, SoftDeleteJoin)"
    - "      def join_to(manager)"
    # An alias_method_chain patch: def join_to_with_soft_delete has no word
    # boundary after join_to, so the :join_to symbol is what catches it.
    - "        alias_method_chain :join_to, :soft_delete"
    - "        alias_method :join_to_without_soft_delete, :join_to"
    # Reopening the class inside class JoinDependency never spells the full name.
    - "      class JoinAssociation < JoinPart"
    - "    where(\"#{join.parent_table.name}.active = 1\")"
    - "    prefix = join.aliased_prefix"
    - "    tracker = join.join_dependency.alias_tracker"
  no_match:
    # a :join_to symbol outside alias_method is not the Active Record method
    - "    send(:join_to, relation)"
    # Commented-out code is excluded.
    - "  # def join_to(manager) moved to join_constraints in 4.1"
    # The 4.1 method name and the alias that survived are fine.
    - "      def join_constraints(foreign_table, foreign_klass, node, join_type, tables, scope_chain, chain)"
    - "    where(\"#{join.aliased_table_name}.deleted_at IS NULL\")"
    - "  def join_token"
    - "    self.parent_table_names = []"
    # Too common outside JoinAssociation to flag.
    - "    where(\"#{join.parent.aliased_table_name}.id IS NOT NULL\")"
    - "    self.join_type = :inner"
    - "  class JoinAssociationsController < ApplicationController"
    - "    record.join_token"

RECORD_NOT_FOUND_MESSAGE:
  match:
    # a primary key with capitals
    - "    expect(e.message).to eq \"Couldn't find User with UserID=5\""
    - "      expect(json[\"error\"]).to eq \"Couldn't find Post with id=999\""
    - "    assert_equal \"Couldn't find Admin::User with id=5\", error.message"
    - "      expect(response.body).to include(\"Couldn't find all Posts with IDs (1, 2)\")"
    # Single-quoted Ruby strings escape the apostrophe.
    - "      expect(e.message).to eq 'Couldn\\'t find Post with id=1'"
    - "      expect(body).to include('Couldn\\'t find all Posts with IDs (1, 2)')"
  no_match:
    # The 4.1 wording.
    - "      expect(json[\"error\"]).to eq \"Couldn't find Post with 'id'=999\""
    - "      expect(e.message).to eq 'Couldn\\'t find Post with \\'id\\'=1'"
    - "      expect(response.body).to include(\"Couldn't find all Posts with 'id': (1, 2)\")"
    # App-written message with spaces around the equals sign: not Rails text.
    - "    raise ActiveRecord::RecordNotFound, \"Couldn't find Invoice with external_ref = #{id}\""
    - "    expect { Post.find(999) }.to raise_error(ActiveRecord::RecordNotFound)"

DEPRECATED_FINDERS_AUTOREQUIRE:
  match:
    - "gem 'activerecord-deprecated_finders'"
    - "gem \"activerecord-deprecated_finders\", \"~> 1.0.4\""
    - "  gem 'activerecord-deprecated_finders', require: false"
    - "  gem 'activerecord-deprecated_finders', :require => false"
    - "gem 'activerecord-deprecated_finders', require: 'activerecord-deprecated_finders'"
    - "gem 'activerecord-deprecated_finders', \"1.0.4\" # require: 'active_record/deprecated_finders' later"
  no_match:
    # a # inside a git option is not a comment
    - "gem 'activerecord-deprecated_finders', github: 'example/fork#branch', require: 'active_record/deprecated_finders'"
    # (require: on a continuation line is also skipped; proved with pattern_lab.rb scan)
    - "gem 'activerecord-deprecated_finders', require: 'active_record/deprecated_finders'"
    - "gem \"activerecord-deprecated_finders\", \"~> 1.0.4\", require: \"active_record/deprecated_finders\""
    - "gem 'activerecord-deprecated_finders', :require => 'active_record/deprecated_finders'"
    - "# gem 'activerecord-deprecated_finders'"
    - "gem 'activerecord'"

UPDATE_ALL_WITH_CONDITIONS:
  # The multi-line shape (`update_all({\n a: 1\n}, {\n id: ids\n})`) matches only
  # in the whole-file scanner (detection-scripts/scan_patterns.rb); a line-based
  # search sees single-line calls only. Fixtures are single lines.
  match:
    # paren-less calls, as in the 4.0 hop's UPDATE_ALL_TWO_ARG
    - "    Item.update_all \"price = 0\", \"color = 'red'\""
    - "Item.update_all({ price: 0 }, { color: \"red\" })"
    - "Item.update_all(\"price = 0\", [\"color = ?\", color])"
    - "Item.update_all('price = 0', 'color = \"red\"')"
    - "Item.update_all([\"price = ?\", price], id: ids)"
    - "Item.update_all(updates, id: ids)"
    - "  scope.update_all(attributes, key_column => key)"
    - "Item.update_all(self.class.reset_values, { id: ids }, limit: 10)"
    - "Item.update_all({ price: 0 }, nil, order: :id, limit: 5)"
  no_match:
    - "  def update_all(updates, conditions = nil)"
    - "  # Item.update_all(updates, conditions)"
    - "    Item.update_all(price:0, color: \"blue\")"
    - "Item.where(color: \"red\").update_all(price: 0)"
    - "Item.update_all(price: 0, color: \"blue\")"
    - "Item.update_all(:price => 0, :color => \"blue\")"
    - "Item.update_all(\"price = 0, color = 'blue'\")"
    - "Item.update_all([\"price = ?, color = ?\", 0, \"blue\"])"
    - "Item.update_all(tags: [\"a\", \"b\"].to_yaml)"
    - "Item.update_all(updates.join(\",\"))"
    - "Item.update_all(price:0, color: \"blue\")"
    - "Item.where(id: ids).update_all(updates)"

CALCULATE_FINDER_OPTIONS:
  # A call split across lines (`count(:id,\n  conditions: c)`) matches only in
  # the whole-file scanner (detection-scripts/scan_patterns.rb); a line-based
  # search sees single-line calls only. Fixtures are single lines.
  match:
    - "    Item.sum(:price, extend: PriceExtension)"
    - "Item.count(conditions: { color: \"red\" })"
    - "Item.count(:id, :conditions => [\"color = ?\", color])"
    - "Item.maximum(:price, group: :color)"
    - "owner.items.sum(:price, joins: :orders, conditions: { paid: true })"
    - "Item.minimum(\"items.price\", joins: \"LEFT JOIN orders ON orders.item_id = items.id\")"
    - "Item.count(select: \"DISTINCT items.owner_id\")"
    - "Item.average(:price, :include => :owner)"
    - "Item.calculate(:sum, :price, having: \"SUM(price) > 10\")"
    - "Item.count(:all, group: :color)"
    - "Item.sum(\"price\", :limit => 5)"
  no_match:
    # a finder key inside a nested call's arguments
    - "    stats.count(build_scope(select: :id))"
    - "Item.where(color: \"red\").count"
    - "Item.group(:color).maximum(:price)"
    - "Item.count(:owner_id, distinct: true)"
    - "Item.count(\"DISTINCT items.owner_id\")"
    - "Item.sum(:order_total)"
    - "Item.count(:group_id)"
    - "Item.maximum(:price, sub_group: :color)"
    - "[1, 2, 3].sum"
    # Service objects that take keyword arguments with the same names.
    - "TaxCalculator.calculate(order: order)"
    - "Shipping.calculate(from: origin, to: dest)"
    - "Stats.count(limit: 10)"

DISTINCT_COUNT_OPTION:
  # A call split across lines (`count(:owner_id,\n  distinct: true)`) matches
  # only in the whole-file scanner (detection-scripts/scan_patterns.rb); a
  # line-based search sees single-line calls only. Fixtures are single lines.
  match:
    - "Item.count(:owner_id, distinct: true)"
    - "Item.count(:owner_id, :distinct => true)"
    - "  unique_owners: scope.count(:owner_id, distinct: true),"
    - "Item.calculate(:count, :owner_id, distinct: true)"
    - "Item.count(:owner_id, conditions: { color: \"red\" }, distinct: true)"
  no_match:
    - "Item.distinct.count(:owner_id)"
    - "Item.uniq.count(:owner_id)"
    - "Item.count(\"DISTINCT items.owner_id\")"
    - "Item.count(select: \"distinct items.owner_id\")"
    - "Item.count(:owner_id, distinct: false)"
    - "Item.count(:owner_id, not_distinct: true)"
    - "Item.where(distinct: true).count"

ASSOCIATION_CONDITIONS:
  match:
    - "  has_many :active_items, class_name: \"Item\", conditions: { active: true }"
    - "  has_one :primary_address, :class_name => \"Address\", :conditions => \"primary = 1\""
    - "  belongs_to :author, class_name: \"User\", conditions: [\"deleted_at IS NULL\"]"
    - "  has_and_belongs_to_many :tags, conditions: { visible: true }"
    - "  has_many :items, conditions: proc { [\"account_id = ?\", account_id] }"
  no_match:
    - "  has_many :active_items, -> { where(active: true) }, class_name: \"Item\""
    - "  has_many :items, ->(owner) { where(account_id: owner.account_id) }"
    - "  has_many :items, before_add: :check_conditions"
    # not an association: the validator's own :conditions option is still valid at 4.1
    - "  validates_uniqueness_of :email, conditions: -> { where(deleted_at: nil) }"

ASSOCIATION_ORDER:
  match:
    - "  has_many :items, :order => 'position ASC'"
    - "  has_one :latest_comment, class_name: \"Comment\", order: \"created_at DESC\""
    - "  has_and_belongs_to_many :tags, order: :name"
  no_match:
    - "  has_many :items, -> { order('position ASC') }"
    - "  has_one :latest_comment, -> { order(created_at: :desc) }, class_name: \"Comment\""
    # underscore before "order" (sort_order) must not trip the [^_] guard
    - "  has_many :items, sort_order: 'asc'"
    # an association named order is not the option
    - "  belongs_to :order, touch: true"
    - "  has_many :orders, dependent: :destroy"

ASSOCIATION_UNIQ:
  match:
    - "  has_many :tags, through: :taggings, uniq: true"
    - "  has_and_belongs_to_many :roles, :uniq => true"
    - "  has_one :primary_tag, through: :primary_tagging, uniq: true"
  no_match:
    - "  has_many :tags, -> { distinct }, through: :taggings"
    - "  has_many :tags, -> { uniq }, through: :taggings"
    - "  has_many :unique_visits, dependent: :destroy"

ASSOCIATION_READONLY:
  match:
    - "  has_many :tags, through: :taggings, readonly: false"
    - "  has_many :line_items, :through => :orders, :readonly => true"
    - "  has_and_belongs_to_many :roles, readonly: true"
    - "  belongs_to :account, readonly: true"
    - "  has_one :profile, :readonly => true"
  no_match:
    - "  has_many :tags, -> { readonly }, through: :taggings"
    - "  has_many :tags, -> { readonly(false) }, through: :taggings"
    - "  has_many :tags, through: :taggings"

# The scanner matches file content, so a body on the next line
# (`scope :active,` then `where(...)` below it) is caught there; a fixture
# line can only show the single-line shapes.
SCOPE_WITHOUT_LAMBDA:
  match:
    - "  scope :active, where(active: true)"
    - "  scope :recent, order('created_at DESC')"
    - "  scope :with_author, joins(:author).where(authors: { active: true })"
    - "  scope :sorted, scoped.order(:name)"
    - "  scope :published, :conditions => { published: true }"
    - "  scope :visible, conditions: { hidden: false }"
    - "  scope(:active, where(active: true))"
    - "  scope( :recent, order('created_at DESC'))"
    - "  scope :active, Post.where(active: true)"
    # a String does not respond to call: 4.0 returned it, 4.1 raises
    - "  scope :active, 'active = 1'"
    - "  scope :active, \"active = 1\""
  no_match:
    - "  scope :active, -> { where(active: true) }"
    - "  scope :active,->{ where(active: true) }"
    - "  scope :by_flag, ->(flag) { where(active: flag) }"
    - "  scope :active, lambda { where(active: true) }"
    - "  scope :active, proc { where(active: true) }"
    - "  scope :active, Proc.new { where(active: true) }"
    - "  scope :search, (proc { |q| where('name LIKE ?', q) })"
    - "  scope(:active, -> { where(active: true) })"
    - "  scope :active, method(:active_scope)"
    - "  scope :active, ACTIVE"
    - "  scope :active, Scopes::ACTIVE # shared lambda"
    - "  scope(:active, ACTIVE)"
    - "  # scope :archived, where(archived: true)"
    - "  default_scope { where(deleted_at: nil) }"
    - "  def self.active; where(active: true); end"

# The scanner matches file content, so `default_scope(` with the lambda on
# the next line is still skipped there; a fixture line can only show the
# single-line shapes.
DEFAULT_SCOPE_WITHOUT_BLOCK:
  match:
    - "  default_scope where(deleted_at: nil)"
    - "  default_scope order('created_at DESC')"
    - "  default_scope(where(active: true))"
    - "  default_scope :order => 'name'"
    - "  default_scope order: 'name'"
    - "  default_scope includes(:author)"
    # no argument and no block: 4.1 raises on nil too
    - "  default_scope # set in the concern"
    - "  default_scope"
  no_match:
    # a constant or Method object that responds to call
    - "  default_scope ACTIVE_SCOPE"
    - "  default_scope method(:active_scope)"
    - "  default_scope { where(deleted_at: nil) }"
    - "  default_scope do"
    - "  default_scope -> { order(:name) }"
    - "  default_scope(-> { order(:name) })"
    - "  default_scope lambda { order(:name) }"
    - "  default_scope proc { order(:name) }"
    - "  default_scope Proc.new { order(:name) }"
    - "  def self.default_scope"
    - "  # default_scope where(deleted_at: nil)"
    - "  # Joining :user applies the default_scope, so filter in SQL"
    - "  self.default_scopes = []"
    - "  Model.unscoped { build_default_scope }"

SCOPE_NAME_COLLISION:
  match:
    - "  scope :none, -> { where('1 = 0') }"
    - "  scope :all, -> { where(archived: false) }"
    - "  scope :first, -> { order(:id).limit(1) }"
    - "  scope :count, -> { select('COUNT(*)') }"
    - "  scope :new, -> { where(state: 'new') }"
    - "  scope :distinct, -> { select('DISTINCT name') }"
    - "    scope :where, lambda { |*args| super(*args) }"
    - "  scope :public, -> { where(public: true) }"
    - "  scope :private, -> { where(public: false) }"
    - "  scope :name, -> { order(:name) }"
    - "  scope :parent, -> { where(parent_id: nil) }"
    - "  scope(:none, -> { where('1 = 0') })"
    # any other Querying method on Base is rejected too
    - "  scope :uniq, -> { select('DISTINCT name') }"
    - "  scope :readonly, -> { where(locked: true) }"
    - "  scope :lock, -> { where(locked: true) }"
    - "  scope :from, ->(t) { where('created_at >= ?', t) }"
    - "  scope :exists?, -> { where.not(id: nil) }"
  no_match:
    - "  scope :none_assigned, -> { where(assignee_id: nil) }"
    - "  scope :allowed, -> { where(allowed: true) }"
    - "  scope :newest, -> { order(created_at: :desc) }"
    - "  scope :active, -> { where(active: true) }"
    - "  scope :recent_first, -> { order(created_at: :desc) }"
    - "  scope :published, -> { where(published: true) }"
    - "  scope :named, ->(q) { where(name: q) }"
    - "  scope :public_posts, -> { where(public: true) }"
    - "  scope :parents, -> { where(parent_id: nil) }"
    - "  scope :name?, -> { where.not(name: nil) }"
    - "  scope :limit!, -> { limit(1) }"
    - "  scope :locked, -> { where(locked: true) }"
    - "  scope :uniqueness, -> { x }"
    - "  Post.none"
    - "  # scope :none, -> { where('1 = 0') }"
    - "  def self.none; where('1 = 0'); end"

FINDER_SQL:
  match:
    - "  has_many :comments, :finder_sql => 'SELECT * FROM comments WHERE approved = 1'"
    - "  has_many :comments, finder_sql: proc { \"SELECT * FROM comments WHERE post_id = #{id}\" }"
    - "  has_many :tags, counter_sql: 'SELECT COUNT(*) FROM tags'"
    - "  has_and_belongs_to_many :groups, :finder_sql => 'SELECT * FROM groups'"
    - "    :counter_sql => 'SELECT COUNT(*) FROM comments WHERE approved = 1',"
  no_match:
    - "  has_many :comments, -> { where(approved: true) }"
    - "  # has_many :comments, :finder_sql => 'SELECT * FROM comments'"
    - "  Comment.find_by_sql('SELECT * FROM comments')"
    - "  Comment.count_by_sql('SELECT COUNT(*) FROM comments')"
    - "  options[:finder_sql]"

BELONGS_TO_DEPENDENT_AUTO_INVERSE:
  match:
    - "  belongs_to :document, dependent: :destroy"
    - "  belongs_to :document, :dependent => :destroy"
    - "  belongs_to :document, touch: true, dependent: :destroy"
    # an explicit inverse keeps the in-memory record too
    - "  belongs_to :document, inverse_of: :attachment, dependent: :destroy"
  no_match:
    # dependent: :delete runs no callbacks, so it cannot close the loop.
    - "  belongs_to :document, dependent: :delete"
    # The has_one side holds the after_destroy; the regex flags the belongs_to side.
    - "  has_one :attachment"
    - "  has_one :attachment, dependent: :destroy"
    - "  after_destroy :destroy_attachment"
    - "  belongs_to :document"
    # options that turn automatic inverse detection off: 4.1 changes nothing
    - "  belongs_to :content, polymorphic: true, dependent: :destroy"
    - "  belongs_to :document, foreign_key: :doc_id, dependent: :destroy"
    - "  belongs_to :document, :foreign_key => :doc_id, :dependent => :destroy"
    - "  belongs_to :document, inverse_of: false, dependent: :destroy"
    - "  belongs_to :document, -> { where(active: true) }, dependent: :destroy"
```

## File: rails-upgrade/detection-scripts/patterns/rails-41-patterns.yml
size: 61259
sha: ac0fb94a5b92458cce586a1073111336827752f9
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-41-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-41-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-42-patterns.expectations.yml
size: 28149
sha: aa8e36f3af2084cd838d411c252bbcc3945a19f3
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-42-patterns.expectations.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-42-patterns.expectations.yml

## File: rails-upgrade/detection-scripts/patterns/rails-42-patterns.yml
size: 49908
sha: 430788e1cd3ac9490643f84de9fbce0c55b3d45f
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-42-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-42-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-50-patterns.expectations.yml
size: 1921
sha: 10f247e303f3376d8fa427b1418f6c5108343315
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-50-patterns.expectations.yml

```text
# Fixture expectations for rails-50-patterns.yml.
#
# Keyed by variable_name. See rails-40-patterns.expectations.yml for the format.
# A fixture may span lines ("  false\n  end"): the pattern is matched against
# the string, the same way scan_patterns.rb matches file content.
#
# Run with:
#   bin/test-patterns rails-upgrade/detection-scripts/patterns/rails-50-patterns.yml

CALLBACK_HALT:
  match:
    - "    return false if locked?"
    - "    return false"
    # a bare false as the method's last line
    - "    false\n  end"
    - "      false\n    end\n  end"
    - "    false # stop the save\n  end"
    # a bare false ending a branch, and a trailing modifier
    - "      false\n    else\n      true\n    end"
    - "      false\n    elsif draft?"
    - "    false\n  rescue StandardError"
    - "    false if archived?\n  end"
    - "    false unless valid_state? # halt\n  end"
    # one-line blocks
    - "  before_save { false if archived? }"
    - "  before_destroy(if: :protected?) { false }"
  no_match:
    - "    # return false to stop the save"
    - "  # false\n  end"
    - "    throw :abort if locked?"
    - "    self.active = false\n  end"
    - "    false_positive_count\n  end"
    - "    false\n    log_it\n  end"
    - "    false if archived?\n    log_it\n  end"
    - "    enabled = false"
    - "  before_save { self.flag = true }"
    - "  after_save { false }"
    - "    return falsey_value"

RUBY_VERSION:
  # Rails 5.0 requires Ruby >= 2.2.2 (rails gemspec). Lines come from the
  # Gemfile, .ruby-version and .tool-versions.
  match:
    - "ruby \"2.1.10\""
    - "ruby '2.2.1'"
    - "ruby \"~> 2.1.5\""
    - "ruby '~> 1.9'"
    - "2.1.10"
    - "ruby-2.2.0"
    - "ruby 2.0.0"
    - "1.9.3"
  no_match:
    - "ruby \"2.2.2\""
    - "ruby \"~> 2.2.1\""
    - "ruby \"~> 2.1\""
    - "ruby \">= 2.0\""
    - "2.2.10"
    - "2.3.8"
    - "ruby 2.4.10"
    - "gem \"rack\", \"2.1.4\""
```

## File: rails-upgrade/detection-scripts/patterns/rails-50-patterns.yml
size: 8277
sha: be51efb802c31be43905c90287fe28a058863737
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-50-patterns.yml

```text
version: "5.0"
description: "Breaking change patterns for Rails 4.2 → 5.0 upgrade"

upgrade_findings:
  high_priority:
    - name: "Ruby version below 2.2.2"
      kind: "breaking"
      pattern: "^\\s*(?:ruby\\s*\\(?\\s*[\"'](?:=\\s*|~>\\s*(?=\\d+\\.\\d+\\.\\d))?|ruby-|ruby\\s+)?(?:1\\.\\d+|2\\.[01])(?:\\.\\d+)*(?![\\d.])|^\\s*(?:ruby\\s*\\(?\\s*[\"'](?:=\\s*)?|ruby-|ruby\\s+)?2\\.2\\.[01](?![\\d.])|^\\s*ruby\\s*\\(?\\s*[\"']~>\\s*1\\.\\d+(?![\\d.])"
      exclude: ""
      search_paths:
        - "Gemfile"
        - ".ruby-version"
        - ".tool-versions"
      explanation: "Rails 5.0 requires Ruby 2.2.2 or newer. Flags a Ruby below 2.2.2 in .ruby-version or .tool-versions, and a Gemfile `ruby` line that rules it out (an exact version, or a `~>` whose upper bound is below 2.2.2); a requirement that still allows 2.2.2, such as `>=`, is not flagged"
      fix: "Upgrade Ruby to 2.2.2+ (2.3+ recommended)"
      variable_name: "RUBY_VERSION"

    - name: "Models inheriting from ActiveRecord::Base"
      kind: "migration"
      pattern: "class\\s+\\w+\\s*<\\s*ActiveRecord::Base"
      exclude: "ApplicationRecord"
      search_paths:
        - "app/models/"
      explanation: "Rails 5.0 introduces ApplicationRecord as the base class for all models"
      fix: "Create app/models/application_record.rb and change all models to inherit from ApplicationRecord"
      variable_name: "ACTIVERECORD_BASE"

    - name: "belongs_to without optional: true"
      kind: "migration"
      pattern: "belongs_to\\s+:\\w+"
      exclude: "optional:"
      search_paths:
        - "app/models/"
      explanation: "Rails 5.0 makes belongs_to required by default. Review each match to determine if the association can be nil"
      fix: "Add optional: true only to belongs_to associations that can legitimately be nil. Leave required ones as-is"
      variable_name: "BELONGS_TO_REQUIRED"

    - name: "protected_attributes gem"
      kind: "breaking"
      pattern: "gem.*['\"]protected_attributes['\"]"
      exclude: ""
      search_paths:
        - "Gemfile"
      explanation: "The protected_attributes gem is not compatible with Rails 5.0. You must migrate to Strong Parameters"
      fix: "Remove protected_attributes gem, remove attr_accessible from models, add *_params methods to controllers"
      variable_name: "PROTECTED_ATTRIBUTES"

    - name: "attr_accessible in models"
      kind: "breaking"
      pattern: "attr_accessible"
      exclude: ""
      search_paths:
        - "app/models/"
      explanation: "attr_accessible is removed in Rails 5.0. Use Strong Parameters in controllers instead"
      fix: "Remove attr_accessible from models and add *_params methods to controllers"
      variable_name: "ATTR_ACCESSIBLE"

    - name: "Parameters used as hash"
      kind: "breaking"
      pattern: "params(\\[.*\\])?\\.(slice|except|merge|symbolize_keys|to_hash)\\b"
      exclude: ""
      search_paths:
        - "app/controllers/"
        - "app/"
      explanation: "params is now ActionController::Parameters, not HashWithIndifferentAccess. Hash methods may not work"
      fix: "Call .permit and .to_h before using hash methods on params"
      variable_name: "PARAMS_AS_HASH"

  medium_priority:
    - name: "Callback returning false to halt"
      kind: "deprecation"
      pattern: "\\breturn\\s+false\\b|^[ \\t]*false(?:[ \\t]+(?:if|unless)\\b[^\\n]*)?(?=[ \\t]*(#[^\\n]*)?\\n\\s*(end|else|elsif|when|rescue|ensure)\\b)|\\bbefore_(save|create|update|destroy|validation)\\b[^\\n{]*\\{[^}\\n]*\\bfalse\\b"
      exclude: "\\A\\s*#"
      search_paths:
        - "app/models/"
      explanation: "Rails 5.0 stops halting an Active Record or Active Model callback chain on a `false` return: with `ActiveSupport.halt_callback_chains_on_return_false = false` (the 5.0 default for new apps, and the only behavior from 5.1 on, where the setting is ignored) the save or destroy goes ahead, and on the upgrade setting of `true` it still halts but warns. Only a before_* callback that yields `false` on purpose needs a fix. The pattern flags the three shapes that yield it: `return false`, a bare `false`, alone or with a trailing `if`/`unless`, ending a method or a branch (the line before `end`, `else`, `elsif`, `when`, `rescue` or `ensure`), and a one-line `before_* { ... false ... }` block. It cannot see a callback whose last expression merely evaluates to false (`!locked?`, `errors.add(...) && false`), so read each before_* callback's last line too. Controllers are not searched: `before_action` halted on `response_body` in 3.2 and 4.x and on `performed?` from 5.0 (AbstractController::Callbacks terminator), so a `false` return from a controller filter never stopped the action on any version. Callbacks declared on plain Active Model objects outside app/models/ are not searched either"
      fix: "In a before_* callback, replace the halting `false` with `throw :abort` (`return false` becomes `throw :abort`, a bare trailing `false` becomes `throw :abort`). `throw :abort` raises UncaughtThrowError on 4.2, so on a dual-boot app branch it: `NextRails.next? ? throw(:abort) : false`. A match in a method that is not registered as a before_* callback is not a finding. A controller filter that relied on returning false never halted; make it `render` or `redirect_to` to stop the action"
      variable_name: "CALLBACK_HALT"

    - name: "assigns in tests"
      kind: "breaking"
      pattern: "assigns\\(:"
      exclude: ""
      search_paths:
        - "test/"
        - "spec/"
      explanation: "assigns and assert_template are extracted to the rails-controller-testing gem in Rails 5.0"
      fix: "Add gem 'rails-controller-testing' to Gemfile test group"
      variable_name: "ASSIGNS_IN_TESTS"

    - name: "assert_template in tests"
      kind: "breaking"
      pattern: "assert_template"
      exclude: ""
      search_paths:
        - "test/"
        - "spec/"
      explanation: "assert_template is extracted to the rails-controller-testing gem in Rails 5.0"
      fix: "Add gem 'rails-controller-testing' to Gemfile test group"
      variable_name: "ASSERT_TEMPLATE"

    - name: "ActionDispatch::Http::UploadedFile in tests"
      kind: "migration"
      pattern: "ActionDispatch::Http::UploadedFile"
      exclude: ""
      search_paths:
        - "test/"
        - "spec/"
      explanation: "Use Rack::Test::UploadedFile instead of ActionDispatch::Http::UploadedFile in Rails 5.0"
      fix: "Replace with Rack::Test::UploadedFile.new(file_path, content_type)"
      variable_name: "UPLOAD_FILE_TEST"

    - name: "redirect_to :back deprecated"
      kind: "deprecation"
      pattern: "redirect_to\\s+:back\\b"
      exclude: ""
      search_paths:
        - "app/controllers/"
      explanation: "Rails 5.0 deprecates redirect_to :back (emits a deprecation warning). It is removed outright in Rails 5.1, so fix all call sites now to avoid a runtime break on the next hop"
      fix: "Replace with redirect_back(fallback_location: root_path). Pass any flash/notice options as keyword args: redirect_back(fallback_location: root_path, notice: 'Done!')"
      variable_name: "REDIRECT_TO_BACK_DEPRECATED"

    - name: "rake commands in scripts or docs"
      kind: "migration"
      pattern: "\\brake\\s+(db:|test|routes|assets:|secret)"
      exclude: ""
      search_paths:
        - "bin/"
        - "scripts/"
        - "Rakefile"
        - "lib/tasks/"
      explanation: "Rails 5.0 prefers 'rails' command over 'rake' for db, test, routes, etc."
      fix: "Replace 'rake' with 'rails' for db:migrate, test, routes, and other Rails commands"
      variable_name: "RAKE_COMMANDS"

dependencies:
  rails-controller-testing:
    check: true
    gem_name: "rails-controller-testing"
    message: "Required if tests use assigns() or assert_template"
    url: "https://github.com/rails/rails-controller-testing"

  test_unit:
    check: false
    gem_name: "test-unit"
    message: "Required if you see 'cannot load such file -- test/unit/assertions' after upgrading Ruby"
    url: "https://github.com/test-unit/test-unit"

  rails_upgrader:
    check: false
    gem_name: "rails_upgrader"
    message: "Helps automate Strong Parameters migration from attr_accessible"
    url: "https://github.com/fastruby/rails_upgrader"
```

## File: rails-upgrade/detection-scripts/patterns/rails-51-patterns.expectations.yml
size: 4337
sha: 46ab595e5e33786bba99fa67d4002ab7e47d5592
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-51-patterns.expectations.yml

```text
# Fixture expectations for rails-51-patterns.yml.
#
# Keyed by variable_name (matching the entries in rails-51-patterns.yml). For
# each pattern you cover, list:
#   match     - lines the pattern MUST flag (the real breaking-change shapes)
#   no_match  - lines it MUST NOT flag (safe code + known false-positive traps)
#
# A line is "flagged" when the entry's `pattern` regex matches it AND the
# entry's `exclude` regex (when present) does not.
#
# Run with:
#   bin/test-patterns rails-upgrade/detection-scripts/patterns/rails-51-patterns.yml

USE_TRANSACTIONAL_FIXTURES:
  match:
    - "  self.use_transactional_fixtures = true"
    - "ActiveSupport::TestCase.use_transactional_fixtures = false"
  no_match:
    # rspec-rails keeps its own RSpec setting of this name and maps it to
    # use_transactional_tests, so spec/rails_helper.rb is fine on 5.1.
    - "  config.use_transactional_fixtures = true"
    - "  self.use_transactional_tests = true"

FILTER_METHODS:
  match:
    - "  before_filter :authenticate_user!"
    - "  skip_before_filter :verify_authenticity_token, only: :create"
    - "  skip_filter :require_login"
    - "  around_filter :wrap_in_transaction"
    - "  prepend_before_filter :set_locale"
    - "  append_after_filter :log"
  no_match:
    - "  before_action :authenticate_user!"
    - "  skip_before_action :verify_authenticity_token"
    - "  config.filter_parameters += [:password]"
    - "  add_filter { |line| line }"
    - "  before_filters = []"

FILTER_STRING_CONDITIONS:
  match:
    - "  before_action :require_guest, if: 'guest?'"
    - "  before_action :require_guest, unless: \"admin?\""
    # Hash-rocket form: a leading \b before `:if` never matched here.
    - "  before_filter :require_guest, :if => 'guest?'"
    - "  skip_before_action :authenticate, :unless => \"api?\""
  no_match:
    - "  before_action :require_guest, if: :guest?"
    - "  before_action :require_guest, if: -> { guest? }"
    - "  before_action :require_guest, :if => :guest?"
    - "  before_action :x, notify: 'y'"

SET_CALLBACK_STRING_CONDITIONS:
  match:
    - "  set_callback :save, :before, :x, if: 'y?'"
    # Hash-rocket form: a leading \b before `:if` never matched here.
    - "  set_callback :save, :before, :x, :if => 'y?'"
    - "  skip_callback :validate, :before, :check, unless: \"new_record?\""
  no_match:
    - "  set_callback :save, :before, :x, if: :y?"
    - "  set_callback :save, :before, :x, :if => -> { y? }"
    - "  run_callbacks :save"

RELATION_UNIQ:
  match:
    - "  User.where(active: true).uniq"
    - "  scope :tagged, -> { joins(:tags).uniq }"
    - "  Post.uniq.pluck(:author_id)"
    - "  relation.uniq!"
  no_match:
    - "  ids.map(&:to_i).uniq"
    - "  tags.pluck(:name).uniq"
    - "  User.distinct"
    - "  validates :email, uniqueness: true"

SECRETS_STRING_KEYS:
  match:
    - "Rails.application.secrets[:smtp]['address']"
    - "Rails.application.secrets[\"smtp\"][\"address\"]"
  no_match:
    - "Rails.application.secrets[:smtp][:address]"
    # Top-level keys go through OrderedOptions#[], which calls to_sym.
    - "Rails.application.secrets['api_key']"

SECRETS_METHOD_ACCESSOR_STRING_KEYS:
  match:
    - "Rails.application.secrets.smtp['address']"
  no_match:
    - "Rails.application.secrets.smtp[:address]"
    - "Rails.application.secrets.api_key"

PARAMS_PARSER_ERROR:
  match:
    - "  rescue_from ActionDispatch::ParamsParser::ParseError, with: :bad_json"
    - "  rescue ActionDispatch::ParamsParser::ParseError => e"
  no_match:
    - "  rescue ActionDispatch::Http::Parameters::ParseError => e"

LOCK_BANG_DEPRECATION:
  match:
    - "  account.lock!"
    - "  account.lock!(\"FOR UPDATE NOWAIT\")"
  no_match:
    # with_lock calls lock! too and warns the same way, but the pattern
    # does not flag it.
    - "  account.with_lock do"
    - "  Account.lock.find(id)"

QUOTED_ID_DEPRECATION:
  match:
    - "  def quoted_id"
    - "  def quoted_id # :nodoc:"
  no_match:
    - "  def quoted_identifier"
    - "  record.quoted_id"

HWIA_NEW_FROM_HASH_COPYING_DEFAULT:
  match:
    - "  ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default(hash)"
    - "  HashWithIndifferentAccess.new_from_hash_copying_default(opts)"
  no_match:
    - "  ActiveSupport::HashWithIndifferentAccess.new(hash)"
    - "  hash.with_indifferent_access"
```

## File: rails-upgrade/detection-scripts/patterns/rails-51-patterns.yml
size: 15321
sha: 85636e5d1b88b8fceddd539b91b59bcce4085bac
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-51-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-51-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-52-patterns.expectations.yml
size: 5116
sha: 77bc8025da9af6c892bf932bbd76e9bb85c3e537
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-52-patterns.expectations.yml

```text
# Fixture expectations for rails-52-patterns.yml.
#
# Keyed by variable_name. `match` lines the pattern MUST flag, `no_match`
# lines it MUST NOT flag (a per-line grep + grep -v).
#
# Run with:
#   bin/test-patterns rails-upgrade/detection-scripts/patterns/rails-52-patterns.yml

DYNAMIC_ROUTE_SEGMENTS:
  # A :controller or :action segment inside a quoted route path. Hash keys
  # (controller: 'x', :action => 'y') are options, not segments.
  match:
    - "  get ':controller(/:action(/:id))'"
    - "  match 'admin/:controller/:action', via: :get"
    - "  get 'reports/:action', controller: 'reports'"
    - "  get \"/:controller/:id\""
    - "  get '(:controller)(/:action)'"
  no_match:
    - "  get 'posts', controller: 'posts', action: :index"
    - "  match 'posts' => 'posts#index', :controller => 'posts', :action => 'index'"
    - "  get 'steps/:action_name', to: 'wizard#show'"
    - "  get ':controller_id/show', to: 'a#b'"
    # A hash key right after ( is an option, not a segment
    - "  scope(:controller => 'admin') do"
    - "  constraints(:action => /show/) do"

CLASS_NAME_CONSTANT:
  # A constant passed to class_name raises ArgumentError in 5.2. A string,
  # or Foo.name / Foo.to_s, is fine.
  match:
    - "  belongs_to :owner, class_name: User"
    - "  has_many :items, class_name: Billing::Item, foreign_key: :order_id"
    - "  has_many :items, :class_name => Item"
  no_match:
    - "  belongs_to :owner, class_name: 'User'"
    - "  belongs_to :owner, class_name: \"User\""
    - "  belongs_to :owner, class_name: User.name"
    - "  has_many :items, class_name: Billing::Item.to_s"
    - "  has_many :items, :class_name => 'Item'"

ERROR_ON_IGNORED_ORDER_OR_LIMIT:
  match:
    - "  config.active_record.error_on_ignored_order_or_limit = true"
  no_match:
    - "  config.active_record.error_on_ignored_order = true"

HALT_CALLBACK_CHAINS_ON_RETURN_FALSE:
  match:
    - "ActiveSupport.halt_callback_chains_on_return_false = false"
    - "  config.active_support.halt_callback_chains_on_return_false = false"
  no_match:
    - "  throw :abort"

CALLBACK_STRING_CONDITIONS:
  # A string (or array of strings) passed to if: / unless: raises
  # ArgumentError in 5.2 for every ActiveSupport callback.
  match:
    - "  before_save :normalize, if: 'name_changed?'"
    - "  after_commit :notify, on: :create, unless: \"skip_notify\""
    - "  before_action :authenticate, if: 'request.format.json?'"
    - "  skip_before_action :verify_authenticity_token, :if => 'api_request?'"
    - "  validates :email, presence: true, if: 'active?'"
    - "  validates_presence_of :email, :unless => 'guest?'"
    - "  validate :check_limits, if: ['active?', 'paid?']"
    - "  set_callback :save, :before, :stamp, if: 'stamp?'"
  no_match:
    - "  before_save :normalize, if: :name_changed?"
    - "  before_action :set_format, if: -> { params[:format] == 'json' }"
    - "  validates :email, presence: { message: 'is required' }, if: :active?"
    - "  after_save :sync, if: :sync? # was if: 'sync?'"
    - "  # before_save :normalize, if: 'name_changed?'"

EVENTED_REDIS_ADAPTER:
  match:
    - "  adapter: evented_redis"
    - "ActionCable::SubscriptionAdapter::EventedRedis.em_redis_connector = ->(config) { EM::Hiredis.connect(config[:url]) }"
  no_match:
    - "  adapter: redis"
    - "  channel_prefix: evented_redis_app"

ERUBIS_HANDLER:
  # Only the Rails handler constants; the erubis gem itself is not a Rails change.
  match:
    - "class LegacyHandler < ActionView::Template::Handlers::Erubis"
    - "ActionView::Template::Handlers::ERB.erb_implementation = ActionView::Template::Handlers::ERB::Erubis"
  no_match:
    - "class CustomHandler < ActionView::Template::Handlers::ERB::Erubi"
    - "Erubis::Eruby.new(template).result(binding)"

QUOTED_ID_METHOD:
  match:
    - "  def quoted_id"
    - "  sql = \"owner_id = #{owner.quoted_id}\""
  no_match:
    - "  def quoted_identifier"
    - "  where(owner_id: owner.id)"

CONNECTION_VERIFY_ARGUMENTS:
  # 5.2 defines connection verify! with no parameters.
  match:
    - "  ActiveRecord::Base.connection.verify!(0)"
    - "  ActiveRecord::Base.connection.verify! 5"
  no_match:
    - "  ActiveRecord::Base.connection.verify!"
    - "  ActiveRecord::Base.connection.verify! if defined?(ActiveRecord)"
    - "  cookies.signed.verify(token)"
    - "  expect(conn).to receive(:verify!).with(no_args)"

LOCK_BANG_UNPERSISTED:
  # Every lock! / with_lock call site; the audit decides whether the record
  # has unsaved changes at that point.
  match:
    - "  account.lock!"
    - "  account.lock!(\"FOR UPDATE NOWAIT\")"
    - "    lock!"
    - "  account.with_lock do"
  no_match:
    - "  def lock!(lock = true)"
    - "  account.unlock!"
    - "  Account.lock.find(params[:id])"
    - "  user.locked!"

LEGACY_SECRET_TOKEN:
  match:
    - "Rails.application.config.secret_token = 'a1b2c3'"
    - "  secret_token: <%= ENV['SECRET_TOKEN'] %>"
    - "  Rails.application.secrets.secret_token"
  no_match:
    - "  secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>"
    - "Rails.application.config.secret_key_base = ENV['SECRET_KEY_BASE']"
```

## File: rails-upgrade/detection-scripts/patterns/rails-52-patterns.yml
size: 15084
sha: 572322d4207b75711bb126750cdb751ecacca3a0
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-52-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-52-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-60-patterns.expectations.yml
size: 1007
sha: 8782380c03f8136d8f0612ddb77db255bbf6e828
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-60-patterns.expectations.yml

```text
# Fixture expectations for rails-60-patterns.yml.
#
# Keyed by variable_name (matching the entries in rails-60-patterns.yml). For
# each pattern you cover, list:
#   match     - lines the pattern MUST flag (the real breaking-change shapes)
#   no_match  - lines it MUST NOT flag (safe code + known false-positive traps)
#
# A line is "flagged" when the entry's `pattern` regex matches it AND the
# entry's `exclude` regex (when present) does not: a per-line grep + grep -v.
#
# Run with:
#   bin/test-patterns rails-upgrade/detection-scripts/patterns/rails-60-patterns.yml

UPDATE_ATTRIBUTES:
  match:
    - "    @user.update_attributes(user_params)"
    - "  post.update_attributes!(title: 'New')"
    - "    record.send(:update_attributes, attrs)"
    - "  alias_method :save_all, :update_attributes"
  no_match:
    - "    @user.update(user_params)"
    - "    @user.update_attribute(:name, 'New')"
    - "    @user.update_attributes_from_api(payload)"
    - "    importer.batch_update_attributes(rows)"
```

## File: rails-upgrade/detection-scripts/patterns/rails-60-patterns.yml
size: 14530
sha: 7fc5e1865a3ad60c9531a1204130439d764babbe
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-60-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-60-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-70-patterns.expectations.yml
size: 4110
sha: 6e9539189e98f6153c51fa10a9502c89fb45bf04
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-70-patterns.expectations.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-70-patterns.expectations.yml

## File: rails-upgrade/detection-scripts/patterns/rails-70-patterns.yml
size: 11461
sha: 37db00b12a0208540de2e0c57a51b51b1f37df20
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-70-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-70-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-71-patterns.expectations.yml
size: 3130
sha: ff7844428e54fccf7a5367bcc703ebf5542edbfa
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-71-patterns.expectations.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-71-patterns.expectations.yml

## File: rails-upgrade/detection-scripts/patterns/rails-71-patterns.yml
size: 9677
sha: dd4cb48280204b754514b22442f68e3527756fe5
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-71-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-71-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-72-patterns.expectations.yml
size: 1221
sha: 41e23c6f3a02e5755be5eea497b45666a8d8f72a
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-72-patterns.expectations.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-72-patterns.expectations.yml

## File: rails-upgrade/detection-scripts/patterns/rails-72-patterns.yml
size: 6265
sha: 1316383566100c9d92ad836dea3d9a247b1343ca
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-72-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-72-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-80-patterns.expectations.yml
size: 6720
sha: 6bc1a10e6cc02a21691ba7f55d3db0f291b21e68
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-80-patterns.expectations.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-80-patterns.expectations.yml

## File: rails-upgrade/detection-scripts/patterns/rails-80-patterns.yml
size: 21756
sha: 59cfd35d41aae7069a6261b61a4186782048f3c9
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-80-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-80-patterns.yml

## File: rails-upgrade/detection-scripts/patterns/rails-81-patterns.expectations.yml
size: 4438
sha: 7ecf22ad271163a573bc4214e08efc79915682f8
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-81-patterns.expectations.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-81-patterns.expectations.yml

## File: rails-upgrade/detection-scripts/patterns/rails-81-patterns.yml
size: 13567
sha: 5b3879b92617620d126135df6fcfe38a1431aa78
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-81-patterns.yml

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/patterns/rails-81-patterns.yml

## File: rails-upgrade/detection-scripts/scan_patterns.rb
size: 43861
sha: 07b46bb98f0a80a8e20a0a017b2370be9db38823
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/scan_patterns.rb

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/detection-scripts/scan_patterns.rb

## File: rails-upgrade/examples/multi-hop-upgrade.md
size: 19394
sha: 9f1a17047492d68cb5c5c96342f9a66205a75741
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/examples/multi-hop-upgrade.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/examples/multi-hop-upgrade.md

## File: rails-upgrade/examples/simple-upgrade.md
size: 4089
sha: 4e72cdd1757214c340e27dc53e7ed81501cbeb7d
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/examples/simple-upgrade.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/examples/simple-upgrade.md

## File: rails-upgrade/templates/app-update-preview-template.md
size: 4449
sha: d0fd2c75dd8095ca7dfd83cf5810b1d98c44cf58
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/templates/app-update-preview-template.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/templates/app-update-preview-template.md

## File: rails-upgrade/templates/upgrade-report-template.md
size: 10426
sha: 38a9d839c8ed77dc198b513638e44749a975bcb4
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/templates/upgrade-report-template.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/templates/upgrade-report-template.md

## File: rails-upgrade/version-guides/upgrade-3.2-to-4.0.md
size: 69591
sha: f8147e97bb59c7d98935de0eccdcb86655f6116f
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-3.2-to-4.0.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-3.2-to-4.0.md

## File: rails-upgrade/version-guides/upgrade-4.0-to-4.1.md
size: 68324
sha: 3f26f5b8fb14c6e5457d7bb016002705ab852ba0
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-4.0-to-4.1.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-4.0-to-4.1.md

## File: rails-upgrade/version-guides/upgrade-4.1-to-4.2.md
size: 62166
sha: 78a2b7d3b65348eae1762feae45a2a004c933a95
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-4.1-to-4.2.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-4.1-to-4.2.md

## File: rails-upgrade/version-guides/upgrade-4.2-to-5.0.md
size: 9910
sha: 69033964a7171f946e533509a44322d5b244753d
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-4.2-to-5.0.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-4.2-to-5.0.md

## File: rails-upgrade/version-guides/upgrade-5.0-to-5.1.md
size: 19531
sha: 5f121c121d354f664ab5de2be2e5c002c38c49f4
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-5.0-to-5.1.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-5.0-to-5.1.md

## File: rails-upgrade/version-guides/upgrade-5.1-to-5.2.md
size: 18095
sha: 75766473512b81784341a0d67b265089114b99af
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-5.1-to-5.2.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-5.1-to-5.2.md

## File: rails-upgrade/version-guides/upgrade-5.2-to-6.0.md
size: 6558
sha: 56be4426abebf85501ab82d4ce167fcc56ab252b
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-5.2-to-6.0.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-5.2-to-6.0.md

## File: rails-upgrade/version-guides/upgrade-6.0-to-6.1.md
size: 6912
sha: 7907bfc46cd185f5caf8fc1f17f9a723aa486b0e
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-6.0-to-6.1.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-6.0-to-6.1.md

## File: rails-upgrade/version-guides/upgrade-6.1-to-7.0.md
size: 15031
sha: 78c1b16ae756d5ec9ae8739217d1ab609a5e9433
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-6.1-to-7.0.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-6.1-to-7.0.md

## File: rails-upgrade/version-guides/upgrade-7.0-to-7.1.md
size: 13499
sha: 6b9a835ad6d85fbc65d2b1bd28457d29e62d6ee7
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-7.0-to-7.1.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-7.0-to-7.1.md

## File: rails-upgrade/version-guides/upgrade-7.1-to-7.2.md
size: 11473
sha: dacba1b0fbf7abbebff5d7ccbbf52d3d52f8ece7
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-7.1-to-7.2.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-7.1-to-7.2.md

## File: rails-upgrade/version-guides/upgrade-7.2-to-8.0.md
size: 23654
sha: f00f398dd95af7ebe4da366259ac4a63b5b58861
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-7.2-to-8.0.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-7.2-to-8.0.md

## File: rails-upgrade/version-guides/upgrade-8.0-to-8.1.md
size: 14297
sha: 22e40f7e1c8ae05fb0dfbd98b06e3260b620073a
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-8.0-to-8.1.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/version-guides/upgrade-8.0-to-8.1.md

## File: rails-upgrade/workflows/00-verify-latest-patch-workflow.md
size: 1700
sha: f16ccf3d9a50183cda4ff25fc2e84f7277d2c156
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/00-verify-latest-patch-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/00-verify-latest-patch-workflow.md

## File: rails-upgrade/workflows/01-run-test-suite-workflow.md
size: 12965
sha: 3562c8171ee9a17ce28ac91bc20b6f0a354877ff
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/01-run-test-suite-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/01-run-test-suite-workflow.md

## File: rails-upgrade/workflows/02-resolve-deprecation-warnings-workflow.md
size: 6470
sha: b15aaa88436f1d830ea452a540ef420d6da9b49c
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/02-resolve-deprecation-warnings-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/02-resolve-deprecation-warnings-workflow.md

## File: rails-upgrade/workflows/03-validate-upgrade-path-workflow.md
size: 1833
sha: f3a1b0fd115ead76e0c03afbffd46d9d90db2e38
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/03-validate-upgrade-path-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/03-validate-upgrade-path-workflow.md

## File: rails-upgrade/workflows/04-setup-next-rails-workflow.md
size: 1582
sha: b3a8241cd7e59b4a6828a8a5207efcaf4dea9da3
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/04-setup-next-rails-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/04-setup-next-rails-workflow.md

## File: rails-upgrade/workflows/05-detect-breaking-changes-workflow.md
size: 20449
sha: c830dcdd96754883fd649b85d3da6b8418cff9ce
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/05-detect-breaking-changes-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/05-detect-breaking-changes-workflow.md

## File: rails-upgrade/workflows/06-check-gem-compatibility-workflow.md
size: 11337
sha: ded8d37fe53be02515126bd16b24d1dbecf2e2b2
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/06-check-gem-compatibility-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/06-check-gem-compatibility-workflow.md

## File: rails-upgrade/workflows/07-boot-smoke-test-workflow.md
size: 7436
sha: c30b16d708ed698184b3afc890babcad177e74ae
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/07-boot-smoke-test-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/07-boot-smoke-test-workflow.md

## File: rails-upgrade/workflows/08-generate-upgrade-report-workflow.md
size: 12981
sha: cf8094b504294cf721ab0370c10189be52b1ec0a
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/08-generate-upgrade-report-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/08-generate-upgrade-report-workflow.md

## File: rails-upgrade/workflows/09-generate-app-update-preview-workflow.md
size: 7457
sha: ecf6b15015c98642257812bfca4431351be71be1
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/09-generate-app-update-preview-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/09-generate-app-update-preview-workflow.md

## File: rails-upgrade/workflows/10-implement-and-upgrade-workflow.md
size: 2555
sha: bc1308b1802b822d627007b57eea7e7313df864f
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/10-implement-and-upgrade-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/10-implement-and-upgrade-workflow.md

## File: rails-upgrade/workflows/11-sync-ci-workflow.md
size: 8837
sha: e7f0f2f92f1ee1875421be4362ec2928defb0e30
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/11-sync-ci-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/11-sync-ci-workflow.md

## File: rails-upgrade/workflows/12-align-load-defaults-workflow.md
size: 952
sha: 9da5e5723fe37d3fccc153c4e6205844e1c3ea70
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/12-align-load-defaults-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/12-align-load-defaults-workflow.md

## File: rails-upgrade/workflows/13-mention-cleanup-workflow.md
size: 1362
sha: d9e064f556a27be7534a34bbb8ffb05271e8318e
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/13-mention-cleanup-workflow.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/rails-upgrade/workflows/13-mention-cleanup-workflow.md

## File: README.md
upstream: https://github.com/ombulabs/claude-code_rails-upgrade-skill/blob/main/README.md

````text
# Rails Upgrade Assistant Skill

A Claude Code skill that helps you upgrade Ruby on Rails applications from version 2.3 through 8.1.

## What Does This Skill Do?

The Rails Upgrade Assistant analyzes your Rails application and generates:

- **Comprehensive Upgrade Reports** - Detailed migration guides with OLD vs NEW code examples from your actual codebase
- **app:update Previews** - Shows exactly what configuration files will change when you run `rails app:update`

The skill follows a sequential upgrade strategy—you upgrade one minor/major version at a time (e.g., 5.2 → 6.0 → 6.1 → 7.0), never skipping versions.

## Why Trust This Skill?

This skill is built on real-world experience, not just documentation:

- **60,000+ developer hours** of Rails upgrade experience
- **Upgrades from Rails 2.3 to Rails 8.1** for clients worldwide
- Based on the methodology documented in ["The Complete Guide to Upgrade Rails"](https://www.fastruby.io/upgrade) ebook
- Created by the team at [FastRuby.io](https://fastruby.io), specialists in Rails upgrades since 2017

We've encountered (and solved) edge cases that don't appear in any documentation. This skill encapsulates that hard-won knowledge.

## How to Use This Skill

### Installation

This skill depends on two companion skills: [rails-load-defaults](https://github.com/ombulabs/claude-code_rails-load-defaults-skill) and [dual-boot](https://github.com/ombulabs/claude-code_dual-boot-skill). A fourth sibling plugin, `upgrade-cleanup`, lives in this repo and runs the post-upgrade scaffolding teardown. The marketplace install handles all four.

**From inside the Claude Code CLI prompt (recommended):**

```
/plugin marketplace add ombulabs/claude-skills
/plugin install rails-upgrade@ombulabs-ai
/plugin install rails-load-defaults@ombulabs-ai
/plugin install dual-boot@ombulabs-ai
/plugin install upgrade-cleanup@ombulabs-ai
```

**From your terminal:**

```bash
claude plugin marketplace add https://github.com/ombulabs/claude-skills.git
claude plugin install rails-upgrade@ombulabs-ai
claude plugin install rails-load-defaults@ombulabs-ai
claude plugin install dual-boot@ombulabs-ai
claude plugin install upgrade-cleanup@ombulabs-ai
```

**Manual install:**

```bash
# 1. This skill
git clone https://github.com/ombulabs/claude-code_rails-upgrade-skill.git
cp -r claude-code_rails-upgrade-skill/rails-upgrade ~/.claude/skills/

# 2. upgrade-cleanup (sibling plugin, same repo)
cp -r claude-code_rails-upgrade-skill/upgrade-cleanup ~/.claude/skills/

# 3. rails-load-defaults (dependency)
git clone https://github.com/ombulabs/claude-code_rails-load-defaults-skill.git
cp -r claude-code_rails-load-defaults-skill/rails-load-defaults ~/.claude/skills/

# 4. dual-boot (dependency)
git clone https://github.com/ombulabs/claude-code_dual-boot-skill.git
cp -r claude-code_dual-boot-skill/dual-boot ~/.claude/skills/
```

### Basic Usage

In Claude Code, navigate to your Rails application directory and use natural language:

```
"Upgrade my Rails app to 7.2"
"Help me upgrade from Rails 6.1 to 7.0"
"What breaking changes are in Rails 8.0?"
```

### Workflow

1. **Ask for an upgrade** → Claude generates detailed reports based on your actual code
2. **Implement the changes** → Follow the step-by-step migration plan

## Available Commands

| Command | Description |
|---------|-------------|
| `/rails-upgrade` | Start the upgrade assistant |
| "Finish the upgrade" / "Clean up dual-boot" / "Abandon this upgrade" | Trigger the `upgrade-cleanup` plugin. Asks whether to keep the next or current version, then drops `NextRails.next?` / `NextRails.current?` branches and retires dual-boot scaffolding. |
| "Upgrade to Rails X.Y" | Generate reports from detection results |
| "Show app:update changes" | Preview configuration file changes |
| "Plan upgrade from X to Y" | Get multi-hop upgrade strategy |

## Design Decisions & Best Practices

This skill implements the **FastRuby.io upgrade methodology**, which includes:

### Dual-Boot Strategy

Run your application with two versions of Rails simultaneously using the [`next_rails`](https://github.com/fastruby/next_rails) gem. This allows you to test both versions during the transition and deploy backwards-compatible changes before the version bump.

See the [dual-boot skill](https://github.com/ombulabs/claude-code_dual-boot-skill) for setup, code patterns, and CI configuration.

### Post-Upgrade Cleanup

Once a hop is finished (or abandoned), the `upgrade-cleanup` sibling plugin tears down the dual-boot scaffolding so the tree stops carrying two Rails versions in parallel. It is scoped tightly to scaffolding removal, not a kitchen-sink "finish the upgrade" pass.

Activate it with phrases like "finish the upgrade", "clean up dual-boot", or "abandon this upgrade". The workflow:

1. **Phase 0 - Pre-flight.** Detects Docker vs local, smoke-checks `bundle` / `bin/rails runner` on both sides, and asks whether to keep the **next** version (finishing) or the **current** version (abandoning / pausing the hop).
2. **Phase 1 - Dual-boot removal.** Drops `NextRails.next?` / `NextRails.current?` branches, strips the `next?` Gemfile method and conditional groups, sweeps for `deprecation_tracker` residue *before* removing `next_rails` (the gem ships `DeprecationTracker`; leftover `require`s break test boot), swaps lockfiles, and updates CI to drop the dual-boot job.
3. **Phase 2 - Old-version code retirement.** Monkey-patches, stale gem pins, `docker-compose.yml` / `compose.yaml` sister services (`web-next`, `worker-next` with `BUNDLE_GEMFILE: Gemfile.next`), and doc drift (`README`, `bin/setup`, `.tool-versions`, `Dockerfile`).
4. **Phase 3 - Housekeeping.** CI matrix entry, `Dockerfile` / `.ruby-version` / `.tool-versions` alignment for Ruby bumps.
5. **Phase 4 - Final verification.** Local or CI, with explicit fallback to CI when the local environment can't run tests.
6. **Phase 5 - Commit and PR.** Suggested commit messages, single-purpose PR.

Out of scope by design: `load_defaults` alignment (handled by `rails-load-defaults`), deprecation triage (next-hop work owned by `rails-upgrade`), and migration class suffix / `db/schema.rb` regen (upgrade artifacts, not cleanup).

### Sequential Upgrades Only

We **never skip versions**. Each Rails minor/major version introduces changes that build on previous versions. Skipping creates compound issues that are nearly impossible to debug.

```
✅ Correct: 6.0 → 6.1 → 7.0 → 7.1
❌ Wrong:   6.0 → 7.1 (skipping 6.1 and 7.0)
```

### Deprecation-First Approach

Before upgrading:
1. Enable deprecation warnings in your current version
2. Fix all deprecation warnings
3. Deploy those fixes to production
4. Then bump the Rails version

This reduces the upgrade to a single Gemfile change.

## What This Skill Doesn't Do

Be aware of these limitations:

| Limitation | Explanation |
|------------|-------------|
| **Gradual deployments** | This skill focuses on code changes, not deployment strategies. Rolling deployments, canary releases, and feature flags are outside its scope. |
| **Debugging monkeypatching issues** | If gems or your code monkeypatch Rails internals, you may encounter weird issues that require manual investigation. |
| **Accurate time estimates** | The difficulty ratings and time estimates are rough guidelines based on typical applications. Your mileage will vary based on codebase size, test coverage, and custom code complexity. |
| **Automated code changes** | The skill provides guidance and examples, but you implement the changes. It won't automatically refactor your code. |
| **Gem compatibility resolution** | While we note common gem version requirements, resolving complex dependency conflicts requires manual intervention. |
| **Rails LTS upgrades** | While many of the things this Skill can do will work to upgrade Rails LTS, the strategy for those apps will be different and the Rails source code is not the same as the main Rails repository |

## Contributing

We welcome contrib
````
