Habilidades generating-rbs-inline
📝

generating-rbs-inline

Seguro ⚡ Contém scripts🌐 Acesso à rede

為 Ruby 添加 RBS-inline 型別註解

Ruby 缺乏內建的型別註解,使程式碼更難理解和維護。此技能直接將 RBS-inline 型別註解添加到您的 Ruby 檔案中,在不需要單獨的 .rbs 簽名檔案的情況下提高程式碼清晰度。

Suporta: Claude Codex Code(CC)
📊 71 Adequado
1

Baixar o ZIP da skill

2

Upload no Claude

Vá em Configurações → Capacidades → Skills → Upload skill

3

Ative e comece a usar

Testar

A utilizar "generating-rbs-inline". 為具有 name、age 和 greet 方法的 User 類別添加 RBS-inline 型別

Resultado esperado:

  • # rbs_inline: enabled
  •  
  • class User
  • attr_reader :name #: String
  • attr_reader :age #: Integer
  •  
  • # @rbs name: String
  • # @rbs age: Integer
  • # @rbs return: void
  • def initialize(name, age)
  • @name = name
  • @age = age
  • end
  •  
  • #: (String greeting) -> String
  • def greet(greeting)
  • "#{greeting}, #{@name}!"
  • end
  • end

Auditoria de Segurança

Seguro
v5 • 1/17/2026

Documentation-only skill providing guidance for adding RBS-inline type annotations to Ruby files. All 304 static findings are false positives caused by the scanner detecting patterns in markdown documentation and reference Ruby source files. The skill contains no executable code, network calls, file system access, or credential handling. Reference files include examples from the legitimate Zeitwerk gem.

28
Arquivos analisados
2,908
Linhas analisadas
2
achados
5
Total de auditorias
Auditado por: claude Ver Histórico de Auditoria →

Pontuação de qualidade

38
Arquitetura
100
Manutenibilidade
83
Conteúdo
31
Comunidade
100
Segurança
91
Conformidade com especificações

O Que Você Pode Construir

為舊版 Ruby 程式碼添加型別安全

為現有的 Ruby 程式碼庫添加內聯型別資訊,以提高理解並及早發現型別錯誤。

為使用者提供型別定義

將 rbs-inline 註解添加到 gem 中,讓使用者無需單獨的 RBS 檔案即可獲得型別檢查和 IDE 支援。

標準化型別文件

使用 rbs-inline 格式確保團隊專案中的型別註解一致,以實現更好的協作。

Tente Estes Prompts

基本類別註解
為這個 Ruby 類別添加 RBS-inline 型別註解。在適用的情況下包含參數型別、返回型別和屬性型別。
複雜簽名
為接受區塊、具有泛型參數或返回複雜型別的方法生成 RBS-inline 註解。
Data 和 Struct 型別
為 Data.define 和 Struct.new 宣告添加適當的 RBS-inline 註解,包括成員型別。
完整檔案覆蓋
為整個 Ruby 檔案添加全面的 RBS-inline 註解。包括魔法註解、所有方法、屬性和常數。

Melhores Práticas

  • 始終以 # rbs_inline: enabled 魔法註解開始以啟動處理
  • 使用特定型別而不是 untyped - 從方法調用和上下文推斷
  • 使用 rbs-inline --output lib 和 rbs validate 命令驗證註解

Evitar

  • 除非絕對必要,否則避免使用 untyped - 始終嘗試推斷正確的型別
  • 不要在同一專案中混合使用常規 .rbs 檔案和 rbs-inline 註解
  • 在註解期間切勿執行專案的 Ruby 程式碼 - 僅進行靜態分析

Perguntas Frequentes

這與 Steep 型別檢查器相容嗎?
可以,但您必須先使用 rbs-inline --output lib 生成 RBS 檔案,然後再執行 steep check。
rbs-inline 有哪些限制?
rbs-inline 僅支援註解作為註釋。它無法直接生成單獨的 .rbs 檔案。
我可以將此與現有的 .rbs 檔案一起使用嗎?
不可以,此技能使用 rbs-inline 格式。對於單獨的 .rbs 檔案管理,請使用常規 RBS 工具。
我的程式碼在註解期間安全嗎?
是的,此技能永遠不會執行您的 Ruby 程式碼。它僅靜態分析程式碼以添加型別註解。
如何驗證生成的註解?
執行 rbs-inline --output lib 生成 RBS 檔案,然後執行 rbs validate 檢查語法。
#: 和 # @rbs 語法有什麼區別?
#: 用於簡單的方法簽名。# @rbs 支援使用管道語法的重載,並適用於參數和返回值。