Skip to content
Skills Library
Programming · Review & audit

sota-ruby

/sota-ruby

State-of-the-art Ruby engineering rules (supported Ruby releases) that Claude applies when writing or auditing Ruby. Covers modern idioms (frozen string literals, pattern matching, Data/Struct, RBS/Sorbet/Steep typing), security (SQL injection via ActiveRecord/Sequel, ERB/XSS escaping, mass assignment, CSRF, Marshal/YAML deserialization, command injection, ReDoS), framework-neutral web hardening (Rails/Sinatra/Hanami as neutral examples), supply chain and tooling (Bundler lockfile and checksums, bundler-audit, RuboCop/StandardRB, Brakeman, RSpec/Minitest, CI gates), and concurrency/performance

Repository
SOTA-skills ↗
Licence
CC-BY-4.0
Last repository change
13.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
6
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

CC-BY-4.0, otwarta.

What it does and when to use it

State-of-the-art Ruby engineering rules (supported Ruby releases) that Claude applies when writing or auditing Ruby. Covers modern idioms (frozen string literals, pattern matching, Data/Struct, RBS/Sorbet/Steep typing), security (SQL injection via ActiveRecord/Sequel, ERB/XSS escaping, mass assignment, CSRF, Marshal/YAML deserialization, command injection, ReDoS), framework-neutral web hardening (Rails/Sinatra/Hanami as neutral examples), supply chain and tooling (Bundler lockfile and checksums, bundler-audit, RuboCop/StandardRB, Brakeman, RSpec/Minitest, CI gates), and concurrency/performance

Original author description

State-of-the-art Ruby engineering rules (supported Ruby releases) that Claude applies when writing or auditing Ruby. Covers modern idioms (frozen string literals, pattern matching, Data/Struct, RBS/Sorbet/Steep typing), security (SQL injection via ActiveRecord/Sequel, ERB/XSS escaping, mass assignment, CSRF, Marshal/YAML deserialization, command injection, ReDoS), framework-neutral web hardening (Rails/Sinatra/Hanami as neutral examples), supply chain and tooling (Bundler lockfile and checksums, bundler-audit, RuboCop/StandardRB, Brakeman, RSpec/Minitest, CI gates), and concurrency/performance

How it works

  1. Purpose
  2. BUILD mode
  3. AUDIT mode
  4. Rules index
  5. Top-10 non-negotiables
Original SKILL.md headings · 116 lines, 1,146 words
SKILL.md preview
---
name: sota-ruby
description: >-
  State-of-the-art Ruby engineering rules (supported Ruby releases) that Claude
  applies when writing or auditing Ruby. Covers modern idioms (frozen string literals,
  pattern matching, Data/Struct, RBS/Sorbet/Steep typing), security (SQL injection via
  ActiveRecord/Sequel, ERB/XSS escaping, mass assignment, CSRF, Marshal/YAML
  deserialization, command injection, ReDoS), framework-neutral web hardening
  (Rails/Sinatra/Hanami as neutral examples), supply chain and tooling (Bundler lockfile
  and checksums, bundler-audit, RuboCop/StandardRB, Brakeman, RSpec/Minitest, CI gates),
  and concurrency/performance (GVL, threads vs fibers vs Ractors, background-job
  idempotency, YJIT/ZJIT, GC and memory, N+1 queries). Trigger keywords: Ruby, gem,
  Gemfile, bundler, Rails, Sinatra, Hanami, Rack, ERB, ActiveRecord, Sequel, RSpec,
  minitest, RuboCop, Sorbet, RBS, Sidekiq, YJIT, Ractor, rake, ruby-lang. Use for BOTH
  building Ruby services/gems/CLIs and reviewing or auditing Ruby codebases.
---

# SOTA Ruby (2026)

