Generates Sorbet type signatures in separate RBI files from Ruby source files. Triggers when creating type definitions, adding types to Ruby code, or generating .rbi files for classes/modules without existing Sorbet signatures.
/plugin marketplace add DmitryPogrebnoy/ruby-agent-skills/plugin install ruby-type-signature-skills@ruby-agent-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
reference/references/STRUCTURE.mdreference/references/stripe-ruby/lib/stripe.rbreference/references/stripe-ruby/lib/stripe/api_operations/create.rbreference/references/stripe-ruby/lib/stripe/api_operations/delete.rbreference/references/stripe-ruby/lib/stripe/api_operations/list.rbreference/references/stripe-ruby/lib/stripe/api_operations/nested_resource.rbreference/references/stripe-ruby/lib/stripe/api_operations/request.rbreference/references/stripe-ruby/lib/stripe/api_operations/save.rbreference/references/stripe-ruby/lib/stripe/api_operations/search.rbreference/references/stripe-ruby/lib/stripe/api_operations/singleton_save.rbreference/references/stripe-ruby/lib/stripe/api_requestor.rbreference/references/stripe-ruby/lib/stripe/api_resource.rbreference/references/stripe-ruby/lib/stripe/api_resource_test_helpers.rbreference/references/stripe-ruby/lib/stripe/api_version.rbreference/references/stripe-ruby/lib/stripe/connection_manager.rbreference/references/stripe-ruby/lib/stripe/error_object.rbreference/references/stripe-ruby/lib/stripe/errors.rbreference/references/stripe-ruby/lib/stripe/event_types.rbreference/references/stripe-ruby/lib/stripe/events/unknown_event_notification.rbreference/references/stripe-ruby/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rbGenerate Sorbet type signatures in separate .rbi files. RBI files are used when you cannot or should not modify the original Ruby source - such as for gems, generated code, or legacy codebases.
When generating Sorbet RBI signatures, always follow these steps.
Copy this checklist and track your progress:
Sorbet RBI Generation Progress:
- [ ] Step 1: Analyze the Ruby source
- [ ] Step 2: Generate RBI files
- [ ] Step 3: Eliminate `T.untyped` in signatures
- [ ] Step 4: Review and refine signatures
- [ ] Step 5: Validate signatures with Sorbet
T.untyped. Infer the proper type instead.T.unsafe - it bypasses type checking entirely.T.cast - it forces types without verification.bundle exec if the project has Gemfile.sig { } block syntax for method signatures.extend T::Sig to classes/modules before using sig../rbi directory.Always perform this step.
Read and understand the Ruby source file:
public, private, protected.Always perform this step.
Determine the correct RBI directory:
Place RBI files in ./rbi directory. Sorbet reads all .rbi files from this location.
RBI files are needed to describe code Sorbet cannot understand statically:
define_method or method_missingconst_get/const_setextendCreate the RBI file with typed sigil:
# typed: strict
Add extend T::Sig to each class/module:
class MyClass
extend T::Sig
end
Add method stubs with signatures (no method bodies):
Example - Ruby Source:
class User
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
def greet(greeting)
"#{greeting}, #{@name}!"
end
end
Example - RBI File (rbi/user.rbi):
# typed: strict
class User
extend T::Sig
sig { returns(String) }
attr_reader :name
sig { returns(Integer) }
attr_reader :age
sig { params(name: String, age: Integer).void }
def initialize(name, age); end
sig { params(greeting: String).returns(String) }
def greet(greeting); end
end
T.untyped in SignaturesAlways perform this step.
T.untyped with proper types.T.untyped only as a last resort when type cannot be determined.Always perform this step.
T.untyped types.Always perform this step.
Run Sorbet type checker to validate signatures:
srb tc
Or with bundle:
bundle exec srb tc
This checks:
Fix any errors reported and repeat until validation passes.
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.