← ClaudeAtlas

language-rubylisted

Ruby idioms — Ruby 3.x pattern matching, blocks, procs, lambdas, Enumerable, Comparable, frozen string literals, error handling, and testing. Auto-load when working with .rb files, Gemfile, Rakefile, gemspecs, or when the user mentions Ruby, Bundler, RSpec, minitest, blocks, procs, lambdas, or pattern matching.
lugassawan/swe-workbench · ★ 2 · Testing & QA · score 68
Install: claude install-skill lugassawan/swe-workbench
# Ruby ## Ruby 3.x syntax - Use pattern matching for structural dispatch on hashes, arrays, and domain data; avoid using it as a verbose `if/elsif`. - Prefer endless methods only for tiny, obvious expressions. Multi-step behavior deserves a normal `def`. - Hash shorthand (`{name:, email:}`) is clear when local names match keys; use explicit pairs when transformation happens. - Use Ractor for isolated parallelism only when its object-sharing constraints fit better than threads or processes. ```ruby case payload in {type: "user_created", id:, email:} create_user(id:, email:) in {type: "user_deleted", id:} delete_user(id) else raise ArgumentError, "unknown payload" end def active? = status == "active" ``` ## Blocks, procs, and lambdas - Blocks are the default for one-off callbacks and iteration; yield when the method owns the flow. - `Proc` is lenient about arity and `return`; use it for flexible callbacks only when that behavior is intentional. - Lambdas behave like methods for arity and return locally. Prefer them for stored callable behavior. ```ruby def with_lock(lock) lock.acquire yield ensure lock.release end normalize = ->(value) { value.to_s.strip.downcase } ``` ## Frozen string literals - Add `# frozen_string_literal: true` to new files unless the project has a different convention. - Treat strings as immutable values; use `String.new`, unary `+`, or `dup` when mutation is required. - Avoid hidden mutation of arguments. Return a new string unless the