Generates Sorbet inline type signatures using sig blocks directly in Ruby source files. Triggers when adding Sorbet types, annotating Ruby methods with sig syntax, or generating type signatures for Sorbet-typed projects.
/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/sorbet_examples/STRUCTURE.mdreference/sorbet_examples/packwerk/packwerk.rbreference/sorbet_examples/packwerk/packwerk/application_validator.rbreference/sorbet_examples/packwerk/packwerk/association_inspector.rbreference/sorbet_examples/packwerk/packwerk/cache.rbreference/sorbet_examples/packwerk/packwerk/checker.rbreference/sorbet_examples/packwerk/packwerk/cli.rbreference/sorbet_examples/packwerk/packwerk/commands.rbreference/sorbet_examples/packwerk/packwerk/commands/base_command.rbreference/sorbet_examples/packwerk/packwerk/commands/check_command.rbreference/sorbet_examples/packwerk/packwerk/commands/help_command.rbreference/sorbet_examples/packwerk/packwerk/commands/init_command.rbreference/sorbet_examples/packwerk/packwerk/commands/lazy_loaded_entry.rbreference/sorbet_examples/packwerk/packwerk/commands/update_todo_command.rbreference/sorbet_examples/packwerk/packwerk/commands/uses_parse_run.rbreference/sorbet_examples/packwerk/packwerk/commands/validate_command.rbreference/sorbet_examples/packwerk/packwerk/commands/version_command.rbreference/sorbet_examples/packwerk/packwerk/configuration.rbreference/sorbet_examples/packwerk/packwerk/const_node_inspector.rbreference/sorbet_examples/packwerk/packwerk/constant_context.rbGenerate Sorbet type signatures using sig {} blocks directly in Ruby source files. Sorbet signatures are valid Ruby code that enable both static and runtime type checking.
When generating Sorbet inline signatures, always follow these steps.
Copy this checklist and track your progress:
Sorbet Inline Generation Progress:
- [ ] Step 1: Analyze the Ruby source
- [ ] Step 2: Add Sorbet signatures
- [ ] 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 files. This skill is for inline signatures only.# typed: sigil level if one exists. Do not upgrade or change strictness without explicit user consent.Always perform this step.
Read and understand the Ruby source file:
public, private, protected.# typed: sigil level at the top of the file.Always perform this step.
First, check if the file already has a # typed: sigil at the top:
# typed: true as a sensible default (allows gradual typing).Sigil levels (least to most strict): ignore < false < true < strict < strong
Add extend T::Sig to the class/module:
class MyClass
extend T::Sig
end
Then add type signatures using sig {} blocks:
Example - Before:
class User
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
def greet(greeting)
"#{greeting}, #{@name}!"
end
end
Example - After:
# typed: true
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)
@name = name
@age = age
end
sig { params(greeting: String).returns(String) }
def greet(greeting)
"#{greeting}, #{@name}!"
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.