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-60-patterns.yml

View on GitHub
version: "6.0"
description: "Breaking change patterns for Rails 5.2 → 6.0 upgrade"

upgrade_findings:
  high_priority:
    - name: "require_dependency usage"
      kind: "migration"
      pattern: "require_dependency"
      exclude: ""
      search_paths:
        - "app/"
        - "lib/"
      explanation: "Rails 6.0 uses Zeitwerk autoloader - require_dependency is no longer needed"
      fix: "Remove require_dependency calls. Zeitwerk auto-loads all files in app/ and lib/"
      variable_name: "REQUIRE_DEPENDENCY"

    - name: "Classic autoloader configuration"
      kind: "deprecation"
      pattern: "config.autoloader\\s*=\\s*:classic"
      exclude: ""
      search_paths:
        - "config/"
      explanation: "Rails 6.0 defaults to Zeitwerk. Classic autoloader is deprecated"
      fix: "Remove this line or set to :zeitwerk. Fix any naming issues."
      variable_name: "CLASSIC_AUTOLOADER"

    - name: "ActiveRecord belongs_to required"
      kind: "migration"
      pattern: "belongs_to.*optional:\\s*false"
      exclude: ""
      search_paths:
        - "app/models/"
      explanation: "Rails 6.0 makes belongs_to required by default (optional: false is now redundant)"
      fix: "Remove optional: false as it's now the default. Add optional: true only where needed."
      variable_name: "BELONGS_TO_REQUIRED"

    - name: "protect_from_forgery"
      kind: "migration"
      pattern: "protect_from_forgery.*with:\\s*:exception"
      exclude: ""
      search_paths:
        - "app/controllers/"
      explanation: "Rails 6.0 changes default CSRF protection to :exception"
      fix: "Remove explicit with: :exception as it's now the default"
      variable_name: "CSRF_PROTECTION"

  medium_priority:
    - name: "update_attributes deprecated"
      kind: "deprecation"
      pattern: "\\bupdate_attributes\\b"
      exclude: ""
      search_paths:
        - "app/"
        - "lib/"
      explanation: "update_attributes and update_attributes! are deprecated aliases of update and update! in Rails 6.0: they still work and warn on every call. Rails 6.1 removes them"
      fix: "Replace update_attributes with update"
      variable_name: "UPDATE_ATTRIBUTES"

    - name: "ActionCable configuration"
      kind: "migration"
      pattern: "config.action_cable"
      exclude: ""
      search_paths:
        - "config/"
      explanation: "ActionCable configuration changes in Rails 6.0"
      fix: "Review ActionCable settings for compatibility"
      variable_name: "ACTION_CABLE_CONFIG"

    - name: "ActiveStorage direct upload"
      kind: "deprecation"
      pattern: "ActiveStorage::Blob\\.create_after_upload"
      exclude: ""
      search_paths:
        - "app/"
        - "lib/"
      explanation: "ActiveStorage API changes in Rails 6.0"
      fix: "Use ActiveStorage::Blob.create_and_upload! instead"
      variable_name: "ACTIVE_STORAGE_UPLOAD"

    - name: "before_filter deprecated"
      kind: "breaking"
      pattern: "before_filter"
      exclude: ""
      search_paths:
        - "app/controllers/"
      explanation: "before_filter was removed in Rails 5.1 and fully deprecated"
      fix: "Replace before_filter with before_action"
      variable_name: "BEFORE_FILTER"

    - name: "skip_before_filter deprecated"
      kind: "breaking"
      pattern: "skip_before_filter"
      exclude: ""
      search_paths:
        - "app/controllers/"
      explanation: "skip_before_filter was removed in Rails 5.1 and fully deprecated"
      fix: "Replace skip_before_filter with skip_before_action"
      variable_name: "SKIP_BEFORE_FILTER"

    - name: "render nothing: true"
      kind: "breaking"
      pattern: "render.*nothing:\\s*true"
      exclude: ""
      search_paths:
        - "app/controllers/"
      explanation: "render nothing: true is deprecated"
      fix: "Replace with head :ok or head :no_content"
      variable_name: "RENDER_NOTHING"

    - name: "Ruby version requirement"
      kind: "breaking"
      pattern: "ruby.*['\"](?:1\\.|2\\.[0-4])"
      exclude: ""
      search_paths:
        - "Gemfile"
        - ".ruby-version"
      explanation: "Rails 6.0 requires Ruby 2.5.0 or newer"
      fix: "Upgrade Ruby to 2.5.0+ (2.7+ recommended)"
      variable_name: "RUBY_VERSION"

    - name: "Controller-level force_ssl deprecated"
      kind: "deprecation"
      pattern: "^\\s*force_ssl\\b"
      exclude: ""
      search_paths:
        - "app/controllers/"
      explanation: "Rails 6.0 deprecates the controller-level force_ssl method. Configure HTTPS at the application level instead"
      fix: "Set config.force_ssl = true in config/environments/production.rb. Use config.ssl_options to exempt specific endpoints if needed"
      variable_name: "FORCE_SSL_DEPRECATED"

    - name: "Cookies metadata config (rollback compatibility)"
      kind: "optional"
      pattern: "use_cookies_with_metadata"
      exclude: ""
      search_paths:
        - "config/"
      explanation: "Rails 6.0 embeds purpose and expiry metadata inside signed/encrypted cookies. Cookies written by 6.0 are unreadable by 5.2 and earlier. This is a presence check: ABSENCE under load_defaults 6.0 means rollback to 5.2 will not be able to read existing user cookies"
      fix: "If a rollback path to 5.2 must remain viable during deploy, set Rails.application.config.action_dispatch.use_cookies_with_metadata = false until the rollback window closes. Otherwise accept the new default"
      variable_name: "COOKIES_METADATA_INCOMPATIBLE"

    - name: "Hosts authorization configuration"
      kind: "breaking"
      pattern: "config\\.hosts\\b"
      exclude: ""
      search_paths:
        - "config/"
      explanation: "Rails 6.0 introduces ActionDispatch::HostAuthorization. Development requests to any host other than localhost are blocked by default. This is a presence check: ABSENCE means non-localhost dev URLs (e.g. dev.myapp.com) will return BlockedHost"
      fix: "Add config.hosts << 'dev.myapp.com' (or a regex/IPAddr) to config/environments/development.rb for every host the dev workflow uses"
      variable_name: "HOSTS_AUTHORIZATION_DEV"

    - name: "Legacy npm package names (actioncable / activestorage / rails-ujs)"
      kind: "breaking"
      pattern: "['\"](actioncable|activestorage|rails-ujs)['\"]"
      exclude: "@rails/"
      search_paths:
        - "package.json"
        - "app/javascript/"
      explanation: "Rails 6.0 moved all official npm packages to the @rails scope. The unscoped names are unsupported"
      fix: "Update imports and package.json: actioncable → @rails/actioncable, activestorage → @rails/activestorage, rails-ujs → @rails/ujs"
      variable_name: "NPM_RAILS_PACKAGES"

    - name: "Rails.application.secrets.secret_token"
      kind: "breaking"
      pattern: "Rails\\.application\\.secrets\\.secret_token\\b"
      exclude: ""
      search_paths:
        - "app/"
        - "config/"
        - "lib/"
      explanation: "Rails 6.0 removes the legacy secret_token. Apps must use secret_key_base (via credentials.yml.enc, secrets.yml, or the SECRET_KEY_BASE env var)"
      fix: "Migrate to credentials: rails credentials:edit and store secret_key_base. Update readers to Rails.application.credentials.secret_key_base or Rails.application.secret_key_base. Delete config/initializers/secret_token.rb"
      variable_name: "SECRETS_SECRET_TOKEN"

    - name: "fragment_cache_key helper"
      kind: "breaking"
      pattern: "\\bfragment_cache_key\\b"
      exclude: "combined_fragment_cache_key"
      search_paths:
        - "app/"
        - "lib/"
      explanation: "Rails 6.0 removes the fragment_cache_key view helper. Use combined_fragment_cache_key (which honors :cache_key_with_version)"
      fix: "Replace fragment_cache_key(...) with combined_fragment_cache_key(...)"
      variable_name: "FRAGMENT_CACHE_KEY"

    - name: "TestResponse predicate methods (success?/missing?/error?)"
      kind: "breaking"
      pattern: "\\b(response|@response|last_response)\\.(success\\?|missing\\?|error\\?)"
      exclude: ""
      search_paths:
        - "test/"
        - "spec/"
      explanation: "Rails 6.0 removes ActionDispatch::TestResponse#success?, #missing?, and #error?. NOISY REGEX: pattern targets common response receivers but other libraries (Net::HTTP, Faraday, etc.) also expose .success? on their own response objects. Verify the receiver is a Rails test response before mass-replacing"
      fix: "Rename: response.success? → response.successful?; response.missing? → response.not_found?; response.error? → response.server_error?"
      variable_name: "TEST_RESPONSE_PREDICATES"

    - name: "ActiveRecord calculation methods with column name and block"
      kind: "breaking"
      pattern: "\\.(count|sum)\\(\\s*:\\w+\\s*\\)\\s*(do\\b|\\{)"
      exclude: ""
      search_paths:
        - "app/"
        - "lib/"
      explanation: "Rails 6.0 removes support for passing both a column name and a block to .count and .sum. The two forms can no longer be combined"
      fix: "Choose one: drop the column (records.count { |r| r.active? }) or drop the block (records.where(active: true).count(:column))"
      variable_name: "AR_CALC_WITH_BLOCK"

    - name: "insert_fixtures adapter method"
      kind: "breaking"
      pattern: "\\binsert_fixtures\\b"
      exclude: "insert_fixtures_set"
      search_paths:
        - "app/"
        - "lib/"
        - "db/"
      explanation: "Rails 6.0 removes ConnectionAdapters#insert_fixtures. Use insert_fixtures_set"
      fix: "Rename insert_fixtures(...) to insert_fixtures_set(...). Direct callers are usually internal tooling or seed scripts"
      variable_name: "INSERT_FIXTURES_ADAPTER"

    - name: "ActiveRecord::Migrator.migrations_path setter"
      kind: "breaking"
      pattern: "ActiveRecord::Migrator\\.migrations_path\\s*="
      exclude: ""
      search_paths:
        - "config/"
        - "lib/"
        - "db/"
      explanation: "Rails 6.0 removes ActiveRecord::Migrator.migrations_path=. Configure migration paths via the application's paths object"
      fix: "Replace ActiveRecord::Migrator.migrations_path = 'db/custom' with Rails.application.config.paths['db/migrate'] << 'db/custom' in config/application.rb"
      variable_name: "MIGRATIONS_PATH_SETTER"

  low_priority:
    - name: "image_alt view helper"
      kind: "breaking"
      pattern: "\\bimage_alt\\b"
      exclude: ""
      search_paths:
        - "app/views/"
        - "app/helpers/"
      explanation: "Rails 6.0 removes the image_alt view helper"
      fix: "Inline the alt-text logic at the call site, or define a small helper of your own with the desired behavior"
      variable_name: "IMAGE_ALT_HELPER"

    - name: "Raw SQL strings in AR query methods"
      kind: "breaking"
      pattern: "\\.(order|pluck|select|group)\\(\\s*['\"]"
      exclude: "Arel\\.sql"
      search_paths:
        - "app/"
        - "lib/"
      explanation: "Rails 6.0 raises ActiveRecord::UnknownAttributeReference when unsafe SQL strings are passed to .order/.pluck/.select/.group. NOISY REGEX: most matches are safe column-name strings; the deprecation only bites when the string is dynamic SQL or contains expressions. Audit each match for user-influenced or expression SQL"
      fix: "Wrap known-safe SQL in Arel.sql(...): Model.order(Arel.sql('LENGTH(name) DESC')). For user-influenced inputs, switch to a parameterized API"
      variable_name: "AR_RAW_STRINGS"

    - name: "Direct Arel usage in queries"
      kind: "deprecation"
      pattern: "\\bArel(::|\\.(?!sql\\b))"
      exclude: ""
      search_paths:
        - "app/"
        - "lib/"
      explanation: "Rails 6.0 deprecates direct use of Arel methods outside Arel.sql. NOISY REGEX: matches every Arel:: reference and any Arel.foo that is not Arel.sql. Most matches are valid Arel that may need a different AR API or Arel.sql wrapping"
      fix: "Where the SQL is known-safe, use Arel.sql('...') to wrap it. Where the call is on Arel::Table, Arel::Nodes, etc., look for an equivalent ActiveRecord query API or accept the deprecation until removal"
      variable_name: "AREL_DIRECT_USAGE"

    - name: "Dynamic :controller / :action segments in routes"
      kind: "deprecation"
      pattern: "\\b(:controller|:action)\\b"
      exclude: "controller:|action:|action_dispatch|action_view|action_mailer|action_cable|action_pack|action_controller"
      search_paths:
        - "config/routes.rb"
      explanation: "Dynamic :controller(/:action(/:id)) routes were deprecated in 5.1 and remain deprecated through 6.0. If the app skipped 5.1 → 5.2 detection, this catches the deprecation here"
      fix: "Replace dynamic segments with explicit routes: declare each controller/action pair with `get '/admin/users', to: 'users#index'` etc."
      variable_name: "DYNAMIC_ROUTE_SEGMENTS"

    - name: "config.ru with application class"
      kind: "deprecation"
      pattern: "^\\s*run\\s+\\w+::Application\\b"
      exclude: ""
      search_paths:
        - "config.ru"
      explanation: "Rails 6.0 deprecates `run AppName::Application` in config.ru in favor of `run Rails.application`"
      fix: "Replace `run YourApp::Application` with `run Rails.application` in config.ru"
      variable_name: "CONFIG_RU_APP_CLASS"

    - name: "escape_attributes tag helper"
      kind: "deprecation"
      pattern: "\\bescape_attributes\\b"
      exclude: ""
      search_paths:
        - "app/views/"
        - "app/helpers/"
      explanation: "Rails 6.0 deprecates the escape_attributes tag helper. The standard tag helpers already escape attributes correctly"
      fix: "Drop the explicit escape_attributes call; the tag helpers handle attribute escaping"
      variable_name: "ESCAPE_ATTRIBUTES_HELPER"

    - name: "Transaction#set_state"
      kind: "breaking"
      pattern: "\\.set_state\\("
      exclude: ""
      search_paths:
        - "app/"
        - "lib/"
      explanation: "Rails 6.0 removes ActiveRecord::ConnectionAdapters::Transaction#set_state. This is internal-ish API; most apps never touch it"
      fix: "If you have legitimate use, switch to the public commit/rollback methods on the transaction object"
      variable_name: "SET_STATE_TRANSACTION"

dependencies:
  zeitwerk:
    check: true
    gem_name: "zeitwerk"
    message: "Rails 6.0 uses Zeitwerk for code loading"
    url: "https://github.com/fxn/zeitwerk"

  webpacker:
    check: true
    gem_name: "webpacker"
    message: "Rails 6.0 uses Webpacker for JavaScript by default"
    url: "https://github.com/rails/webpacker"
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