# Sorbet

> Sorbet is an open-source agent skill for developer tools. Guides writing and fixing Sorbet types in Ruby and Rails using inline RBS comments. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/sorah/config/tree/master/claude/marketplace/plugins/sorah-guides/skills/sorbet
- **Repository:** https://github.com/sorah/config
- **GitHub stars:** 31
- **License:** MIT
- **Skill name:** sorbet
- **Collection:** https://github.com/sorah/config
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill teaches an agent how to annotate Ruby code for Sorbet using inline #: signature comments, which Ruby ignores at runtime so sorbet-runtime is never loaded. It sets the target typing level to strict, explains how to declare methods, constants and instance variables, and covers handling of nil values and unions.

The guide steers away from unsafe shortcuts. It recommends restructuring code so nil never appears before reaching for a cast, offers raising readers and a Must helper module for values the checker cannot prove present, and favors RBI shim files over per-call-site casts when a gem hides methods from tapioca. It also covers concerns, Data.define classes, Rails specifics and spec files that can leak definitions across the project.

It expects a Ruby project that already uses Sorbet, with a sorbet/config file and bundle exec srb tc available. Where the project's own docs/type-checking.md conflicts with the guide, the project's conventions win. Libraries that use Steep are referred to a separate skill.

## When your agent uses it

> This skill should be used when writing, reviewing, or fixing types in a Ruby or Rails project typechecked by Sorbet with inline RBS comments, or when adding a Ruby file to such a project. Signs include a `sorbet/config` file, `# typed:` sigils, `#:` signature comments, or the user mentioning "Sorbet", "srb tc", "RBS comment", "typed: strict", "tapioca", "RBI shim", "T.must", "as !nil", "Must.because", or a Sorbet error code. Provides signature syntax, nil and union handling (Must, `_maybe` readers), concern and Data.define patterns, shim-versus-cast rules, and a catalogue of Sorbet gaps with workarounds. Project-specific conventions (docs/type-checking.md) always take priority.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/sorah/config/tree/HEAD/claude/marketplace/plugins/sorah-guides/skills/sorbet)
- [License: MIT](https://github.com/sorah/config/tree/HEAD/claude/marketplace/plugins/sorah-guides/skills/sorbet)

## Features

- **Inline RBS signatures:** Covers #: signature syntax for methods, constants, instance variables and attributes.
- **Nil handling rules:** Ordered strategies for removing nils instead of casting them away, including raising readers.
- **Must helper module:** Provides a copyable runtime-free Must module with because, expect and be_a helpers plus a spec outline.
- **Union narrowing:** Explains narrowing unions with Must.be_a and exhaustive case handling with absurd checks.
- **Shims over casts:** Guides writing RBI shim files for gem methods that tapioca cannot see.
- **Concerns and Data.define:** Patterns for typing mixins, self casts and Data.define classes in Sorbet.

## Good for

- Add Sorbet signatures to a Ruby file that is new to the project
- Fix a Sorbet error about a nilable instance variable
- Replace an unsafe nil cast with a raising reader
- Write an RBI shim for a gem method tapioca cannot generate
- Type a Rails concern that calls methods of its host class

## Install

### Claude Code

This skill ships in the `sorah-guides` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add sorah/config
/plugin install sorah-guides@sorah-marketplace
```

Or copy only this skill to `~/.claude/skills/sorbet`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/sorah/config.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/sorbet &&
cp -R "$tmp/claude/marketplace/plugins/sorah-guides/skills/sorbet" ~/.claude/skills/sorbet &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/sorbet` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/sorbet` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/sorah/config.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/sorbet &&
cp -R "$tmp/claude/marketplace/plugins/sorah-guides/skills/sorbet" ~/.agents/skills/sorbet &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/sorbet` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/sorbet` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/sorah/config.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/sorbet &&
cp -R "$tmp/claude/marketplace/plugins/sorah-guides/skills/sorbet" ~/.cursor/skills/sorbet &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/sorbet` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/sorah/config.git --path claude/marketplace/plugins/sorah-guides/skills/sorbet
```

Or copy the folder to `~/.gemini/skills/sorbet` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/sorbet`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/sorah/config.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/sorbet &&
cp -R "$tmp/claude/marketplace/plugins/sorah-guides/skills/sorbet" ~/.copilot/skills/sorbet &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/sorbet` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/sorah/config.git
```

Then copy `config/claude/marketplace/plugins/sorah-guides/skills/sorbet` into your agent's skills folder as `sorbet`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Sorbet trigger?

When writing, reviewing or fixing types in a Ruby or Rails project typechecked by Sorbet with inline RBS comments, or when adding a Ruby file to such a project.

### Does it add sorbet-runtime to my project?

No. Signatures live in #: comments that Ruby ignores, so sorbet-runtime is not loaded and the types do not run in production.

### Which project file takes priority over this guide?

The project's docs/type-checking.md always takes priority over the guide.

### Is Sorbet for gems or libraries?

No. Libraries and gems typecheck with Steep instead, which the guide points to a separate steep skill for.

### How do I install Sorbet in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/sorbet to use it in all your projects, or to .claude/skills/sorbet in one project. Or install the sorah-guides plugin, which includes it: /plugin marketplace add sorah/config, then /plugin install sorah-guides@sorah-marketplace.

### Does Sorbet run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Sorbet?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Sorbet?

The closest alternatives to Sorbet are Sorbet adoption, Steep, Steep adoption, Coding guidelines and Skmtc lang ruby.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Sorbet adoption](https://ai-powered.com/skills/sorbet-adoption): Sorbet adoption is an open-source agent skill for developer tools.
- [Steep](https://ai-powered.com/skills/steep-sorah): Steep is an open-source agent skill for developer tools.
- [Steep adoption](https://ai-powered.com/skills/steep-adoption): Steep adoption is an open-source agent skill for developer tools.
- [Coding guidelines](https://ai-powered.com/skills/coding-guidelines): Coding guidelines is an open-source agent skill for developer tools.
- [Skmtc lang ruby](https://ai-powered.com/skills/skmtc-lang-ruby): Skmtc lang ruby is an open-source agent skill for developer tools.
- [Rails](https://ai-powered.com/skills/rails-sorah): Rails is an open-source agent skill for developer tools.
- [Ruby](https://ai-powered.com/skills/ruby-sorah): Ruby is an open-source agent skill for developer tools.
- [Rails protobuf](https://ai-powered.com/skills/rails-protobuf): Rails protobuf is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/sorbet
