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/gem_limits.rb

View on GitHub
# 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
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