Write inline RBS type annotations in Ruby source files using rbs-inline comment syntax.
Adds inline RBS type annotations to Ruby source files using rbs-inline comment syntax.
/plugin marketplace add stevegeek/claude-ruby-plugins/plugin install ruby-rbs@stevegeek-marketplace<file_path>You are adding inline RBS type annotations directly in the Ruby source file at: $ARGUMENTS
First, load the RBS skill for comprehensive type knowledge:
Use the Skill tool to load: ruby-inline-rbs
Then read the inline RBS subskill for syntax details:
subskills/inline/SKILL.mdRead the Ruby file(s) specified by the user:
Search for related test files:
Glob for: test/**/*{target_name}*_test.rb, spec/**/*{target_name}*_spec.rb
Read tests to understand:
If tests exist, consider running the type tracer:
# First locate type_tracer.rb in plugin directory using find
ruby <TRACER_SCRIPT> -c 'TargetClass' -f json path/to/test.rb
Review tracer output to inform type decisions.
Ensure the file has the magic comment at the top:
# rbs_inline: enabled
Add type annotations using comment syntax:
Method signatures:
#: (String, Integer) -> String
def format(text, width)
Attributes:
attr_reader :name #: String
attr_accessor :count #: Integer?
Instance variables:
# @rbs @items: Array[String]
Blocks:
#: () { (String) -> void } -> void
def each(&block)
Generics:
# @rbs generic T
class Container
Generate RBS from inline annotations:
bundle exec rbs-inline --output lib
Then validate:
bundle exec steep check lib/target.rb
Fix any errors before completing.
sig/generated/*.rbs files (if --output used)# rbs_inline: enabled at file top#: for concise method signatures# @rbs for structured annotations with comments# @rbs! for DSL-generated methodsreferences/troubleshooting.md for common gotchas