rails-backend-expert

rails-backend-expert is an agent for coding agents from dgalarza/claude-code-workflows. It costs 425 tokens per session (1,756 once invoked), scanned A, original, MIT.

A specialist guide for building server-side features in Ruby on Rails, a web framework written in Ruby.

In plain words
What is it for?
Use it for Rails models, controllers, services, jobs, database changes, APIs, background processing, and RSpec test-driven development, where tests guide implementation.
Why use it?
It helps keep Rails backend code consistent with the project's rules for data access, tenants, errors, and background work.

Agent

Part of the rails-toolkit plugin — 2 skills, 2 commands, 4 agents shipped together

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.

agentmods
npx agentmods add agents/dgalarza/claude-code-workflows/rails-backend-expert
Clone the repo
git clone --depth 1 https://github.com/dgalarza/claude-code-workflows

Or install rails-toolkit, the plugin that ships this one along with the rest of its 2 skills, 2 commands, 4 agents.

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 rails-backend-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/dgalarza/claude-code-workflows/rails-backend-expert.svg)](https://agentmods.dev/agents/dgalarza/claude-code-workflows/rails-backend-expert)
Your own site
<a href="https://agentmods.dev/agents/dgalarza/claude-code-workflows/rails-backend-expert"><img src="https://agentmods.dev/badge/agents/dgalarza/claude-code-workflows/rails-backend-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 425 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,756 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00425 $0.01756
Opus 5 $0.00212 $0.00878
Sonnet 5 $0.00085 $0.00351
Haiku 4.5 $0.00042 $0.00176

Measured 4d ago against content hash eb7a67c77dfb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rails-backend-expert 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 4d 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.

plugins/rails-toolkit/agents/rails-backend-expert.md · 143 lines

How it starts

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

You are an elite Ruby on Rails backend architect with deep expertise in building scalable, maintainable Rails applications. You specialize in writing idiomatic Ruby code that follows SOLID principles and Rails conventions while maintaining pragmatic simplicity.

Your Core Expertise

You have mastery in:

  • Rails 7+ conventions including Hotwire, Turbo, and Zeitwerk
  • Object-oriented design following POODR principles (Sandi Metz)
  • Service-oriented architecture and domain-driven design
  • ActiveRecord optimization and database design
  • Multi-tenant architecture with acts_as_tenant
  • Background job processing with Sidekiq
  • RESTful API design and implementation
  • Test-driven development with RSpec

Project-Specific Context

This codebase has specific architectural patterns you MUST follow:

Multi-Tenant Architecture

  • ALL models use acts_as_tenant :tenant for automatic query scoping
  • Model.find(id) is automatically tenant-scoped - never use current_tenant.models.find(id)
  • Add tenant_id directly to all domain models for security and performance
  • RecordNotFound is raised automatically for cross-tenant access attempts

Error Handling Strategy

  • Default to Rails patterns: Use save/save!, boolean returns, and ActiveModel errors
  • Use exceptions for truly exceptional conditions (external API failures, invariant violations)
  • Reserve Result pattern for complex operations with multiple distinct failure modes
  • Consider: Does this operation need more than success/failure? If not, use Rails idioms

Design Patterns

  • Timestamp over Boolean: Use reviewed_at instead of reviewed, approved_at instead of approved
  • Postgres Enums: Use for fixed value sets (artifact_type, relationship_type, etc.)
  • User Tracking: Store reviewed_by_id, approved_by_id directly on models, not in audit logs
  • Service Objects: Verb-based names (CreateUser, ProcessArtifact), single responsibility, appropriate error handling

Database Migrations

Read the full file on GitHub · 143 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. 4d ago First seen · 143 lines · 0 tokens per session scan A eb7a67c77dfb

Subscribe to this mod's changes

rails-backend-expert is an agent published in the GitHub repository dgalarza/claude-code-workflows (59 stars, last pushed 7d ago), licensed MIT. It adds 425 tokens to every session and 1,756 once invoked, about $0.0021 per session on Opus 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 agents, from other repositories

refactoring-agent

Orchestrates incremental refactoring of Rails codebases toward 37signals patterns. WHEN: Refactoring service objects to model methods, converting booleans to state records, migrating from Devise/RSpec/Sidekiq, extracting concerns, or reducing controller complexity. WHEN NOT: Building new features (use…

dilolabs/nosia · 75 tokens

review-agent

Reviews code for adherence to 37signals Rails conventions. Checks for rich models, CRUD controllers, state records, proper concerns, and Hotwire usage. WHEN: Requesting code review, architecture audit, quality analysis, or pattern compliance checks. WHEN NOT: Implementing features (use implement-agent), refactoring…

dilolabs/nosia · 71 tokens

upgrade

Analyzes Rails applications and generates comprehensive upgrade reports with breaking changes, deprecations, and step-by-step migration guides for Rails 6.0 through 8.1.1. Use when upgrading Rails applications, planning multi-hop upgrades, or querying version-specific changes.

maquina-app/rails-claude-code · 56 tokens

review-rails

Rails conventions and architecture reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-rails with artifact paths. Ensures existing framework features are used, not reinvented — reads changed files in full and compares them against siblings and the framework-native form.

hoblin/claude-ruby-marketplace · 64 tokens

rails-expert

Deep Ruby on Rails expertise - ActiveRecord, Hotwire, testing, performance, security.

sergei-aronsen/claude-code-toolkit · 21 tokens

rbs-reviewer

Use this agent to critically review RBS type signatures for quality and correctness. Trigger when user asks to "review RBS", "check type quality", "improve signatures", wants to know if generics should be used, asks about replacing untyped with stricter types, or after writing new RBS signatures that should be…

stevegeek/claude-ruby-plugins · 111 tokens