技能 generating-sorbet-inline
💎

generating-sorbet-inline

安全 ⚙️ 外部命令🌐 网络访问📁 文件系统访问

Ruby 메서드에 Sorbet 타입 시그니처 추가

Ruby 프로젝트는 안정적인 코드를 위해 타입 안전성이 필요합니다. 이 스킬은 sig 블록을 사용하여 메서드에 Sorbet 인라인 타입 시그니처를 추가합니다. Ruby 소스 파일을 분석하고, 적절한 타입 어노테이션을 생성하며, Sorbet 타입 체커로 시그니처를 검증합니다.

支持: Claude Codex Code(CC)
📊 69 充足
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“generating-sorbet-inline”。 이 User 클래스에 Sorbet 타입 추가

预期结果:

  • # typed: true sigil 추가됨
  • User 클래스에 extend T::Sig 추가됨
  • initialize(name: String, age: Integer).void에 대한 sig 생성됨
  • greet(greeting: String).returns(String)에 대한 sig 생성됨
  • attr_reader :name returns(String)에 대한 sig 생성됨
  • attr_reader :age returns(Integer)에 대한 sig 생성됨

正在使用“generating-sorbet-inline”。 매개변수 및 반환값이 있는 서비스 객체 타입 지정

预期结果:

  • PaymentService 클래스 분석됨
  • process(amount: T.any(Integer, Float), currency: String).returns(T::Boolean)에 대한 sig 생성됨
  • validate_customer(customer_id: Integer).void에 대한 sig 생성됨
  • 'bundle exec srb tc' 실행됨 - 모든 시그니처 유효함

正在使用“generating-sorbet-inline”。 클래스 메서드가 있는 모듈에 타입 추가

预期结果:

  • 클래스 메서드가 있는 모듈 발견됨
  • 모듈에 extend T::Sig 추가됨
  • self.from_json(json: String).returns(T.untyped)에 대한 sig 생성됨
  • self.parse(data: T::Hash[String, T.untyped]).returns(self)에 대한 sig 생성됨

安全审计

安全
v5 • 1/17/2026

This is a documentation-only skill providing instructions for generating Sorbet inline type signatures. All static findings are in the reference/ directory which contains example code from the Packwerk gem (Shopify) for learning purposes. The 'weak cryptographic algorithm' findings are for MD5 digests used in cache invalidation (non-security use). Shell backtick execution is for running 'srb tc' validation command (legitimate tooling). No credential access or exfiltration patterns exist. The skill explicitly prohibits running project Ruby code.

68
已扫描文件
5,273
分析行数
3
发现项
5
审计总数

风险因素

