/ruby-rails:generating-sorbet-inlinefrom ruby-rails
This skill should be used when the user asks to "add sig blocks", "add Sorbet signatures to this class", "make this file typed: strict", "add T.let annotations", or "type this Ruby with Sorbet inline". Writes `sig { }` blocks and `# typed:` sigils directly into .rb source. For standalone .rbi shim files that leave the source untouched, use generating-sorbet; for RBS rather than Sorbet, use generating-rbs or generating-rbs-inline.
Ships in ruby-rails. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Assume mise-managed Ruby and Rails with bin/* binstubs — not rbenv, rvm, or
asdf. Read ${CLAUDE_PLUGIN_ROOT}/references/conventions.md for versions,
command forms, and type-system pairing before running project commands.
Generate or update Sorbet type signatures using sig {} blocks directly in Ruby source files. Supports both full generation from scratch and partial updates for individual changed 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.mise exec -- bundle exec <command> when the project has a Gemfile (see conventions).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.When processing multiple Ruby files, create a tracking file to ensure all files are covered:
.sorbet-inline-generation-todo.tmp: [ ] app/models/user.rb
[ ] app/models/post.rb
[ ] app/services/auth_service.rb
Process files one by one:
[ ] entry[x]Cleanup: Remove the tracking file after all files are processed:
rm .sorbet-inline-generation-todo.tmp
If interrupted, the tracking file allows resuming from where you left off.
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:
mise exec -- bundle exec srb tc
This checks:
Fix any errors reported and repeat until validation passes.
.rbi shim files# @rbs comments instead of Sorbet blockssorbet/tapioca and running them on the project Rubyreferences/sorbet_examples/STRUCTURE.md (opens in a new tab)references/sorbet_examples/packwerk/LICENSE (opens in a new tab)references/sorbet_examples/packwerk/packwerk.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/application_validator.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/association_inspector.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/cache.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/checker.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/cli.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/base_command.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/check_command.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/help_command.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/init_command.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/lazy_loaded_entry.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/update_todo_command.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/uses_parse_run.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/validate_command.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/commands/version_command.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/configuration.rb (opens in a new tab)references/sorbet_examples/packwerk/packwerk/const_node_inspector.rb (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
28 skills in this plugin
/generating-rbsThis skill should be used when the user asks to "add RBS signatures", "generate RBS for this file", "write .rbs files", "set up Steep", "type-check this Ruby with RBS", or "update sig/ after these changes". Writes standalone RBS signatures under sig/**/*.rbs and never edits the Ruby source. For RBS written as inline `# @rbs` comments in the source instead, use generating-rbs-inline; for Sorbet rather than RBS, use generating-sorbet or generating-sorbet-inline./generating-rbs-inlineThis skill should be used when the user asks to "add rbs-inline annotations", "annotate this file with @rbs comments", "use rbs-inline", "add inline RBS types", or "generate RBS from comments in the source". Writes RBS types as `# @rbs` comments directly inside .rb files. For standalone sig/**/*.rbs signature files instead, use generating-rbs; for Sorbet rather than RBS, use generating-sorbet or generating-sorbet-inline./generating-sorbetThis skill should be used when the user asks to "generate RBI files", "add Sorbet types without touching the source", "write .rbi shims", "type a gem for Sorbet", or "add signatures for generated code". Writes standalone .rbi files and never edits the Ruby source — the right choice for gems, generated code, and legacy files. In a Rails app it sends ActiveRecord and other DSL methods to `tapioca dsl` and writes only the remaining shims, under sorbet/rbi/shims/. For `sig { }` blocks written in the source itself, use generating-sorbet-inline; for RBS rather than Sorbet, use generating-rbs or generating-rbs-inline.npx claudepluginhub meaganewaller/marketplace --plugin ruby-railsOther plugins' skills for the same job