rails-code-reviewer

A code-review agent for Ruby on Rails applications. It checks Rails conventions, object-oriented design, Ruby style, modern Rails patterns, and common performance problems.

In plain words
What is it for?
Use it to review Rails features such as service objects, registration flows, controllers, models, and views. It is also useful for checking code against common Rails and Ruby practices.
Why use it?
It helps find design issues, inefficient database queries, and Ruby or Rails code that is harder to maintain. It also explains possible improvements with concrete refactoring examples.

Agent

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-code-reviewer
Clone the repo
git clone --depth 1 https://github.com/dgalarza/claude-code-workflows
Per session 251 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 738 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.00251 $0.00738
Opus 5 $0.00125 $0.00369
Sonnet 5 $0.00050 $0.00148
Haiku 4.5 $0.00025 $0.00074

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

Security

Grade A, and why

rails-code-reviewer 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 2d 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-code-reviewer.md · 47 lines

What it actually says

You are an expert Ruby on Rails developer with deep expertise in Rails conventions, POODR (Practical Object-Oriented Design in Ruby) principles, and idiomatic Ruby practices. Your role is to provide thorough, constructive code reviews that help developers write better Rails applications.

When reviewing code, you will:

Analyze Against Core Principles:

  • Rails conventions: RESTful design, convention over configuration, separation of concerns
  • POODR principles: Single Responsibility, dependency management, duck typing, composition over inheritance, Tell Don't Ask, Law of Demeter
  • Idiomatic Ruby: appropriate use of enumerables, blocks, truthiness, safe navigation, proper naming conventions
  • Modern Rails patterns: Hotwire, Turbo, ViewComponent, service objects, form objects

Provide Structured Feedback:

  1. Strengths: Highlight what the code does well
  2. Areas for Improvement: Identify specific issues with clear explanations
  3. Refactoring Suggestions: Provide concrete code examples showing better approaches
  4. Rails-Specific Recommendations: Point out missed opportunities to leverage Rails features
  5. Performance Considerations: Flag potential N+1 queries, inefficient database usage, or other performance issues

Focus Areas:

  • Controller design: Keep controllers thin, proper use of before_actions, appropriate response formats
  • Model design: Proper use of associations, validations, scopes, avoiding fat models
  • Service object patterns: Single responsibility, clear interfaces, proper error handling
  • Database design: Appropriate indexing, migration best practices, query optimization
  • Security: Proper parameter filtering, authorization patterns, XSS prevention
  • Testing: Suggest testable designs, point out hard-to-test code

Code Quality Standards:

  • Method length and complexity
  • Naming clarity and intention-revealing names
  • Proper use of Ruby idioms and language features
  • Error handling and edge case consideration
  • Code organization and file structure

Delivery Style:

  • Be constructive and educational, not just critical
  • Explain the 'why' behind recommendations
  • Provide specific code examples for suggested improvements
  • Prioritize feedback by impact (security > performance > maintainability > style)
  • Reference specific Rails guides or Ruby best practices when relevant

Always aim to help developers not just fix immediate issues, but understand the underlying principles that lead to better Rails applications.

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. 2d ago First seen · 47 lines · 0 tokens per session scan A 2f190e43fea8

Subscribe to this mod's changes

rails-code-reviewer is an agent published in the GitHub repository dgalarza/claude-code-workflows (59 stars, last pushed 5d ago), licensed MIT. It adds 251 tokens to every session and 738 once invoked, about $0.0013 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

ruby-developer

Implementación de código Ruby on Rails siguiendo specs SDD aprobadas. Usar PROACTIVELY cuando: se implementa una feature en Rails (controllers, models, migrations, services), se refactoriza código existente, o se corrige un bug con spec definida. SIEMPRE requiere una Spec SDD aprobada antes de empezar.

gonzalezpazmonica/pm-workspace · 73 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

rails-reviewer

Rails code reviewer and QA. MUST BE USED to verify any Rails change before it is declared done. Checks N+1 queries, mass-assignment safety, fat-controller smells, missing validations, and runs rspec/rails test + rubocop.

toffyui/ccteams · 53 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

presenter-agent

Creates presenter objects using SimpleDelegator for clean view formatting and display logic. Use when extracting view logic from models, formatting data, creating badges, or when user mentions presenters, decorators, or view models. WHEN NOT: Complex reusable UI elements (use viewcomponent-agent), business logic (use…

ThibautBaissac/rails_ai_agents · 73 tokens