Skip to content

fastruby/rails-load-defaults-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rails load_defaults Upgrade Skill for Claude Code

A Claude Code skill that incrementally upgrades config.load_defaults in Rails applications by walking through each framework default config one at a time.

What It Does

This skill automates the process of bringing a Rails app's load_defaults configuration up to match its Rails version. It handles:

  • Detection: Identifies the current load_defaults version and Rails version
  • Initializer Generation: Creates the new_framework_defaults_X_Y.rb file from templates
  • Codebase Analysis: Greps the codebase for each config to recommend the right value
  • Iterative Walkthrough: Uncomments one config at a time, waits for you to test/commit
  • Consolidation: Removes the initializer, updates load_defaults, and explicitly sets overrides for configs kept at old values

Installation

From your Rails project directory, run:

mkdir -p ~/.claude/skills
git clone https://github.com/fastruby/rails-load-defaults-skill.git ~/.claude/skills/rails-load-defaults

Installing to ~/.claude/skills/ makes it available across all your projects.

Usage

Once installed, invoke the skill with:

claude /rails-load-defaults

Or start a conversation about load_defaults and Claude will pick it up automatically:

claude "The app is on Rails 7.2 but load_defaults is at 6.1, let's upgrade"

Supported Versions

Transition Config Reference Template
→ 7.0 configs/7_0.yml templates/new_framework_defaults_7_0.rb

How It Works

Tiered Config Processing

Each version's configs are organized into tiers:

Tier Risk Level Approach
Tier 1 Very low (test-only, deprecation removal) Safe to flip with minimal checks
Tier 2 Low (needs codebase grep) Claude analyzes the codebase and recommends a value
Tier 3 Medium/High (needs human review) Flagged for manual review with detailed guidance

Configs are processed in order from safest to riskiest.

Per-Config Analysis

For each config, the skill provides:

  • What changed: Old behavior → new behavior
  • Codebase lookup: Grep patterns to search for relevant code
  • Decision tree: If X found → use value A, if Y found → use value B
  • Risk level: How likely this is to break something
  • Old default value: Used during consolidation if keeping old behavior

Example Walkthrough

Config: action_view.button_to_generates_button_tag
New default: true
Risk: low

Searching codebase...
  ✓ Found 3 uses of button_to in app/views/
  ✓ No CSS/JS targeting input[type=submit]

Recommendation: Safe to use new default (true).
Shall I uncomment this config? [y/n]

After you confirm, Claude uncomments the config and waits for you to test and commit before moving to the next one.

Consolidation

When all configs are done, the skill:

  1. Deletes the new_framework_defaults_X_Y.rb initializer
  2. Updates config.load_defaults in config/application.rb
  3. Adds explicit overrides for any configs kept at old values
config.load_defaults 7.0

# Override: kept old behavior because CSS targets input[type=submit]
config.action_view.button_to_generates_button_tag = false

Skill Structure

rails-load-defaults/
├── SKILL.md                                # Workflow instructions
├── configs/
│   ├── 7_0.yml                             # Config reference with lookup logic
└── templates/
    ├── new_framework_defaults_7_0.rb       # Rails initializer
    └── cookie_rotator.rb                   # SHA1→SHA256 cookie rotation

Adding New Versions

To add support for a new Rails version (e.g., 7.2):

  1. Add templates/new_framework_defaults_7_2.rb — the initializer from Rails
  2. Add configs/7_2.yml — config entries with tiers, lookup patterns, and decision trees
  3. Update the version references in SKILL.md

The workflow logic in SKILL.md is version-agnostic, so no other changes are needed.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE for details.

About FastRuby.io

This skill was created by FastRuby.io, a team specializing in Rails upgrades and technical debt remediation.

Need help with your Rails application? Contact us for a tech debt assessment!

About

A Claude Code Skill to help upgrade the Rails defaults

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages