/audition:ractor-readinessfrom audition
Audits Ruby code for Ractor compatibility using the Audition gem. Runs static and dynamic probes to find isolation violations and applies automated fixes.
Ships in audition. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Audition (a Ruby gem) probes any target for Ractor readiness: script, gem, directory, Rack app, Rails root, or a whole Gemfile.lock. Static Prism and rubydex checks plus a dynamic probe that loads the target inside a real Ractor; every finding carries a why and a fix, and mechanical fixes are automated. Do not hand-roll Ractor analysis or re-verify Ruby 4.0 Ractor semantics; the tool encodes them, verified empirically. Written against Audition 0.4.x.
| Goal | Command |
|---|---|
| Audit one target | audition --plain <target> |
| Fast iteration | add --static-only |
| Preview fixes | --fix-unsafe --dry-run |
| Apply fixes | --fix (safe), --fix-unsafe |
| Rank all dependencies | audition <dir>/Gemfile.lock |
| CI gate | -f github or -f json, --fail-on warning |
| CI, non-blocking | add --exit-zero (= --fail-on never) |
| Git hook | audition --static-only --plain <staged .rb files> |
| Incremental adoption | --write-baseline, .audition.yml, pragmas |
The tool runs on Ruby 4.0+ (targets may support older Rubies).
Install once with gem install audition. Run it OUTSIDE
bundle exec so the dynamic probe resolves the target's own
gems. Exit code is 1 when findings reach --fail-on (default:
error), 0 when the gate is clean.
Battle-tested on a dozen real gems (i18n, sinatra, mail, tzinfo, addressable, jwt, liquid, faraday, money, and more). Order matters:
--fix
at an installed gem path; clone or copy the source first.audition --plain --static-only <target> for the picture.--fix, then --fix-unsafe. Preview with --dry-run;
after applying, review git diff and revert hunks you
disagree with instead of hand-writing everything. House
styles (line length and such) belong to your own projects,
not to targets you are fixing.store_if_absent, Ractor.current), check the target
gemspec's required_ruby_version: those APIs need Ruby
3.4+ or 4.0+. Plain-Ruby fixes (.freeze, frozen
constants) have no version floor.# audition:disable <check> pragmas on intentionally
main-only lines (Rake loading, ENV mutation),
.audition.yml exclude: for deliberately lazy trees
(test mixins, optional integrations), --write-baseline
for bulk adoption.--static-only) for dynamic ground truth.| Verdict | Meaning |
|---|---|
| ready | clean; info notes do not taint it |
| risky | warnings only |
| blocked | own code clean, dependencies dirty; not this target's bug |
| not_ready | own errors |
"Frozen memoization; warm on the main Ractor" info notes mean: call the memoizing methods once at boot, before spawning Ractors; the end of the gem's main file or an on_load hook is the natural place.
"Proxied to the main Ractor" is the @x || on_main(self) { @x ||= v } escape hatch: accepted, serializing, and only safe when
the memoized value is shareable; prefer deleting or warming the
memo.
"Shareable in the dynamic probe" on a class-level-state note
means the probe saw only shareable values there after boot:
reads are legal from any Ractor; keep writes on the main
Ractor. Static warnings on constants the probe proved shareable
are dropped outright, so a full run (no --static-only) is the
one to trust on a gem that makes its state shareable at boot.
instance-memoization is the compute-on-freeze rule: a class
that freezes itself in initialize cannot memoize lazily (move
the value into initialize), and a class with a freeze
override must warm every memo inside it before super.
On a Rails target, runtime-unshareable-proc names a callback
block Rails could not make shareable, at the Proc's definition
site; fix the capture (freeze the local, inline it, or hoist a
Symbol). A dynamic-rails finding after ractorize! names the
first object the freeze rejected, or the line where a request
on the frozen app or inside a Ractor broke; without Rails 8.2
an info note says the graph was not frozen.
Audition cannot read native code, but it reports the one
fact that decides its Ractor behavior. Ractor::UnsafeError
("ractor unsafe method called from not main ractor") is not
an IsolationError: it means a compiled extension never
declared rb_ext_ractor_safe, so every method it defines
raises on first call from a non-main Ractor, whether the
extension is C, Rust, or Zig. The native-extension check
byte-scans every compiled file in the target (*.bundle on
macOS, *.so elsewhere) for that import and warns when it is
missing; an unbuilt checkout is scanned at the source level
instead, beside the build file that compiles it. A declared extension gets an info note: the
declaration is the maintainer's assertion, not a proof, and
only real calls from a Ractor (script and Rack probes, or the
gem's own tests under Ractor.new) verify it.
The require and Rails probes extend it to dependencies: the
harness records every compiled file the load pulled in and
byte-scans those too, reporting silent ones as
runtime-native-extension warnings attributed to the
dependency. Three things still hide: extensions loaded
lazily on a code path the probe never runs, Ruby's own
archdir extensions (left to Ruby: ripper and coverage raise
from Ractors, encoding and digest plug-ins define no
methods), and whatever a Rack app loads (the Rack probe
exercises real calls instead, so an UnsafeError shows up as
a boot or call failure). For those, check the binary the
same way:
nm -u ext.bundle | grep rb_ext_ractor_safe # macOS
nm -D -u ext.so | grep rb_ext_ractor_safe # Linux
A match means the extension declares Ractor safety; silence means its methods raise from Ractors. For silent extensions: keep those calls on the main Ractor, try a newer release, or ask upstream to audit the native code for process-global state and declare rb_ext_ractor_safe(true) (from Rust: rb_sys::rb_ext_ractor_safe(true)) first thing in Init_*.
Registries and accumulators (@x ||= {} then mutated),
constructor singletons (@instance ||= new), computed config
setters, settings DSLs (sinatra-style), sync primitives,
cross-file-mutated tables. These need a copy-on-write redesign;
the pattern study has worked recipes for it, including
the frozen private constant for configuration-free memos,
freezing value objects at the end of initialize, and the
snapshot-and-rehydrate protocol for lock-bearing singletons:
https://github.com/yaroslav/audition/blob/main/docs/rails_core_best_practices.md
--fix at an installed gem path: fixes need a
writable checkout.bundle exec from another project: the
dynamic probe fails on missing target gems.blocked as the target's failure: it is a
dependency finding; report it as such.native-extension info note as proof of safety:
the byte scan says declared or silent, never safe; only real
calls from a Ractor verify the declaration.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub yaroslav/audition --plugin auditionOther plugins' skills for the same job