Ruby Patterns
softspark/ai-toolkit
Ruby/Rails: blocks, metaprogramming, ActiveRecord, Sidekiq, RSpec, Sorbet, Hanami.
A skill your agent uses when building or maintaining a Ruby on Rails app — models, controllers, views, routes and migrations; ActiveRecord associations, scopes and query performance; Hotwire (Turbo…
$ npx skills add ericrisco/rsc-harness --skill rails -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ericrisco/rsc-harness rails --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/rails .claude/skills/rails && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "rails" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/rails into .claude/skills/rails/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rails", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/ericrisco/rsc-harness/tree/main/skills/railsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add ericrisco/rsc-harness --skill rails -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ericrisco/rsc-harness rails --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/rails .agents/skills/rails && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "rails" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/rails into .agents/skills/rails/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rails", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ericrisco/rsc-harness --skill rails -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ericrisco/rsc-harness rails --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/rails .cursor/skills/rails && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "rails" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/rails into .cursor/skills/rails/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rails", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/ericrisco/rsc-harness.git --path skills/rails--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add ericrisco/rsc-harness --skill rails -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ericrisco/rsc-harness rails --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/rails .gemini/skills/rails && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "rails" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/rails into .gemini/skills/rails/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rails", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install ericrisco/rsc-harness railsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add ericrisco/rsc-harness --skill rails -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/rails .github/skills/rails && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "rails" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/rails into .github/skills/rails/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rails", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ericrisco/rsc-harness --skill rails -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install ericrisco/rsc-harness rails --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/rails .opencode/skills/rails && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "rails" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/rails into .opencode/skills/rails/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rails", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
railsA skill your agent uses when building or maintaining a Ruby on Rails app — models, controllers, views, routes and migrations; ActiveRecord associations, scopes and query performance; Hotwire (Turbo…
Rails is an agent skill from ericrisco/rsc-harness. Use when building or maintaining a Ruby on Rails app — models, controllers, views, routes and migrations; ActiveRecord associations, scopes and query performance; Hotwire (Turbo and Stimulus) UI; Active Job or Solid Queue background work; and Rails tests. Covers N+1 queries, migration safety on live tables, and flaky system tests around Turbo Frames. NOT plain Ruby scripts, gems or CLIs with no Rails loaded (that is ruby).
Its SKILL.md is about 3.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 9 other files, including scripts and reference files (for example `evals/README.md`, `evals/cases.yaml` and `references/activerecord.md`).
It sits in Backend & APIs, covering Backend development and ORMs and data access. It works with Ruby on Rails, Ruby and Redis. The repository describes itself as: Your agent invents things because it has no memory, and can't touch your database because it has no arms. rsc is the meta-harness that gives it both, plus the trade to know the… The licence is MIT.
Read from SKILL.md and the folder at commit e3d5b33. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships 1 file in scripts/ (Shell), which the agent can run.
Shell commands in SKILL.md call:
railsFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Rails loads about 3.1k tokens when it runs, and up to ~6k if it reads all its reference files. Until then it costs about 109 tokens; SKILL.md has 1,211 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.
The full file from ericrisco/rsc-harness at commit e3d5b33, republished under its MIT licence (© ericrisco). 1,211 words, ~3,085 tokens.
.claude/skills/rails/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.Write Rails the way a core-adjacent senior would: fat-enough models, skinny controllers, zero N+1, strong parameters, migrations that are reversible and safe on a live table, and tests that exercise the request rather than the implementation. Lean into the Rails 8 "omakase" defaults instead of fighting them — the framework already made the boring choices for you.
This is Rails the framework: the MVC request cycle, ActiveRecord, Hotwire, Active
Job, the Rails test stack. The moment code stops loading Rails — a plain script, a gem,
an Enumerable refactor with no ActiveRecord in sight — it is no longer this skill.
That is ruby (see ../ruby/SKILL.md).
Rails 8.1 (stable line, released 2025-10-22; 8.0 shipped 2024-11-07)
Ruby 3.4+ (floor for current Rails)
Jobs/queue Solid Queue (default Active Job backend — database-backed, no Redis)
Cache Solid Cache (default cache store — database-backed)
WebSockets Solid Cable (default Action Cable adapter — database-backed)
Assets Propshaft (default; Sprockets is legacy)
JS Importmaps (default; no Node build step required)
Deploy Kamal 2 + Thruster
Front-end Hotwire = Turbo 8 + Stimulus
Auth `rails generate authentication` (built in; no Devise for basic auth)A fresh Rails 8 app needs no Redis and no Node. Stop reaching for Sidekiq/Redis or
a JS bundler by reflex — the Solid trifecta and Importmaps already cover the default
case. Rails 8.1 adds Active Job Continuations (resumable long jobs), Structured Event
Reporting, local CI via config/ci.rb, and Markdown rendering.
app/ (models, controllers, views, jobs, mailers,
channels), config/routes.rb, or db/migrate/.includes/preload/
eager_load, query objects, migrations.ruby.laravel. Python/Django → django. (Route by the language/framework
the file actually uses.)postgresdb / mysql / db-migrations.deployment /
docker / github-actions. This skill writes the Rails-side glue, then hands off.Route → controller → model → view. Keep each layer doing one job.
# Good: skinny controller, domain logic on the model.
class PostsController < ApplicationController
def create
@post = Current.user.posts.build(post_params)
if @post.publish # model method owns the rule
redirect_to @post, notice: "Published"
else
render :new, status: :unprocessable_entity
end
end
private
def post_params
params.expect(post: [:title, :body]) # Rails 8 strong params
end
endAssociations, validations, and scopes are the vocabulary — use them before writing raw SQL or manual loops.
class Post < ApplicationRecord
belongs_to :author, class_name: "User"
has_many :comments, dependent: :destroy
validates :title, presence: true, length: { maximum: 120 }
scope :published, -> { where.not(published_at: nil) }
def publish
update(published_at: Time.current)
end
endKill N+1 with eager loading. The classic footgun is touching an association inside a loop, firing one query per row.
# Bad: 1 query for posts + 1 per post for its author (N+1).
Post.published.each { |p| puts p.author.name }
# Good: 2 queries total — posts, then all authors in one IN(...).
Post.published.includes(:author).each { |p| puts p.author.name }Gate it: add the bullet gem in development, or mark a hot association
strict_loading so an accidental lazy load raises instead of silently degrading.
Migrations must be reversible and safe on a live table. A migration that locks a large table blocks every reader and writer for its duration.
# Good: a Postgres index built without an exclusive table lock.
class AddIndexToPostsOnAuthor < ActiveRecord::Migration[8.1]
disable_ddl_transaction! # required — concurrent index can't run in a txn
def change
add_index :posts, :author_id, algorithm: :concurrently
end
endRules: never add_column ..., default: on a huge legacy table without checking your
Rails/Postgres version handles it without a full rewrite; backfill data in batches with
find_each or update_all, not one giant UPDATE in the migration; add the
strong_migrations gem so unsafe operations fail in review, not in production.
Deeper AR — query objects, strict_loading, counter caches, composite primary keys,
advisory locks, per-operation safe-migration recipes (add column, rename, backfill in
batches) — is in references/activerecord.md.
Hotwire is the default front-end: Turbo for navigation/updates, Stimulus for behavior. Reach for the lightest tool that does the job.
| Need | Use | Why |
|---|---|---|
| Faster full-page navigation, no code | Turbo Drive (on by default) | Free; intercepts links/forms |
| Replace one bounded region after an action | Turbo Frame | Scoped DOM swap, no JS |
| Update several elements / push from server | Turbo Stream | Targeted append/replace/remove + broadcasts |
| Re-render a whole page and keep scroll/focus | Morphing (Turbo 8) | Diffs the DOM; kills most custom Stream choreography |
| Client behavior (toggle, copy, debounce) | Stimulus controller | Sprinkle, not a SPA |
Default to Turbo Drive and morphing; only hand-write a Turbo Stream when you need to touch elements that morphing can't infer (e.g. prepend to a list from a broadcast).
// app/javascript/controllers/clipboard_controller.js
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["source"]
static values = { successText: { type: String, default: "Copied!" } }
copy() {
navigator.clipboard.writeText(this.sourceTarget.value)
}
}Worked Frame/Stream/morph examples, model broadcasting (broadcasts_to), Stimulus
values/targets/outlets, and how to system-test Turbo are in references/hotwire.md.
Use Active Job over Solid Queue (the Rails 8 default). Two non-negotiable rules:
class CommentNotificationJob < ApplicationJob
queue_as :default
def perform(comment_id)
comment = Comment.find_by(id: comment_id)
return unless comment # idempotent: nothing to do if it's gone
CommentMailer.posted(comment).deliver_now
end
endFor genuinely long work (large backfills, bulk exports) use Active Job Continuations
(Rails 8.1) so a job can checkpoint and resume instead of restarting from zero. Cache
expensive view fragments with the cache helper backed by Solid Cache:
<% cache @post do %>
<%= render @post.comments %>
<% end %>Do not add Sidekiq/Redis to a Rails 8 app unless a real, stated throughput or latency requirement justifies the extra moving part. Solid Queue covers the default case on the database you already run.
Minitest + fixtures is the framework default; parallel execution is on by default. RSpec-rails (8.x) is the popular alternative. Pick one and exercise behavior through the request, never private methods.
| Test type | Base class | Tests |
|---|---|---|
| Model / unit | ActiveSupport::TestCase | validations, scopes, domain methods |
| Integration | ActionDispatch::IntegrationTest | a request → response, status, redirects |
| System (browser) | ApplicationSystemTestCase | end-to-end UI incl. Turbo/Stimulus |
| Job | ActiveJob::TestCase | enqueue + perform behavior |
Fixtures (default) are fast and load once; reach for factories (FactoryBot) only when
per-test object variation gets unwieldy. Flaky Turbo system test? It's almost always
a timing race: never sleep. Use Capybara's auto-waiting matchers (assert_selector,
assert_text, assert_no_selector) which retry until the DOM settles, and swap the
default Selenium driver for Cuprite or Playwright to cut Turbo-timing flake.
Minitest vs RSpec layout, fixtures gotchas, driver config, parallelization, and
request-spec / broadcast-testing patterns are in references/testing.md.
| Anti-pattern | Why it bites | Do instead |
|---|---|---|
| Business logic in the controller | Untestable except through HTTP; not reusable | Push it onto the model; service object only for cross-model/IO |
Callback soup (after_save chains for business rules) | Hidden order-dependent side effects, brutal to test | Explicit method called from the action; reserve callbacks for data hygiene |
| Touching an association in a loop | N+1 — one query per row, silent in dev | includes/preload/eager_load; gate with bullet/strict_loading |
| Blocking DDL on a big live table | Locks readers + writers for the whole migration | disable_ddl_transaction! + algorithm: :concurrently; strong_migrations |
| Passing AR records into jobs | Stale serialized state; fails on retry | Pass IDs, re-find inside perform |
| Adding Sidekiq/Redis to a Rails 8 app by reflex | A new daemon + dependency for nothing | Solid Queue is the default; add Sidekiq only for a stated need |
| Queries or business logic in views | N+1 + logic you can't test | Prepare in controller/model; views only render |
| Testing private methods | Locks tests to internals; refactors break green tests | Test observable behavior through the request |
Hand-rolled fetch/JS for live updates | Reinvents what Turbo gives free | Turbo Stream or morphing |
Run scripts/verify.sh inside a Rails app for a read-only static gate: it runs RuboCop
(if rubocop-rails is configured) and bin/rails zeitwerk:check, and greps for the
statically-detectable anti-patterns above (Sidekiq/Redis in a default app, .all.each
mass loads, a concurrent add_index missing disable_ddl_transaction!). It skips any
check whose tooling is absent and exits non-zero only on a hard violation.
© ericrisco, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 6 other files (scripts, references) in skills/rails of ericrisco/rsc-harness.
Open the folder on GitHubat commit e3d5b33
Rails next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Rails this skillericrisco/rsc-harness | 167 | — | ~3.1k | Automated safety check: Pass | MIT | |
| Ruby Patternssoftspark/ai-toolkit | 179 | — | ~2.3k | Automated safety check: Pass | Apache-2.0 | |
| Ruby Rulessoftspark/ai-toolkit | 179 | — | ~3.4k | Automated safety check: Pass | Apache-2.0 | |
| Rails ExpertJeffallan/claude-skills | 12k | — | ~1.4k | Automated safety check: Pass | MIT | |
| Rails Patternsaffaan-m/ECC | 275k | — | ~4.1k | Automated safety check: Pass | MIT | |
| Rails Idiomsirahardianto/awesome-agv | 157 | — | ~1.8k | Automated safety check: Pass | MIT |
softspark/ai-toolkit
Ruby/Rails: blocks, metaprogramming, ActiveRecord, Sidekiq, RSpec, Sorbet, Hanami.
softspark/ai-toolkit
Ruby coding rules: style, patterns, security, testing. An agent skill from softspark/ai-toolkit.
Jeffallan/claude-skills
Builds Rails 7+ apps with Hotwire Turbo Frames and Streams, Active Record tuning, Action Cable, Sidekiq jobs and RSpec specs, with migration and N+1 checks.
affaan-m/ECC
Ruby on Rails framework patterns for Rails 7.1+ and 8.x apps.
irahardianto/awesome-agv
Ruby on Rails framework patterns: ActiveRecord scopes, N+1 query prevention, model validations, RESTful routing, and RSpec/Minitest testing.
hashgraph-online/awesome-codex-plugins
A skill your agent uses when adding, changing, testing, or debugging Django Q2 background tasks, scheduled jobs, qcluster workers, Redis broker configuration, or ORM broker fallback in Django…
ericrisco/rsc-harness
A skill your agent uses when designing or analyzing a controlled experiment — falsifiable hypothesis, sample size from an MDE, reading significance/CI/power, CUPED, or rescuing tests that won't go…
ericrisco/rsc-harness
A skill your agent uses when making a web UI conform to WCAG 2.2 Level AA — axe-core or Lighthouse a11y violations, keyboard operability, focus management, ARIA roles/names/live regions, contrast…
ericrisco/rsc-harness
A skill your agent uses when running or fixing paid acquisition on Google or Meta — campaign structure (Performance Max, Demand Gen, Search, Advantage+), platform-fit creative, budget/scaling rules…
ericrisco/rsc-harness
A skill your agent uses when measuring whether an LLM or agent system actually got better and gating merges on it: golden sets, fixing an inflated LLM-as-judge, scoring RAG (faithfulness, contextual…
ericrisco/rsc-harness
A skill your agent uses when a creative goal must become a finished media file: pick and order generative-media models per modality — AI voiceover, image-to-video clips, score — then glue them with…
ericrisco/rsc-harness
A skill your agent uses when instrumenting product or web analytics — GA4/PostHog SDK wiring, event taxonomy, funnels, double-counted events, consent gating, PII scrubbing.
Works with
Categories
A skill your agent uses when building or maintaining a Ruby on Rails app — models, controllers, views, routes and migrations; ActiveRecord associations, scopes and query performance; Hotwire (Turbo…. Rails is an agent skill from ericrisco/rsc-harness. Use when building or maintaining a Ruby on Rails app — models, controllers, views, routes and migrations; ActiveRecord associations, scopes and query performance; Hotwire (Turbo and Stimulus) UI; Active Job or Solid Queue background work; and Rails tests.
Rails fits situations like: maintaining a Ruby on Rails app — models; routes and migrations; activeRecord associations; scopes and query performance.
Run `npx skills add ericrisco/rsc-harness --skill rails -a claude-code`. Or copy the skill folder (skills/rails in ericrisco/rsc-harness) into .claude/skills/rails in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ericrisco/rsc-harness --skill rails -a codex`. Or copy the skill folder (skills/rails in ericrisco/rsc-harness) into .agents/skills/rails in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ericrisco/rsc-harness --skill rails -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rails, .gemini/skills/rails, .github/skills/rails and .opencode/skills/rails in your project.
Going by SKILL.md and its folder, Rails needs a shell for the scripts in its folder and the command-line tools its instructions call (rails). Our summary lists: A Bash shell; Docker.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
Rails is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.1k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Rails: Ruby Patterns (softspark/ai-toolkit, 179 stars), Ruby Rules (softspark/ai-toolkit, 179 stars), Rails Expert (Jeffallan/claude-skills, 12k stars) and Rails Patterns (affaan-m/ECC, 275k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
ericrisco (a GitHub user) maintains it in ericrisco/rsc-harness, which has 167 GitHub stars. The repository holds 227 skills in this directory. The repository was last updated on October 7, 2026.
Source: ericrisco/rsc-harness on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.