⚙️ 外部命令 (168)
reference/sorbet_examples/packwerk/packwerk/application_validator.rb:119 reference/sorbet_examples/packwerk/packwerk/cli.rb:60 reference/sorbet_examples/packwerk/packwerk/commands/init_command.rb:27 reference/sorbet_examples/packwerk/packwerk/commands/update_todo_command.rb:49 reference/sorbet_examples/packwerk/packwerk/commands/update_todo_command.rb:51 reference/sorbet_examples/packwerk/packwerk/const_node_inspector.rb:20 reference/sorbet_examples/packwerk/packwerk/const_node_inspector.rb:21 reference/sorbet_examples/packwerk/packwerk/const_node_inspector.rb:21 reference/sorbet_examples/packwerk/packwerk/constant_discovery.rb:12 reference/sorbet_examples/packwerk/packwerk/constant_discovery.rb:12 reference/sorbet_examples/packwerk/packwerk/constant_discovery.rb:12 reference/sorbet_examples/packwerk/packwerk/constant_discovery.rb:13 reference/sorbet_examples/packwerk/packwerk/constant_discovery.rb:50 reference/sorbet_examples/packwerk/packwerk/extension_loader.rb:5 reference/sorbet_examples/packwerk/packwerk/extension_loader.rb:6 reference/sorbet_examples/packwerk/packwerk/file_processor.rb:59 reference/sorbet_examples/packwerk/packwerk/file_processor.rb:59 reference/sorbet_examples/packwerk/packwerk/formatters/default_offenses_formatter.rb:26 reference/sorbet_examples/packwerk/packwerk/generators/root_package.rb:31 reference/sorbet_examples/packwerk/packwerk/generators/root_package.rb:36 reference/sorbet_examples/packwerk/packwerk/node_helpers.rb:82 reference/sorbet_examples/packwerk/packwerk/node_helpers.rb:82 reference/sorbet_examples/packwerk/packwerk/node_helpers.rb:83 reference/sorbet_examples/packwerk/packwerk/node_helpers.rb:83 reference/sorbet_examples/packwerk/packwerk/offenses_formatter.rb:16 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:65 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:65 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:66 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:117 reference/syntax.md:10 reference/syntax.md:10 reference/syntax.md:13 reference/syntax.md:13 reference/syntax.md:13 reference/syntax.md:13 reference/syntax.md:14 reference/syntax.md:14 reference/syntax.md:14 reference/syntax.md:14 reference/syntax.md:14 reference/syntax.md:15 reference/syntax.md:15 reference/syntax.md:15 reference/syntax.md:15 reference/syntax.md:16 reference/syntax.md:16 reference/syntax.md:17 reference/syntax.md:17 reference/syntax.md:17 reference/syntax.md:21 reference/syntax.md:21 reference/syntax.md:21 reference/syntax.md:25 reference/syntax.md:27-31 reference/syntax.md:31-37 reference/syntax.md:37-39 reference/syntax.md:39-42 reference/syntax.md:42-43 reference/syntax.md:43-44 reference/syntax.md:44-45 reference/syntax.md:45-46 reference/syntax.md:46 reference/syntax.md:46-50 reference/syntax.md:50-54 reference/syntax.md:54-59 reference/syntax.md:59-64 reference/syntax.md:64-68 reference/syntax.md:68-73 reference/syntax.md:73-78 reference/syntax.md:78-82 reference/syntax.md:82-85 reference/syntax.md:85-89 reference/syntax.md:89-92 reference/syntax.md:92-96 reference/syntax.md:96-99 reference/syntax.md:99-104 reference/syntax.md:104-107 reference/syntax.md:107-112 reference/syntax.md:112-115 reference/syntax.md:115-124 reference/syntax.md:124-128 reference/syntax.md:128-139 reference/syntax.md:139-144 reference/syntax.md:144-149 reference/syntax.md:149-152 reference/syntax.md:152-156 reference/syntax.md:156-159 reference/syntax.md:159-163 reference/syntax.md:163-166 reference/syntax.md:166-170 reference/syntax.md:170-175 reference/syntax.md:175-180 reference/syntax.md:180-183 reference/syntax.md:183-188 reference/syntax.md:188-191 reference/syntax.md:191-196 reference/syntax.md:196-199 reference/syntax.md:199-204 reference/syntax.md:204-207 reference/syntax.md:207-211 reference/syntax.md:211-216 reference/syntax.md:216-226 reference/syntax.md:226-229 reference/syntax.md:229-231 reference/syntax.md:231-234 reference/syntax.md:234-236 reference/syntax.md:236-239 reference/syntax.md:239-243 reference/syntax.md:243-248 reference/syntax.md:248-256 reference/syntax.md:256-259 reference/syntax.md:259-269 reference/syntax.md:269-274 reference/syntax.md:274-277 reference/syntax.md:277-280 reference/syntax.md:280-283 reference/syntax.md:283-286 reference/syntax.md:286-289 reference/syntax.md:289-293 reference/syntax.md:293-303 reference/syntax.md:303-307 reference/syntax.md:307-312 reference/syntax.md:312-317 reference/syntax.md:317-334 reference/syntax.md:334-338 reference/syntax.md:338-339 reference/syntax.md:339-340 reference/syntax.md:340-341 reference/syntax.md:341-342 SKILL.md:8 SKILL.md:16-20 SKILL.md:20-23 SKILL.md:23-28 SKILL.md:28-29 SKILL.md:29-30 SKILL.md:30-32 SKILL.md:32-33 SKILL.md:33-34 SKILL.md:34 SKILL.md:34-36 SKILL.md:36-37 SKILL.md:37-46 SKILL.md:46 SKILL.md:46 SKILL.md:46-47 SKILL.md:47-54 SKILL.md:54-56 SKILL.md:56-58 SKILL.md:58 SKILL.md:58 SKILL.md:58 SKILL.md:58 SKILL.md:58-60 SKILL.md:60-61 SKILL.md:61-65 SKILL.md:65-67 SKILL.md:67-70 SKILL.md:70-83 SKILL.md:83-86 SKILL.md:86-109 SKILL.md:109-114 SKILL.md:114-118 SKILL.md:118-120 SKILL.md:120-127 SKILL.md:127-137 SKILL.md:137-139 SKILL.md:139-143 SKILL.md:143-145
🌐 网络访问 (30)
reference/sorbet_examples/packwerk/packwerk/cache.rb:116 reference/sorbet_examples/packwerk/packwerk/checker.rb:47 reference/sorbet_examples/packwerk/packwerk/commands/init_command.rb:28 reference/sorbet_examples/packwerk/packwerk/commands/init_command.rb:34 reference/sorbet_examples/packwerk/packwerk/commands/uses_parse_run.rb:35 reference/sorbet_examples/packwerk/packwerk/disable_sorbet.rb:33 reference/sorbet_examples/packwerk/packwerk/files_for_processing.rb:20 reference/sorbet_examples/packwerk/packwerk/output_styles/coloured.rb:6 reference/sorbet_examples/packwerk/packwerk/package_set.rb:93 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:34 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:37 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:44 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:48 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:51 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:108 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:108 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:109 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:109 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:122 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:124 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:138 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:153 reference/sorbet_examples/packwerk/packwerk/package_todo.rb:154 reference/sorbet_examples/packwerk/packwerk/reference_checking/checkers/dependency_checker.rb:61 reference/sorbet_examples/packwerk/packwerk/run_context.rb:76 reference/sorbet_examples/packwerk/packwerk/validators/dependency_validator.rb:71 reference/sorbet_examples/STRUCTURE.md:5 reference/syntax.md:3 skill-report.json:6 SKILL.md:159
📁 文件系统访问 (6)
审计者: claude 查看审计历史 →

