generating-sorbet
Generates Sorbet type signatures in separate RBI files from Ruby source files. Triggers when creating type definitions, adding types to Ruby code, or generating .rbi files for classes/modules without existing Sorbet signatures.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o generating-sorbet.zip https://jpskill.com/download/18715.zip && unzip -o generating-sorbet.zip && rm generating-sorbet.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18715.zip -OutFile "$d\generating-sorbet.zip"; Expand-Archive "$d\generating-sorbet.zip" -DestinationPath $d -Force; ri "$d\generating-sorbet.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
generating-sorbet.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
generating-sorbetフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Claude が読む原文 SKILL.md(中身を展開)
この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。
Sorbet RBI Generation Skill
Generate Sorbet type signatures in separate .rbi files. RBI files are used when you cannot or should not modify the original Ruby source - such as for gems, generated code, or legacy codebases.
Instructions
When generating Sorbet RBI signatures, always follow these steps.
Copy this checklist and track your progress:
Sorbet RBI Generation Progress:
- [ ] Step 1: Analyze the Ruby source
- [ ] Step 2: Generate RBI files
- [ ] Step 3: Eliminate `T.untyped` in signatures
- [ ] Step 4: Review and refine signatures
- [ ] Step 5: Validate signatures with Sorbet
Rules
- You MUST NOT run Ruby code of the project.
- You MUST NOT use
T.untyped. Infer the proper type instead. - You MUST NOT use
T.unsafe- it bypasses type checking entirely. - You MUST NOT use
T.cast- it forces types without verification. - You MUST ask the user to provide more details if something is not clear.
- You MUST prepend any command with
bundle execif the project has Gemfile. - You MUST use
sig { }block syntax for method signatures. - You MUST add
extend T::Sigto classes/modules before usingsig. - You MUST NOT add method bodies in RBI files - only signatures and empty method definitions.
- You MUST place RBI files in
./rbidirectory.
1. Analyze the Ruby Source
Always perform this step.
Read and understand the Ruby source file:
- Identify all classes, modules, methods, constants and instance variables.
- Note inheritance, module inclusion and definitions based on metaprogramming.
- Note visibility modifiers -
public,private,protected. - Note type parameters for generic classes.
2. Generate RBI Files
Always perform this step.
-
Determine the correct RBI directory:
Place RBI files in
./rbidirectory. Sorbet reads all.rbifiles from this location.RBI files are needed to describe code Sorbet cannot understand statically:
- Gem definitions
- Methods created with
define_methodormethod_missing - Constants from
const_get/const_set - Dynamic ancestors added via
extend - DSL-generated methods (Rails, ActiveRecord, etc.)
-
Create the RBI file with typed sigil:
# typed: strict -
Add
extend T::Sigto each class/module:class MyClass extend T::Sig end -
Add method stubs with signatures (no method bodies):
Example - Ruby Source:
class User
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
def greet(greeting)
"#{greeting}, #{@name}!"
end
end
Example - RBI File (rbi/user.rbi):
# typed: strict
class User
extend T::Sig
sig { returns(String) }
attr_reader :name
sig { returns(Integer) }
attr_reader :age
sig { params(name: String, age: Integer).void }
def initialize(name, age); end
sig { params(greeting: String).returns(String) }
def greet(greeting); end
end
- RBI files mirror structure but contain only signatures and empty method stubs
- See syntax.md for the full Sorbet RBI syntax guide
3. Eliminate T.untyped in Signatures
Always perform this step.
- Review all signatures and replace
T.untypedwith proper types. - Use code context, method calls, and tests to infer types.
- Use
T.untypedonly as a last resort when type cannot be determined.
4. Review and Refine Signatures
Always perform this step.
- Verify signatures are correct, coherent, and complete.
- Remove unnecessary
T.untypedtypes. - Ensure all methods and attributes have signatures.
- Verify class hierarchy and module inclusions match the source.
- Fix any errors and repeat until signatures are correct.
5. Validate Signatures with Sorbet
Always perform this step.
Run Sorbet type checker to validate signatures:
srb tc
Or with bundle:
bundle exec srb tc
This checks:
- Signature syntax correctness
- Type consistency
- Method parameter/return type matching
- Class/module structure matching source
Fix any errors reported and repeat until validation passes.
References
- syntax.md - Sorbet RBI syntax guide
- references/ - Real-world RBI examples from stripe-ruby
- Sorbet RBI documentation - Official RBI docs