Convert standalone .rbs signature files to inline RBS annotations in Ruby source files. Supports multiple files and glob patterns.
Converts standalone RBS signature files to inline annotations in Ruby source files.
/plugin marketplace add stevegeek/claude-ruby-plugins/plugin install ruby-rbs@stevegeek-marketplace<rbs_file_or_pattern>...You are converting standalone .rbs signature files into inline RBS annotations embedded directly in Ruby source files.
Target files: $ARGUMENTS
First, load the RBS skill for comprehensive type knowledge:
Use the Skill tool to load: ruby-rbs
Read both subskills:
subskills/rbs-files/SKILL.md - Understand standalone RBS formatsubskills/inline/SKILL.md - Learn inline annotation syntaxAlso read the comparison reference:
references/comparing-signatures.md - How to verify conversionParse the user's arguments to find .rbs files to convert:
# If glob pattern provided
find sig -name "*.rbs" -not -path "*/generated/*" 2>/dev/null
# List what will be converted
ls -la $ARGUMENTS
Skip any files in sig/generated/ (these are output from rbs-inline).
Map the .rbs path to its Ruby source:
sig/user.rbs → lib/user.rbsig/my_app/models/user.rbs → lib/my_app/models/user.rbsig/app/models/user.rbs → app/models/user.rbIf the Ruby file doesn't exist, report it and skip.
Read the .rbs file to understand what types need to be converted. Read the Ruby file to know where to insert annotations.
Transform each RBS declaration to inline syntax and insert at the correct location:
| Standalone | Inline |
|---|---|
def foo: (String) -> Integer | #: (String) -> Integer above def foo |
attr_reader name: String | attr_reader :name #: String |
@items: Array[String] | # @rbs @items: Array[String] |
class Foo[T] | # @rbs generic T after class Foo |
type callback = ... | # @rbs! type callback = ... |
Ensure file starts with (after shebang/frozen_string_literal):
# rbs_inline: enabled
After converting all files:
# Generate RBS from inline annotations
bundle exec rbs-inline --output lib
# Compare original with generated (first locate compare_rbs.rb in plugin directory using find)
bundle exec ruby <COMPARE_SCRIPT> --dir sig/ sig/generated/
# Run type check
bundle exec steep check
If comparison passes:
# Backup original .rbs files
for f in $CONVERTED_FILES; do
mv "$f" "${f}.bak"
done
If differences found:
Provide a summary:
/convert-rbs-to-inline sig/user.rbs sig/post.rbs
Converts sig/user.rbs and sig/post.rbs to inline annotations in their corresponding Ruby files, validates the conversion, and backs up the originals.