Generate RBS type signatures from Ruby source files. Use when the user asks to create type definitions, add types to Ruby code, generate .rbs files, or type a Ruby class/module.
/plugin marketplace add DmitryPogrebnoy/ruby-agent-skills/plugin install dmitrypogrebnoy-ruby-type-signature-skills-plugins-ruby-type-signature-skills@DmitryPogrebnoy/ruby-agent-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
examples/collection.rbexamples/collection.rbsexamples/user.rbexamples/user.rbsGenerate RBS (Ruby Signature) type definitions from Ruby source files.
When generating RBS signatures, follow these steps:
Read and understand the Ruby source file:
Use these strategies to infer types:
From method names:
*? methods return boolto_s, name, title return Stringto_i, count, size, length return Integerto_a, *s (plurals) return Arrayto_h returns HashFrom default values:
param = "" suggests Stringparam = 0 suggests Integerparam = [] suggests Arrayparam = {} suggests Hashparam = nil suggests optional typeFrom usage patterns:
.each iteration suggests Enumerable<< suggests Array or similar[] access suggests Array or HashFrom Ruby idioms:
attr_reader :name with @name = "..." suggests Stringinitialize parameters often match instance variable typesCreate the .rbs file following conventions:
sig/ directory mirroring source structurepublic, private)# Class definition
class ClassName
# Instance variables
@name: String
@count: Integer? # nullable
# Constants
VERSION: String
# Class methods
def self.create: (String name) -> ClassName
# Instance methods
def initialize: (String name, ?Integer age) -> void
def name: () -> String
def process: (Array[String] items) -> Hash[Symbol, untyped]
# Block parameters
def each: () { (String) -> void } -> self
# Private methods
private
def internal: () -> void
end
# Module definition
module Searchable
def search: (String query) -> Array[self]
end
# Interface
interface _Printable
def to_s: () -> String
end
sig/
├── lib/
│ ├── my_class.rbs
│ └── my_module.rbs
└── app/
└── models/
└── user.rbs
Input Ruby file (lib/user.rb):
class User
attr_reader :name, :email
def initialize(name, email)
@name = name
@email = email
@active = true
end
def active?
@active
end
def deactivate!
@active = false
end
def full_info
"#{name} <#{email}>"
end
end
Generated RBS (sig/lib/user.rbs):
class User
@name: String
@email: String
@active: bool
attr_reader name: String
attr_reader email: String
def initialize: (String name, String email) -> void
def active?: () -> bool
def deactivate!: () -> bool
def full_info: () -> String
end
For more complete examples, see: