Skip to main content
subagent CX Codex

rails-expert · 0xfurai — Claude Code subagent: what it does, how to install

rails-expert guides Claude Code through Ruby on Rails development with ActiveRecord optimizations, RSpec testing patterns, and architectural conventions.

MIT ★ 1,029 updated 2025-10-15

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/rails-expert.md
Open on GitHub

What rails-expert does

This subagent directs Claude Code to follow standard Ruby on Rails conventions. It enforces MVC architecture, checks RESTful controllers, manages ActiveRecord associations, and eliminates N+1 queries using eager loading. It also covers background processing with Sidekiq or ActiveJob and WebSockets via ActionCable.

The checklist relies on RSpec and Capybara for test coverage, while frontend interactions point to Turbo and partials.

The configuration pins claude-sonnet-4-20250514 in its frontmatter. Running it requires access to that model tier in your environment.

What it helps with

  • Detect and fix N+1 database queries in ActiveRecord
  • Generate safe migrations with explicit rollback steps
  • Write feature specs using RSpec and Capybara
  • Configure background workers with ActiveJob and Sidekiq

Example prompts for the agent

  • Review OrdersController for N+1 query bottlenecks and add eager loading
  • Generate a Subscription model with validations and a rollback-ready migration
  • Write RSpec feature tests covering the checkout workflow

How to install rails-expert

Manually: put the files in place

.claude/agents/rails-expert.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about rails-expert

How to install rails-expert in Claude Code?

Save the subagent configuration file to .claude/agents/rails-expert.md in your repository.

What does the rails-expert subagent do?

It instructs Claude Code to enforce Rails architecture rules, optimize SQL queries, and structure controller logic cleanly.

Which testing framework does rails-expert expect?

The instructions mandate RSpec paired with Capybara rather than the standard Rails Minitest suite.

Source text

rails-expert.md · MIT
---
name: rails-expert
description: Master Ruby on Rails for building scalable, maintainable, and performant web applications. Use proactively for Rails optimization, refactoring, or ensuring best practices in Rails projects.
model: claude-sonnet-4-20250514
---

## Focus Areas

- Rails MVC (Model-View-Controller) architecture
- RESTful resource routing and controllers
- ActiveRecord associations, validations, and callbacks
- Rail's asset pipeline for managing front-end resources
- Strong parameter handling and security best practices
- Rails migrations and schema management
- Background jobs with ActiveJob and Sidekiq
- ActionCable for real-time features with WebSockets
- Internationalization (I18n) and localization support
- Performance optimization with caching and eager loading

## Approach

- Follow Rails best practices and conventions
- Use `rails generate` for scaffolding resources efficiently
- Practice DRY principles in controllers and views
- Utilize partials and helpers to maintain clean views
- Implement feature tests with RSpec and Capybara
- Prioritize security by validating user inputs and applying CSRF protection
- Use Rails console for debugging and testing code snippets
- Regularly update gems and Rails versions to remain secure
- Monitor application performance with tools like NewRelic
- Document code with comments and documentation for ease of maintenance

## Quality Checklist

- All models and controllers follow Single Responsibility Principle
- Consistent use of RESTful routes and actions in controllers
- Comprehensive test coverage for models, controllers, and views
- Proper use of scopes and query optimizations in ActiveRecord
- Efficient management of database transactions and connections
- No N+1 query issues in views or controllers
- Use of `turbo` for fast, responsive UIs with minimal JavaScript
- Accessible user interfaces with semantic HTML and ARIA roles
- Secure handling of user authentication and authorization
- Properly configured environments and deployment setup for different stages

## Output

- Rails applications with clean, readable code and file structure
- Well-structured migrations with rollback support
- Reusable components and service objects for complex logic
- Thoroughly tested application with RSpec for robust deployments
- Scalable application architecture ready for production traffic
- Clear documentation with README and API docs available
- High-performance applications with optimized database interactions
- Secure applications with reduced vulnerabilities and attack surface
- Real-time features using ActionCable efficiently
- Internationalized applications ready for global users

© 0xfurai · MIT · 0xfurai/claude-code-subagents

Similar subagents

All subagents for Backend and APIs →

rails-expert by other authors comes first.

rails-expert VoltAgent Community rails-expert tailors Rails architecture to version 7.x or 8.x based on Gemfile.lock. Handles Hotwire, Solid Queue jobs, database migrations, and test suites. CX Codex 199installs rails-expert VoltAgent rails-expert traces Rails changes from request entry point to persistence and response. Use it to investigate bugs or scope a fix that stays within the project’s existing conventions. CX Codex ★ 6,505repo stars ruby-rails Mindrally ruby-rails is a Claude Code skill that gives coding agents Rails conventions for idiomatic code, covering ActiveRecord, Hotwire, background jobs and tests. CX Codex +1 907installs rails-dev pproenca Set of guidelines for Ruby on Rails development. Helps build clean controllers, optimize ActiveRecord queries, and configure caching. CX Codex +1 299installs rails-query lewispb Answers database questions about Rails 8.2+ applications via rails query locally or through Kamal. Safely inspects schemas and records without opening a console. ★ 26repo stars inertia-rails-testing inertia-rails inertia-rails-testing — a skill that tells your agent how to test Inertia Rails responses with RSpec and Minitest matchers instead of raw JSON checks. CX Codex +1 479installs rails-testing pproenca rails-testing — a set of 46 rules for RSpec, FactoryBot, and Capybara in Ruby on Rails. Guides your AI agent during test generation, reviews, and test suite refactoring. CX Codex +1 309installs inertia-rails-controllers inertia-rails inertia-rails-controllers — a skill for AI coding in Claude Code, Cursor and other editors. CX Codex +1 505installs

From the same set137

The whole set →
grpc-expert grpc-expert — a Claude subagent for gRPC work: streaming, protobuf, channel setup, load balancing and tracing. Useful when calls fail with vague status codes. CX Codex ★ 1,029repo stars postgres-expert postgres-expert helps design PostgreSQL schemas, optimize slow SQL queries, and configure indexes for balanced read and write performance. CX Codex ★ 1,029repo stars graphql-expert The graphql-expert subagent helps design GraphQL schemas, improve queries, and review API architecture. Use it when performance, introspection, or schema changes need attention. CX Codex ★ 1,029repo stars nodejs-expert nodejs-expert — a Claude subagent for server-side Node.js work: async patterns, streams, Express APIs, profiling. Tests, linting and a dependency audit are part of its brief. CX Codex ★ 1,029repo stars elasticsearch-expert The elasticsearch-expert subagent helps inspect Elasticsearch clusters, refine search queries, and plan indexing and recovery work. Use it when troubleshooting cluster health or tuning performance. CX Codex ★ 1,029repo stars gitlab-ci-expert gitlab-ci-expert — a Claude subagent that writes and reviews .gitlab-ci.yml: stage order, caching, artifacts, conditional jobs, masked secrets. Useful when a pipeline rebuilds the same things on every commit. CX Codex ★ 1,029repo stars prisma-expert prisma-expert designs Prisma schemas, refines database queries, and manages migrations. Useful for keeping TypeScript database code strictly typed and performant. CX Codex ★ 1,029repo stars django-expert django-expert — a Claude subagent that writes Django code: ORM models, views, DRF endpoints, middleware and caching. Handy when a task turns on query performance or API shape. CX Codex ★ 1,029repo stars

Project sponsors

Companies that keep this analytics open