质量评分

38
架构
100
可维护性
85
内容
19
社区
100
安全
91
规范符合性

你能构建什么

기존 Ruby 코드베이스에 타입 추가

레거시 애플리케이션의 Ruby 메서드에 점진적으로 타입 안전성 추가

Rails 모델 및 서비스 타입 지정

Rails 모델, 서비스, PORO 클래스에 타입 시그니처 추가

타입으로 공개 API 문서화

gem 공개 인터페이스에 대한 타입 시그니처 생성

试试这些提示

단일 클래스에 시그니처 추가
Add Sorbet inline type signatures to all methods in this Ruby class file
전체 파일 타입 지정
Analyze this Ruby file and add sig blocks to all methods, attributes, and class methods
제네릭 처리
Add Sorbet signatures to this Ruby class with type parameters and generics
Sorbet으로 검증
Add Sorbet inline signatures to this file and run 'srb tc' to validate them

最佳实践

  • # typed: true로 시작하여 점진적으로 엄격성 증가
  • T.untyped 대신 String, Integer와 같은 구체적인 타입 사용
  • 시그니처 추가 후 'srb tc'를 실행하여 조기에 오류 발견
  • 타입 정보가 모호할 때 명확히 확인 요청

避免

  • T.untyped를 지름길로 사용하면 타입 지정의 목적을 무색하게 함
  • 영향을 이해하지 않고 typed sigil 레벨 변경
  • 검증 없이 시그니처 추가
  • 시그니처 생성 중 프로젝트 Ruby 코드 실행

常见问题

Sorbet이란 무엇인가요?
Sorbet은 Stripe에서 개발한 Ruby용 정적 타입 체커입니다. 컴파일 타임에 타입 어노테이션을 검증합니다.
인라인 타입과 RBI 파일의 차이점은 무엇인가요?
인라인 타입은 Ruby 파일에 직접 sig 블록을 사용합니다. RBI 파일은 외부 gem을 위한 별도의 타입 스텁 파일입니다.
이 스킬이 내 Ruby 코드를 실행하나요?
아니요. 이 스킬은 프로젝트 Ruby 코드 실행을 명시적으로 금지합니다. 소스 구조만 분석합니다.
sig { returns(String) }은 무엇을 의미하나요?
메서드가 String 값을 반환한다고 선언합니다. sig 블록은 메서드의 타입을 정의합니다.
알 수 없는 타입은 어떻게 처리하나요?
사용자에게 명확히 요청하세요. 유니온 타입에는 T.any를 사용하고 선택적 값에는 T.nilable을 사용하세요.
어떤 typed sigil을 사용해야 하나요?
점진적 도입을 위해 typed: true로 시작하세요. 코드베이스가 성숙해지면 strict 또는 strong으로 증가시키세요.