rbs-files
Write standalone .rbs signature files to describe Ruby code. Use when creating type definitions for gems, libraries, or existing codebases without modifying Ruby source.
What this skill does
# Standalone RBS Files
Write type signatures in separate `.rbs` files in a `sig/` directory. Ruby source files remain unchanged.
## Quick Start
```rbs
# sig/person.rbs
class Person
attr_reader name: String
attr_reader age: Integer?
def initialize: (String name, ?Integer? age) -> void
def greet: () -> String
end
```
## File Structure
```
project/
├── lib/
│ └── person.rb # Ruby implementation
├── sig/
│ ├── person.rbs # Type signatures
│ ├── _private/ # Hidden from library users
│ │ └── internal.rbs
│ └── manifest.yaml # Stdlib dependencies
└── Steepfile
```
## Class and Module Declarations
```rbs
# Basic class
class User
end
# With superclass
class Admin < User
end
# With type parameters
class Container[T]
end
# Module
module Logging
end
# Module with self-type constraint
module Enumerable[Elem] : _Each[Elem]
end
```
## Method Definitions
```rbs
class Calculator
# Instance method
def add: (Integer, Integer) -> Integer
# Singleton (class) method
def self.create: () -> Calculator
# Module function (both singleton and private instance)
def self?.sqrt: (Numeric) -> Float
# Visibility
private def internal: () -> void
end
```
## Method Type Syntax
```rbs
# Required positional
def foo: (String, Integer) -> void
# Optional positional (? prefix)
def foo: (String, ?Integer) -> void
# Rest positional
def foo: (*String) -> void
# Required keyword
def foo: (name: String) -> void
# Optional keyword
def foo: (?name: String) -> void
# Keyword rest
def foo: (**String) -> void
# Block (required)
def foo: () { (String) -> Integer } -> void
# Block (optional, ? before brace)
def foo: () ?{ (String) -> Integer } -> void
# Complex signature
def foo: (
String, # Required positional
?Integer, # Optional positional
*Symbol, # Rest positional
name: String, # Required keyword
?age: Integer, # Optional keyword
**untyped # Keyword rest
) { (String) -> void } -> Array[String]
```
## Method Overloading
```rbs
class Array[Elem]
# Multiple signatures with |
def *: (String) -> String
| (Integer) -> Array[Elem]
# Extending existing method with ...
def fetch: (Integer) -> Elem
| ...
end
```
## Attributes
```rbs
class User
# Reader (generates getter + @name ivar)
attr_reader name: String
# Writer (generates setter + @email ivar)
attr_writer email: String
# Accessor (generates both)
attr_accessor age: Integer
# Custom ivar name
attr_reader display_name (@raw_name): String
# No ivar (computed property)
attr_reader full_name (): String
# Singleton attribute
attr_reader self.instance: User
end
```
## Instance and Class Variables
```rbs
class Counter
@count: Integer # Instance variable
self.@instances: Array[Counter] # Class instance variable
@@total: Integer # Class variable
end
```
## Constants
```rbs
class Config
VERSION: String
MAX_SIZE: Integer
VALID_STATES: Array[Symbol]
end
# Global variable
$LOAD_PATH: Array[String]
```
## Interfaces
Define duck types that classes can implement:
```rbs
interface _Readable
def read: (?Integer) -> String?
def eof?: () -> bool
end
interface _Writable
def write: (String) -> Integer
end
class MyIO
include _Readable
include _Writable
end
```
## Type Aliases
```rbs
# Simple alias
type json_value = String | Integer | Float | bool | nil | Array[json_value] | Hash[String, json_value]
# Generic alias
type result[T] = [true, T] | [false, String]
# Scoped to class
class MyApp
type callback = ^(String) -> void
end
```
## Generics
```rbs
# Basic generic class
class Box[T]
def initialize: (T) -> void
def get: () -> T
end
# Variance annotations
class ReadOnly[out T] # Covariant
def get: () -> T
end
class WriteOnly[in T] # Contravariant
def set: (T) -> void
end
# Unchecked variance (for mutable collections)
class Array[unchecked out T]
end
# Upper bound
class Sorter[T < Comparable]
def sort: (Array[T]) -> Array[T]
end
# Default type
class Cache[T = String]
end
# Method-level generics
class Util
def self.identity: [T] (T) -> T
def self.map: [T, U] (Array[T]) { (T) -> U } -> Array[U]
end
```
## Mixins
```rbs
class User
include Comparable
include Enumerable[String]
extend ClassMethods
prepend Instrumentation
end
```
## Use Directive
Import types to avoid fully-qualified names:
```rbs
use RBS::TypeName
use RBS::AST::*
class MyParser
def parse: (TypeName) -> untyped
end
```
## manifest.yaml
Declare stdlib dependencies for gems:
```yaml
# sig/manifest.yaml
dependencies:
- name: json
- name: pathname
- name: set
```
## Validate Signatures
```bash
# Check RBS syntax and consistency
bundle exec rbs validate
# Test signatures against runtime
RBS_TEST_TARGET='MyApp::*' bundle exec ruby -r rbs/test/setup test/my_test.rb
```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.