Rails 8 upgrade
Skill davidteren/hotwire-codex-skills/skills/rails-8-upgrade
Upgrade a Rails 7 app to Rails 8 safely, and catch the subtle test-suite flake it introduces. Use when bumping Rails 7.x to 8.x (or auditing readiness), when planning a Ruby/Rails version bump, or when Rails 8 tests fail intermittently with "undefined method 'login_path'/'root_path'" / pass on serial but flake on parallel runs. Provides a pre-flight audit, a detector + fix for the LazyRouteSet route-test flake, and a 7→8 checklist grounded in a real upgrade.From its SKILL.md
npx -y skills add davidteren/hotwire-codex-skills --skill rails-8-upgradeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 3 commands, including `scripts/upgrade_audit.sh path/to/app` and 2 more.
SKILL.md
3.3 KB, 762 tokens by cl100k_base, as published. Nobody here has run it
Rails 7 → 8 upgrade
Two things kill time in a 7→8 upgrade: deciding what to bump vs defer, and a
flaky route-helper test that Rails 8's LazyRouteSet introduces and that hides
behind single green test runs. This skill handles both.
Read references/rails-7-to-8.md for the full checklist and the why.
When to use
- Bumping
rails7.x → 8.x, or checking whether an app is ready. - Tests started flaking after a Rails 8 bump with
undefined method 'login_path'/'root_path'in unrelated controllers; serial runs stay green. - Reviewing a PR that adds/edits a
draw_test_routes-style route helper.
1. Pre-flight audit (read-only)
scripts/upgrade_audit.sh path/to/app
Reports: Ruby/Rails versions (+ flags a Gemfile.lock RUBY VERSION mismatch that
makes bundle refuse), config.load_defaults vs Rails major, presence of a
new_framework_defaults_*.rb, known-risky gems (notably pagy <6 with custom
pagy view helpers — a real porting cost), and whether the test suite uses the
flaky route pattern. Changes nothing.
2. The recommended path
- Baseline green on current versions first (a bisectable starting point).
- Bump
rails ~> 8.xand Ruby; leaveconfig.load_defaultswhere it is (run new library code with old framework behavior — low risk). bundle update; only hand-pin where a transitive conflict forces it.- Run the suite ≥6× (parallel flakes hide — see below). Boot the server, check a public (200) and a protected (401/redirect) route.
- Flip framework defaults separately later, via
config/initializers/new_framework_defaults_8_1.rb, one line at a time.
3. The LazyRouteSet route-test flake (the expensive one)
If the suite appends test-only routes via a helper that toggles
Rails.application.routes.disable_clear_and_finalize, Rails 8 makes it flaky under
parallel runs. Detect it:
scripts/lint_route_test_helper.sh path/to/app
It checks the helper (a) materializes the LazyRouteSet
(reload_routes_unless_loaded) before setting the flag, (b) resets the flag
in an ensure, (c) doesn't use the finalize! dead-end, and (d) every
draw_test_routes caller has a teardown { reload_routes! }. Exits non-zero on
risk and prints the fix.
Apply templates/routes_helper.rb.fixed (drop into test/support/) and add the
missing teardowns. Then run the suite ≥6× to confirm — a 35%-flake bug passes
~2 of 3 single runs.
Root cause + dead-ends:
references/rails-7-to-8.md. Real-world instance:piazza-web/wip/analysis/01.
Why the scripts are heuristic
Plain grep/awk text scans, not Ruby parsers — conservative and dependency-free,
meant to gate a PR and point you at the fix, not to be a type checker. They name
their ceiling in the output.
What ships with it: 4 files
11.8 KB alongside SKILL.md, 2 of them executable
references/
- rails-7-to-8.md3.6 KB
scripts/
- lint_route_test_helper.shruns3.8 KB
- upgrade_audit.shruns3.3 KB
templates/
- routes_helper.rb.fixed1.1 KB
Gives 0 of the 12 instructions most test skills give in 762 tokens
Counted across 1,201 of the 2,096 authors here whose files we hold, read 2026-09-06
- Write a failing test before writing codein 43 of 1201, across 36 files
- Run the full test suitein 36 of 1201, across 35 files
- Test only one variable per experimentin 34 of 1201, across 17 files
- Read product marketing context before asking questionsin 34 of 1201, across 14 files
- Mock external dependenciesin 34 of 1201, across 30 files
- Define primary, secondary, and guardrail metricsin 33 of 1201, across 16 files
- Pre-determine sample size before startingin 31 of 1201, across 14 files
- Test behavior rather than implementationin 31 of 1201, across 29 files
- Formulate a hypothesis before designing a testin 30 of 1201, across 13 files
- Document every test hypothesis, variant, and resultin 29 of 1201, across 11 files
- Use descriptive test function namesin 25 of 1201, across 21 files
- Commit to the methodology without stopping earlyin 24 of 1201, across 8 files
Said here and by no other author read
- Bump Rails and Ruby versions
- Keep existing config load defaults
- Run test suite at least six times
- Check public and protected routes
- Flip framework defaults one line at a time
- Apply route helper fix to test support
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.