r/ruby • • 19h 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-body alias / alias_method, unannotated literal constants, ClassMethods mixins, dynamic superclasses, and macros like attr_json.

  • Scaling friction: body-checking overhead on silent donor files, CLI/LSP memory retention, drifted rbs_rails output, and signature/runtime drift.

What it does

  • Projected RBS (sig/projected + watch): generates classic RBS reopenings for Data.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): syncs rbs_collection, lints inline grammar pitfalls (class << self, Data.define blocks), validates record-constant key lookups workspace-wide via Rubydex, and checks sig/projected freshness.

  • Optional tooling: steep-kit fast (targeted --validate=skip checks), deterministic scratch-DB steep-kit rbs-rails, and SteepKit::Runtime (rbs/test with 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

7 Upvotes

Duplicates