write-rbs

A command that creates RBS type-signature files for Ruby code. RBS is a format for describing Ruby method inputs, outputs, classes, and modules separately from the implementation.

In plain words
What is it for?
Use it to generate or update standalone files in a Ruby project's sig/ directory, especially when tests can help reveal expected types.
Why use it?
It reduces the work of figuring out types by examining the Ruby code and related tests. Separate signatures let type-checking tools understand the code without changing its source files.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/stevegeek/claude-ruby-plugins/write-rbs
Clone the repo
git clone --depth 1 https://github.com/stevegeek/claude-ruby-plugins
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 593 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.00593
Opus 5 $0.00015 $0.00296
Sonnet 5 $0.00006 $0.00119
Haiku 4.5 $0.00003 $0.00059

Measured 2d ago against content hash 6b78484f823b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

write-rbs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/ruby-rbs/commands/write-rbs.md · 101 lines

How it starts

The opening of the file, as written. The whole thing — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Write Standalone RBS Signatures

You are writing RBS type signatures in standalone .rbs files for the Ruby code at: $ARGUMENTS

Process

1. Load the RBS Skill

First, load the RBS skill to get comprehensive type syntax knowledge:

Use the Skill tool to load: ruby-inline-rbs

Then read the standalone RBS subskill for file format details:

  • subskills/rbs-files/SKILL.md

2. Analyze Target

Read the Ruby file(s) specified by the user:

  • Understand class/module structure
  • Note method signatures, parameters, return patterns
  • Identify instance variables
  • Look for DSL usage (attr_*, delegate, etc.)

3. Find Tests

Search for related test files:

Glob for: test/**/*{target_name}*_test.rb, spec/**/*{target_name}*_spec.rb

Read tests to understand:

  • Expected method behavior
  • Edge cases (nil returns, exceptions)
  • Type expectations from assertions

4. Use Type Tracer (If Tests Exist)

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.

5. Generate Scaffold (Optional)

For complex files, generate an initial scaffold:

bundle exec rbs prototype rb lib/target.rb

6. Write RBS

Create the .rbs file in sig/ mirroring the lib/ structure:

lib/my_app/user.rb → sig/my_app/user.rbs

Follow these principles:

  • Start with public API methods
  • Use appropriate types (avoid untyped where possible)
  • Consider generics for container classes
  • Use interfaces for duck typing
  • Add optional markers (?) for nilable returns

7. Validate

Run validation to check your work:

bundle exec rbs validate
bundle exec steep check lib/target.rb

Fix any errors before completing.

Output

Create/update the following:

  1. sig/**/*.rbs - Type signature files
  2. Report what was typed and any decisions made

Tips

  • Match RBS file structure to Ruby file structure
  • Don't type private implementation details unless needed
  • Use untyped for genuinely dynamic/complex code
  • Check gem_rbs_collection for third-party type definitions
  • Reference references/type-syntax.md for syntax questions

Read the full file on GitHub · 101 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 101 lines · 29 tokens per session scan A 6b78484f823b

Subscribe to this mod's changes

write-rbs is a command published in the GitHub repository stevegeek/claude-ruby-plugins (19 stars, last pushed 4mo ago), licensed Unlicense. It adds 29 tokens to every session and 593 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.