r/ruby • u/maokomioko • 11h ago
Steep / RBS toolkit - (steep-kit gem)
Hi all,
I just open-sourced (slope-coded) steep-kit, a companion toolkit for Ruby apps and gems typed with inline RBS (# u/rbs / #:) and checked with Steep.
It was battle-tested in our company for about 4-5 months and evolved (slope-rewritten) to a point of being community ready. https://github.com/maokomioko/steep-kit
Why it exists
RBS 4.2's native inline parser + Steep 2.1 are great, but adopting them incrementally on a larger codebase hits two recurring gaps:
- Runtime definitions the inline parser can't see:
Data.define/Struct.new, class-bodyalias/alias_method, unannotated literal constants,ClassMethodsmixins, dynamic superclasses, and macros likeattr_json. - Scaling friction: body-checking overhead on silent donor files, CLI/LSP memory retention, drifted
rbs_railsoutput, and signature/runtime drift.
What it does
- Projected RBS (
sig/projected+watch): generates classic RBS reopenings forData.define/Struct.new,alias/alias_method, and (opt-in)attr_json. - In-memory RBS & Steep enhancements: infers literal/record constants, handles value/dynamic superclasses and opt-in mixin contracts (
ClassMethods, command aliases, nested classes), and patches Steep for lower overhead (signature-only silent donors, path-indexed lookups, completed-typing compaction). - Single CI / pre-push gate (
bundle exec steep-kit): syncsrbs_collection, lints inline grammar pitfalls (class << self,Data.defineblocks), validates record-constant key lookups workspace-wide via Rubydex, and checkssig/projectedfreshness. - Optional tooling:
steep-kit fast(targeted--validate=skipchecks), deterministic scratch-DBsteep-kit rbs-rails, andSteepKit::Runtime(rbs/testwith inline RBS + nested mismatch paths).
All Rails and convention features are off by default, so it works for plain Ruby apps and gems too (Ruby 3.3+, RBS 4.2, Steep 2.1, Rubydex 0.4).
Hope it helps someone else :3
1
u/KevinSaison 8h ago
Interesting ! How do you decide what steep-kit should figure out automatically, what it should generate as RBS files, and what developers still need to define themselves?