ruby-conventions

ruby-conventions is a skill for Claude Code from rootstrap/rails_api_base. It costs 84 tokens per session (3,325 once invoked), scanned A, original, MIT.

A set of rules for writing Ruby code, including its layout, naming, syntax, errors, strings, and advanced features.

In plain words
What is it for?
Writing, reviewing, or editing Ruby source files such as .rb, .rake, Gemfile, Rakefile, and gemspec files.
Why use it?
It helps keep Ruby files consistent with the Rootstrap style guide and catches many formatting issues through RuboCop, a Ruby code-checking tool.

Skill for Claude Code

Written for Claude Code: paths in frontmatter. Also seen: positional $N argument.

Good fit Writing, reviewing, or editing Ruby source files such as .rb, .rake, Gemfile, Rakefile, and gemspec files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rootstrap/rails_api_base/ruby-conventions
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add rootstrap/rails_api_base --skill ruby-conventions
Clone the repo
git clone --depth 1 https://github.com/rootstrap/rails_api_base

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ruby-conventions

README.md
[![agentmods](https://agentmods.dev/badge/skills/rootstrap/rails_api_base/ruby-conventions/github.svg)](https://agentmods.dev/skills/rootstrap/rails_api_base/ruby-conventions)
Your own site
<a href="https://agentmods.dev/skills/rootstrap/rails_api_base/ruby-conventions"><img src="https://agentmods.dev/badge/skills/rootstrap/rails_api_base/ruby-conventions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ruby-conventions

Your own site · 80×15
<a href="https://agentmods.dev/skills/rootstrap/rails_api_base/ruby-conventions"><img src="https://agentmods.dev/badge/skills/rootstrap/rails_api_base/ruby-conventions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,325 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00084 $0.03325
Opus 5.5 $0.00034 $0.01330
Sonnet 5.5 $0.00017 $0.00665
Haiku 4.5 $0.00008 $0.00332

Measured 1mo ago against content hash 9a40b4b6e7c8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ruby-conventions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/ruby-conventions/SKILL.md · 192 lines

How it starts

The opening of the file, as written. The whole thing — 192 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Ruby Conventions (Rootstrap)

Apply these conventions whenever producing or modifying Ruby code. Full guide: https://github.com/rootstrap/tech-guides/blob/master/ruby/README.md

Most of these are enforced by RuboCop (see .rubocop.yml). When in doubt, run RuboCop.

Source Code Layout

  • UTF-8, Unix line endings, 2-space indentation (no tabs), one expression per line (no ;).
  • Max 100 chars per line; end files with a newline; no trailing whitespace.
  • Prefer FooError = Class.new(StandardError) over empty class ... end.
  • Avoid single-line methods (exception: def no_op; end).
  • Spaces around operators, after commas/colons; no spaces inside (, [, around !, or in range literals (1..3).
  • Exception: no spaces around exponent: c**2.
  • Indent when the same as case.
  • Blank lines between methods and around access modifiers; no blank lines inside class/method bodies.
  • No trailing comma after last arg/element.
  • Spaces around = in default params: def f(a = 1).
  • Avoid line continuation \ except for string concatenation.
  • In multi-line chains, keep . on the next line.
  • Use underscores in big numbers: 1_000_000. Lowercase prefixes 0x, 0o, 0b.
  • No block comments (=begin/=end).
  • Never more than one consecutive blank line.
  • Align multi-line method args after (, OR single-indent with ) on its own line (avoid "double indent").
  • For case/if result assignment, either align branches under the keyword or break with kind = on its own line.

Syntax

  • Use :: only for constants/constructors, not method calls.
  • def with parens when params exist, omit when empty.
  • Parens around method arguments, except: no-arg calls, DSL methods (validates :name, ...), and keyword-like (attr_reader, puts).
  • Optional args at end of parameter list.
  • Prefix unused block vars with _: |_k, v|.
  • Avoid parallel assignment (a, b, c = 1, 2, 3) except for swap, method-return destructuring, or splat.
  • Prefer trailing-underscore form: a, = foo.split(',') over a, _, _ = .... Use named underscore vars (_second) when position conveys meaning.
  • Don't use for; use iterators (each).
  • No then in multi-line if; no if x; .... Always put the condition on the same line as if/unless.
  • Avoid multi-line ternary — use if/unless instead.
  • No while cond do / until cond do for multi-line loops (drop the do).
  • Favor ternary over if/then/else one-liners; don't nest ternaries.
  • Leverage if/case as expressions.
  • Use ! not not; avoid !! boolean coercion.
  • and/or keywords are banned — use &&/||.
  • Favor modifier if/unless/while/until for single-line bodies; avoid on multi-line blocks; don't nest modifiers.
  • Favor unless for negatives; favor until over while for negative loop conditions. Never unless with else.
  • No parens around control-expression conditions (except safe assignment if (v = ...)).
  • Use Kernel#loop for infinite loops; prefer loop { ... break unless ... } over begin ... end while for post-condition loops.
  • Omit outer {} AND parens for internal DSL methods: validates :name, presence: true, length: { within: 1..10 }.
  • Omit outer {} on trailing options hashes: user.set(name: 'John', age: 45).
  • Use &:method shorthand: names.map(&:upcase).
  • {...} for single-line blocks, do...end for multi-line. Avoid do...end in chains.
  • Avoid explicit return when unnecessary; avoid self. unless required.
  • Use ||= to init nil/unset vars; don't use ||= for booleans.
  • Use &&= to preprocess nullable values.
  • Avoid === outside case.
  • Use == not eql? unless strict type comparison is intended.
  • No space between method name and opening paren: f(x).
  • No nested method defs; use lambdas.
  • Lambda: ->(a, b) { ... } with args (parens required); -> { ... } with no args (omit parens); lambda do ... end for multi-line.
  • Prefer proc over Proc.new; use .call() not [] or .().
  • Use shorthand self-assignment: x += y, x **= y, etc.
  • Use explicit &block to forward blocks rather than wrapping them.
  • Don't shadow methods with local variables (e.g. naming an arg options when an accessor already exists).
  • Don't use character literals (?x) — use 'x'.
  • Avoid Perl-style special vars ($;, $,); prefer English library aliases ($LOAD_PATH, etc.).
  • Don't use BEGIN/END blocks; use Kernel#at_exit instead.
  • Use warn over $stderr.puts.
  • Favor sprintf/format over String#%; Array#join over Array#*.
  • Use Array(var) to coerce possibly-single values into arrays.
  • Use ranges or between? instead of x >= a && x <= b.
  • Predicate methods (.even?, .zero?, .nil?) over == 0, == nil.
  • Avoid !x.nil? when if x suffices.
  • Guard clauses over nested conditionals; next over if in loops.
  • Prefer: map over collect, select over find_all, find over detect, reduce over inject, size over length/count (note: count on non-Array Enumerables iterates the full collection).
  • flat_map over map.flatten(1); reverse_each over reverse.each.

Read the full file on GitHub · 192 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 192 lines · 84 tokens per session scan A 9a40b4b6e7c8

Subscribe to this mod's changes

ruby-conventions is a skill published in the GitHub repository rootstrap/rails_api_base (633 stars, last pushed yesterday), licensed MIT. It adds 84 tokens to every session and 3,325 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

rails-upgrade

Analyzes Rails applications and generates comprehensive upgrade reports with breaking changes, deprecations, and step-by-step migration guides for Rails 2.3 through 8.1. Use when upgrading Rails applications, planning multi-hop upgrades, querying version-specific changes, or answering what stands between the app and…

ombulabs/claude-code_rails-upgrade-skill · 85 tokens

upgrade-cleanup

Clean up after (or abandon) a Rails upgrade. Drop NextRails.next? and NextRails.current? branches and retire dual-boot scaffolding (Gemfile.next, Gemfile.next.lock, conditional Gemfile groups), keeping either the next or the current version. Trigger when the user says they are done with the upgrade, want to clean up…

ombulabs/claude-code_rails-upgrade-skill · 139 tokens

rails-audit-thoughtbot

Perform comprehensive code audits of Ruby on Rails applications based on thoughtbot best practices. Use this skill when the user requests a code audit, code review, quality assessment, or analysis of a Rails application. The skill analyzes the entire codebase focusing on testing practices (RSpec), security…

thoughtbot/rails-audit-thoughtbot · 130 tokens

rails-load-defaults

Incrementally upgrade Rails config.loaddefaults by walking through each newframeworkdefaults config one at a time. Use this skill whenever the user mentions loaddefaults upgrade, newframeworkdefaults, framework defaults, or wants to bring their Rails app's default configuration up to match their Rails version. Also…

ombulabs/claude-code_rails-load-defaults-skill · 120 tokens

dual-boot

Sets up and manages dual-boot Ruby and Rails environments using the nextrails gem. Helps configure Gemfile for running two versions of Rails, Ruby, or any core dependency simultaneously, set up CI for both versions, use NextRails.next? for version-dependent code, and clean up after the upgrade is complete. Based on…

ombulabs/claude-code_dual-boot-skill · 84 tokens

adapter-express

Mount tRPC as Express middleware with createExpressMiddleware() from @trpc/server/adapters/express. Access Express req/res in createContext via CreateExpressContextOptions. Mount at a path prefix like app.use('/trpc', ...). Avoid global express.json() conflicting with tRPC body parsing for FormData.

trpc/trpc · 67 tokens