Skip to content

ombulabs/claude-code_rails-upgrade-skill / rails-upgrade

rails-upgrade

Verified

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.

FileKindSize
SKILL.mdskill md11.0 KB
detection-scripts/gem_limits.rbscript6.0 KB
detection-scripts/hop.rbscript2.2 KB
detection-scripts/patterns/rails-40-patterns.expectations.ymlconfig43.8 KB
detection-scripts/patterns/rails-40-patterns.ymlconfig96.5 KB
detection-scripts/patterns/rails-41-patterns.expectations.ymlconfig25.6 KB
detection-scripts/patterns/rails-41-patterns.ymlconfig59.8 KB
detection-scripts/patterns/rails-42-patterns.expectations.ymlconfig27.5 KB
detection-scripts/patterns/rails-42-patterns.ymlconfig48.7 KB
detection-scripts/patterns/rails-50-patterns.expectations.ymlconfig1.9 KB
detection-scripts/patterns/rails-50-patterns.ymlconfig8.1 KB
detection-scripts/patterns/rails-51-patterns.expectations.ymlconfig4.2 KB
detection-scripts/patterns/rails-51-patterns.ymlconfig15.0 KB
detection-scripts/patterns/rails-52-patterns.expectations.ymlconfig5.0 KB
detection-scripts/patterns/rails-52-patterns.ymlconfig14.7 KB
detection-scripts/patterns/rails-60-patterns.expectations.ymlconfig1007 B
detection-scripts/patterns/rails-60-patterns.ymlconfig14.2 KB
detection-scripts/patterns/rails-70-patterns.expectations.ymlconfig4.0 KB
detection-scripts/patterns/rails-70-patterns.ymlconfig11.2 KB
detection-scripts/patterns/rails-71-patterns.expectations.ymlconfig3.1 KB
detection-scripts/patterns/rails-71-patterns.ymlconfig9.5 KB
detection-scripts/patterns/rails-72-patterns.expectations.ymlconfig1.2 KB
detection-scripts/patterns/rails-72-patterns.ymlconfig6.1 KB
detection-scripts/patterns/rails-80-patterns.expectations.ymlconfig6.6 KB
detection-scripts/patterns/rails-80-patterns.ymlconfig21.2 KB
detection-scripts/patterns/rails-81-patterns.expectations.ymlconfig4.3 KB
detection-scripts/patterns/rails-81-patterns.ymlconfig13.2 KB
detection-scripts/scan_patterns.rbscript42.8 KB
examples/multi-hop-upgrade.mdmarkdown18.9 KB
examples/simple-upgrade.mdmarkdown4.0 KB
references/breaking-changes-by-version-reference.mdmarkdown3.9 KB
references/deprecation-warnings-reference.mdmarkdown10.7 KB
references/gem-compatibility-reference.mdmarkdown8.2 KB
references/js-compressor-sprockets-mismatch-reference.mdmarkdown4.7 KB
references/multi-hop-strategy-reference.mdmarkdown8.8 KB
references/next-hop-readiness-reference.mdmarkdown2.1 KB
references/no-test-suite-smoke-reference.mdmarkdown4.7 KB
references/request-patterns-reference.mdmarkdown3.7 KB
references/sequential-strategy-reference.mdmarkdown2.1 KB
references/staying-current-reference.mdmarkdown7.8 KB
references/testing-checklist-reference.mdmarkdown6.3 KB
templates/app-update-preview-template.mdmarkdown4.3 KB
templates/upgrade-report-template.mdmarkdown10.2 KB
version-guides/upgrade-3.2-to-4.0.mdmarkdown68.0 KB
version-guides/upgrade-4.0-to-4.1.mdmarkdown66.7 KB
version-guides/upgrade-4.1-to-4.2.mdmarkdown60.7 KB
version-guides/upgrade-4.2-to-5.0.mdmarkdown9.7 KB
version-guides/upgrade-5.0-to-5.1.mdmarkdown19.1 KB
version-guides/upgrade-5.1-to-5.2.mdmarkdown17.7 KB
version-guides/upgrade-5.2-to-6.0.mdmarkdown6.4 KB
version-guides/upgrade-6.0-to-6.1.mdmarkdown6.8 KB
version-guides/upgrade-6.1-to-7.0.mdmarkdown14.7 KB
version-guides/upgrade-7.0-to-7.1.mdmarkdown13.2 KB
version-guides/upgrade-7.1-to-7.2.mdmarkdown11.2 KB
version-guides/upgrade-7.2-to-8.0.mdmarkdown23.1 KB
version-guides/upgrade-8.0-to-8.1.mdmarkdown14.0 KB
workflows/00-verify-latest-patch-workflow.mdmarkdown1.7 KB
workflows/01-run-test-suite-workflow.mdmarkdown12.7 KB
workflows/02-resolve-deprecation-warnings-workflow.mdmarkdown6.3 KB
workflows/03-validate-upgrade-path-workflow.mdmarkdown1.8 KB
workflows/04-setup-next-rails-workflow.mdmarkdown1.5 KB
workflows/05-detect-breaking-changes-workflow.mdmarkdown20.0 KB
workflows/06-check-gem-compatibility-workflow.mdmarkdown11.1 KB
workflows/07-boot-smoke-test-workflow.mdmarkdown7.3 KB
workflows/08-generate-upgrade-report-workflow.mdmarkdown12.7 KB
workflows/09-generate-app-update-preview-workflow.mdmarkdown7.3 KB
workflows/10-implement-and-upgrade-workflow.mdmarkdown2.5 KB
workflows/11-sync-ci-workflow.mdmarkdown8.6 KB
workflows/12-align-load-defaults-workflow.mdmarkdown952 B
workflows/13-mention-cleanup-workflow.mdmarkdown1.3 KB

detection-scripts/patterns/rails-50-patterns.yml

View on GitHub
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"
planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies.Stars: 108kUpdated Claude CodeCodexVerifiedInstall
meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要".Stars: 108kUpdated Claude CodeCodexVerifiedInstall