Setting up Steep Properly with Rails

- Published on

Static typing might not be the first thing that comes to mind when working with Ruby—but it’s becoming a valuable tool for many developers who want more clarity and confidence in their codebases.
That said, it’s important to remember: you don’t have to use it everywhere. You’re not giving up Ruby’s flexibility or developer happiness. You can still write expressive code and enhance it with RBS or Sorbet where it makes sense.
I covered this approach in more detail here: Static typing is not either-or
Using RBS in Pure Ruby Projects Is Easy
If you’re working on a plain Ruby project, adding RBS (Ruby’s official type signature language) is fairly straightforward. You write .rbs
files to describe your classes and methods, and tools like Steep will check your code for type mismatches.
Rails? A Bit More Work
Rails adds some complexity—mostly because of its dynamic and convention-heavy structure. The first time you try to add static typing in a Rails app, it might feel overwhelming.
But here’s the good news: there’s a clean and simple way to set it up using a minimal Steepfile
configuration.
A Good Starting Point for Steep with Rails
Here’s a basic Steepfile
you can use as a default config:
# Steepfile
target :app do
signature "sig"
check "app"
check "lib"
ignore "db/schema.rb"
ignore "db/migrate"
ignore "bin"
ignore "node_modules"
ignore "vendor"
end
target :test do
signature "sig-test"
check "test" # if you use MiniTest
# 2 lines below if you use RSpec
check "spec"
ignore "spec/dummy"
end
What This Does
- The
:app
target covers the main parts of your application:app/
andlib/
. - It ignores folders you typically don’t want to type-check, like
db/migrate
andnode_modules
. - You can customize it further by specifying subfolders inside
app/
orlib/
depending on your needs. - The
:test
target includes both MiniTest (test/
) and RSpec (spec/
). Keep whichever one you actually use in your project. - You need to create
sig
folder to store signatures for your Rails app, andsig-test
(if needed) to store type signature used for your tests. - Personally, I don’t use Steep for testing yet—I haven’t found a strong use case—but this config gives you a good starting point if you want to experiment.
Prefer Less Setup, More Coding?
If you'd rather focus on writing code and avoid boilerplate, check out rbs_rails
. It can generate RBS signatures for your existing Rails code—like models, concerns, and more.
Want to Learn More?
If you're interested in understanding RBS and static typing in Ruby in more depth, I created a video course that walks you through everything step-by-step: 🎓 Ruby on Types – Write Robust Software with RBS
Or stay updated via my newsletter: 📬 Static Ruby Newsletter
Thanks for reading—and happy typing!