Expert-level rules for producing and auditing production Ruby. Baseline language
line: **Ruby 3.4+**; Ruby 4.0 was released 2025-12-25 and is in normal
maintenance (latest stable — verify at the branches page). Per the [official branches page](https://www.ruby-lang.org/en/downloads/branches/):
4.0 and 3.4 are in normal maintenance; 3.3 is security-maintenance only
(expected EOL 2027-03); 3.2 and older are EOL (3.2 since 2026-04-01) — running
them is itself a finding. Feature notes: `Data.define` and `Regexp.timeout`
from 3.2, `it` block parameter and chilled-string warnings from 3.4,
`Ractor::Port` and experimental ZJIT from 4.0 — noted where relevant. Every
rules file ends with an audit checklist of grep/lint patterns.

## Purpose

Two consumers, one source of truth:

- **BUILD mode** — generating new Ruby code: follow the rules as defaults, not
  suggestions. Deviate only with an explicit comment justifying it.
- **AUDIT mode** — reviewing existing Ruby code: hunt violations using the
  audit checklists, classify by severity, report in the finding format below.

## BUILD mode

1. Before writing code, read the rules files relevant to the task (see index).
   A web endpoint touching the DB and a background job needs `02`, `03`, `05`.
2. Apply the **top-10 non-negotiables** (below) unconditionally.
3. Establish context first: `.ruby-version`, `Gemfile`/`Gemfile.lock`, RuboCop
   or StandardRB config, framework and test runner in use. Match the project's
   floor (no `it` block param on a 3.3 project).
4. New projects: pin the Ruby version (`.ruby-version`), commit
   `Gemfile.lock`, add RuboCop **or** StandardRB, `bundler-audit`, and the
   test suite to CI from day one (see [`rules/04`](rules/04-supply-chain-tooling.md)). Rails apps add Brakeman.
5. Security posture is non-optional even when unrequested: parameterized SQL,
   argv-form process spawning, `YAML.safe_load` semantics, `SecureRandom`,
   escaped output (see [`rules/02`](rules/02-security.md), [`rules/03`](rules/03-web-hardening.md)).
6. Write tests alongside the code (RSpec or Minitest — match the project).
   Anything with threads or jobs gets an idempotency/concurrency test.
7. When code must violate a rule for a legitimate reason, leave a
   `# NOTE(sota):` comment explaining the trade-off so auditors don't flag it.

## AUDIT mode

**Coverage:** every `rules/` file's Audit checklist applies in AUDIT mode. Mark one *not applicable* only with its reason in the report — never skip a file because the thing it checks for is absent, since that absence may be the finding.

Work through each relevant rules file's audit checklist against the target
repo. Run the listed grep/lint commands; confirm each hit manually before
reporting (greps are recall-oriented, expect false positives). Useful
mechanical sweeps: `bundle exec rubocop`, `bundler-audit check --update`,
`brakeman -q` (Rails), plus the per-file greps.

### Severity conventions

| Severity | Meaning | Examples |
|---|---|---|
| **CRITICAL** | Exploitable now, or data loss | SQL built with `#{}` interpolation, `Marshal.load`/`YAML.unsafe_load` on external data, command injection via backticks with user input, `html_safe` on user input |
| **HIGH** | Exploitable with preconditions, or production-breaking | Missing CSRF protection on state-changing routes, `permit!`, `^`/`$` anchors in validation regexes, `rand` for tokens, `Timeout.timeout` around DB work, EOL Ruby in production |
| **MEDIUM** | Correctness/maintenance hazard, latent bug | N+1 on a hot path, non-idempotent retried jobs, no `Gemfile.lock` in an app, mutable shared state across threads without a lock, `rescue Exception` |
| **LOW** | Deviation from SOTA, friction | Missing frozen-string-literal comments, `Struct` where `Data` fits, stringly-typed booleans, unpinned dev tooling |
| **INFO** | Worth knowing, no action forced | YJIT not enabled, typing (RBS/Sorbet) absent, newer-Ruby features available after a floor bump |

### Finding format

```
file:line | rule violated (rules/NN §section) | severity | effort | fix
```

This is the router's canonical row; each finding carries the [`sota` rules/03](../sota/rules/03-audit-findings.md)
§2 evidence block, and the report follows its §5 order.

Severity: Critical / High / Medium / Low / Info. Effort: trivial / small /
medium / large. Borderline severities state the deciding assumption;
unconfirmed findings are marked "needs verification", never asserted. Group
findings by severity, CRITICAL first; end with counts per severity, the three
highest-leverage fixes, and which checklists were run.

## Rules index

| File | Read this when... |
|---|---|
| [`rules/01-language-idioms.md`](rules/01-language-idioms.md) | Choosing/verifying the Ruby version baseline; frozen string literals; pattern matching; `Data` vs `Struct`; exception design, **what `rescue => e` misses (`SystemStackError`, `NoMemoryError`) and JSON depth limits**; **`nil` over a sentinel, and `to_i` silently returning `0` for garbage**; money as `Integer`/`BigDecimal`, NaN/Infinity, `Array#pack` width, `valid_encoding?` on untrusted bytes; typing with RBS/Sorbet/Steep; general idioms and pitfalls |
| [`rules/02-security.md`](rules/02-security.md) | Any input crossing a trust boundary: SQL injection (ActiveRecord/Sequel), command injection (`system`/backticks/`Open3`), deserialization (`Marshal`, YAML/Psych), XML parser options (XXE/entity expansion in Nokogiri, REXML), ReDoS and regex anchors, `eval`/`send`/`constantize`, secrets and randomness, **password hashing** (bcrypt/argon2, never a fast digest), **the encrypted-credentials key** (`config/master.key`, `RAILS_MASTER_KEY`) kept out of git, path traversal; **escape hatches into raw memory**: Fiddle, the `ffi` gem and C extensions |
| [`rules/03-web-hardening.md`](rules/03-web-hardening.md) | Building or auditing anything web-facing: XSS/ERB escaping, mass assignment and strong params, CSRF (incl. HEAD→GET verb confusion and routes that widen verbs or actions), sessions and app-set cookie flags, security headers, debug mode left on in production, outbound TLS verification, open redirects, SSRF, file uploads and `render file:`, **mounted admin apps** (`Sidekiq::Web`) without authentication — framework-neutral |
| [`rules/04-supply-chain-tooling.md`](rules/04-supply-chain-tooling.md) | Bundler and Gemfile.lock discipline, lockfile checksums, **choosing an alternative index or mirror** (gem.coop, `mirror.<url>`, `disable_checksum_validation`), bundler-audit, RuboCop/StandardRB, Brakeman, RSpec/Minitest mechanics, **`rubocop:disable` with a reason and the stale-directive cop, spec exclusions by path**, **`gem install` outside the frozen lock**, memory-checking C extensions, CI gates, gem authoring/publishing |
| [`rules/05-concurrency-performance.md`](rules/05-concurrency-performance.md) | Threads, fibers, Ractors, and the GVL; resetting request-scoped thread-local state; background-job idempotency; YJIT/ZJIT; GC and memory (allocator, RSS); N+1 detection; profiling workflow |

## Top-10 non-negotiables

1. **Supported Ruby only** — 3.4+ in production (3.3 accepted short-term with
   an upgrade plan; ≤3.2 is a finding). Pin it in `.ruby-version` and CI.
   ([`rules/01`](rules/01-language-idioms.md))
2. **SQL only via parameterized queries** — hash conditions or `?`/named
   placeholders in ActiveRecord/Sequel; string-interpolated SQL is CRITICAL,
   no exceptions for "internal" values. ([`rules/02`](rules/02-security.md))
3. **Never `Marshal.load`, `YAML.unsafe_load`, or `eval`-family on data you
   don't fully control**; `YAML.load` is safe-by-default only on Psych 4+
   (Ruby 3.1+) — verify the runtime. ([`rules/02`](rules/02-security.md))
4. **Processes spawn with argv lists** (`system("cmd", arg)`,
   `Open3.capture2`), never a shell string containing external input; no
   `Kernel#open`/`URI.open` on user-supplied names (a `|cmd` name is RCE on
   ≤ 3.4; on 4.0 it is still an arbitrary file read). ([`rules/02`](rules/02-security.md))
5. **All HTML output escaped by default**; every `raw`/`html_safe` is
   reviewed; non-Rails ERB configured to auto-escape. ([`rules/03`](rules/03-web-hardening.md))
6. **Mass assignment goes through an attribute allowlist** (strong params /
   `params.expect`; explicit attribute lists elsewhere); `permit!` is HIGH.
   ([`rules/03`](rules/03-web-hardening.md))
7. **CSRF protection on every cookie-authenticated state-changing endpoint**;
   `\A`/`\z` (never `^`/`$`) to anchor validation regexes. ([`rules/02`](rules/02-security.md), [`rules/03`](rules/03-web-hardening.md))
8. **`Gemfile.lock` committed and CI installs frozen** (`BUNDLE_FROZEN=true`);
   `bundler-audit` gates CI; git-sourced gems pinned to a SHA. ([`rules/04`](rules/04-supply-chain-tooling.md))
9. **`SecureRandom` (never `rand`/`Random`) for anything security-relevant**;
   constant-time comparison for secrets. ([`rules/02`](rules/02-security.md))
10. **Background jobs are idempotent and enqueue after commit** — at-least-once
    delivery and retries are the contract; jobs take IDs, not objects.
    ([`rules/05`](rules/05-concurrency-performance.md))
Files in this package (6)
  • SKILL.md 10 KB
  • rules/01-language-idioms.md 25 KB
  • rules/02-security.md 24 KB
  • rules/03-web-hardening.md 30 KB
  • rules/04-supply-chain-tooling.md 28 KB
  • rules/05-concurrency-performance.md 17 KB

Versions

The database has no other skills named sota-ruby.

Database snapshot: 13.11.2026 · package version 1d7ac31c73d4 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100ruby
    Ruby language conventions, idioms, and modern features (3.x+) for writing idiomatic Ruby code. Covers error handling patterns, performance optimization, and Ruby-specific idioms. Use when writing or reviewing pure Ruby code, using modern Ruby features (pattern matching, ractors,…
  • 100rails-idioms
    Ruby on Rails framework patterns: ActiveRecord scopes, N+1 query prevention, model validations, RESTful routing, and RSpec/Minitest testing. Use when building, maintaining, or auditing Rails web applications and APIs. Pair with ruby-idioms.
  • 100ruby
    Use when writing or refactoring plain Ruby outside Rails — scripts, CLIs, gems, libraries: Enumerable chains and blocks, module mixins and value objects, Bundler/gemspec packaging, whether metaprogramming earns its keep, Minitest or RSpec, Ruby 3.4/4.0 frozen-string hygiene. NOT…
  • 90ruby-rails
    Use this skill when building Ruby on Rails applications — MVC, ActiveRecord, service objects, API mode, background jobs, and testing. This skill enforces: thin controllers, service objects for business logic, ActiveRecord query best practices, Rails API mode conventions, and…
  • 100sota-javascript-typescript
    State-of-the-art JavaScript and TypeScript engineering (2026) for both writing and auditing code. Covers strict TypeScript configuration and type design, language idioms and pitfalls, async patterns, Node.js backends, JS/TS-specific security (XSS, prototype pollution, supply…
  • 100ruby
    Use when writing Ruby or working in Rails codebases. Covers idiomatic object design, service objects, ActiveRecord query performance, RSpec structure, and RuboCop-clean style. Trigger on "this rails controller is too fat", "activerecord is doing n+1 queries", "clean up this…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.