Skip to content

Companion Gem

RailsCTO's skills assume a specific quality toolchain is installed and configured in your Rails project — RuboCop with the Rails and Minitest cops, Reek, Flog, Flay, Brakeman, bundler-audit, SimpleCov with the JSON formatter, and Herb. Plus the matching .rubocop.yml, .reek.yml, config/brakeman.yml, and .herb/ config files that the skills expect.

Installing and configuring all of that by hand would be tedious. The rails-cto gem does it for you.

Source

The companion gem is maintained at mattsears/rails-cto-gem.

What the gem provides

  • A single rails-cto init command that installs the toolchain gems, drops in config templates, patches test/test_helper.rb for SimpleCov, and wires your CLAUDE.md.
  • A rails-cto doctor command that detects drift between your project's config files and the bundled templates.
  • The config templates themselves — sensible defaults that match what the skills expect.
  • A custom RuboCop cop and Herb rewriter rules that enforce project conventions the stock tools don't cover.

Installation

Add the gem to your Gemfile:

ruby
group :development, :test do
  gem "rails-cto"
end

Install it:

bash
bundle install

Bootstrap the project:

bash
bundle exec rails-cto init

See rails-cto init for a full breakdown of what the command does, what files it touches, and the --force flag.

Keeping it in sync

Config files can drift over time — people edit .rubocop.yml, add exemptions, or upgrade toolchain versions. Run rails-cto doctor whenever you want to verify that every config file is still present and still matches the bundled template:

bash
bundle exec rails-cto doctor

See rails-cto doctor for what it checks and how to interpret the output.

Customizing the templates

Every config file the gem installs is a starting point, not a lock. You can edit .rubocop.yml, .reek.yml, and the rest to match your project's needs. The doctor command will flag drift but won't stop you from diverging. See Config Templates for details on what each file contains and which fields are safe to customize.

Released under the MIT License.