Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jeffallan avatar

Rails Expert

  • 3.5k installs
  • 10.8k repo stars
  • Updated May 20, 2026
  • jeffallan/claude-skills

rails-expert is an agent skill for optimize rails 7+ active record queries, turbo streams, action cable, and hotwire partial updates.

About

The rails-expert skill Rails 7+ specialist that optimizes Active Record queries with includes/eager_load, implements Turbo Frames and Turbo Streams for partial page updates, configures Action Cable for WebSocket connections, sets up Sidekiq workers for background job processing, and writes comprehensive RSpec test suites. Use when building Rails 7+ web applications with Hotwire, real-time features, or background job processing. Invoke for Active Record optimization, Turbo Frames/Streams, Action Cable, Sidekiq, RSpec Rails. 1. Analyze requirements Identify models, routes, real-time needs, background jobs 2. Scaffold resources rails generate model User name:string email:string, rails generate controller Users 3. Run migrations rails db:migrate and verify schema with rails db:schema:dump - If migration fails: inspect db/schema.rb for conflicts, rollback with rails db:rollback, fix and retry 4. Implement Write controllers, models, add Hotwire (see Reference Guide below) 5. Validate bundle exec rspec must pass; bundle exec rubocop for style - If specs fail: check error output, fix failing examples, re-run with --format documentation for detail - If N+1 queries

  • Analyze requirements — Identify models, routes, real-time needs, background jobs
  • Scaffold resources — rails generate model User name:string email:string, rails generate controller Users
  • Run migrations — rails db:migrate and verify schema with rails db:schema:dump
  • If migration fails: inspect db/schema.rb for conflicts, rollback with rails db:rollback, fix and retry
  • Implement — Write controllers, models, add Hotwire (see Reference Guide below)

Rails Expert by the numbers

  • 3,533 all-time installs (skills.sh)
  • +89 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #170 of 4,386 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

rails-expert capabilities & compatibility

Capabilities
analyze requirements — identify models, routes, · scaffold resources — rails generate model user n · run migrations — rails db:migrate and verify sch · if migration fails: inspect db/schema.rb for con · implement — write controllers, models, add hotwi
Use cases
api development · frontend
From the docs

What rails-expert says it does

1. **Analyze requirements** — Identify models, routes, real-time needs, background jobs
SKILL.md
2. **Scaffold resources** — `rails generate model User name:string email:string`, `rails generate controller Users`
SKILL.md
3. **Run migrations** — `rails db:migrate` and verify schema with `rails db:schema:dump`
SKILL.md
npx skills add https://github.com/jeffallan/claude-skills --skill rails-expert

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3.5k
repo stars10.8k
Security audit3 / 3 scanners passed
Last updatedMay 20, 2026
Repositoryjeffallan/claude-skills

How do I optimize rails 7+ active record queries, turbo streams, action cable, and hotwire partial updates with documented agent guidance?

Optimize Rails 7+ Active Record queries, Turbo Streams, Action Cable, and Hotwire partial updates.

Who is it for?

Developers who need backend & apis help during build work.

Skip if: Skip when the task falls outside Backend & APIs scope described in SKILL.md.

When should I use this skill?

Optimize Rails 7+ Active Record queries, Turbo Streams, Action Cable, and Hotwire partial updates.

What you get

Completed backend & apis workflow aligned with SKILL.md steps and validation.

  • Active Record model Ruby files
  • Association and validation definitions
  • Query optimization recommendations

By the numbers

  • Analyze requirements — Identify models, routes, real-time needs, background jobs
  • Scaffold resources — rails generate model User name:string email:string, rails generate controller Users
  • Run migrations — rails db:migrate and verify schema with rails db:schema:dump

Files

SKILL.mdMarkdownGitHub ↗

Rails Expert

Core Workflow

1. Analyze requirements — Identify models, routes, real-time needs, background jobs 2. Scaffold resourcesrails generate model User name:string email:string, rails generate controller Users 3. Run migrationsrails db:migrate and verify schema with rails db:schema:dump

  • If migration fails: inspect db/schema.rb for conflicts, rollback with rails db:rollback, fix and retry

4. Implement — Write controllers, models, add Hotwire (see Reference Guide below) 5. Validatebundle exec rspec must pass; bundle exec rubocop for style

  • If specs fail: check error output, fix failing examples, re-run with --format documentation for detail
  • If N+1 queries surface during review: add includes/eager_load (see Common Patterns) and re-run specs

6. Optimize — Audit for N+1 queries, add missing indexes, add caching

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
Hotwire/Turboreferences/hotwire-turbo.mdTurbo Frames, Streams, Stimulus controllers
Active Recordreferences/active-record.mdModels, associations, queries, performance
Background Jobsreferences/background-jobs.mdSidekiq, job design, queues, error handling
Testingreferences/rspec-testing.mdModel/request/system specs, factories
API Developmentreferences/api-development.mdAPI-only mode, serialization, authentication

Common Patterns

N+1 Prevention with includes/eager_load

# BAD — triggers N+1
posts = Post.all
posts.each { |post| puts post.author.name }

# GOOD — eager load association
posts = Post.includes(:author).all
posts.each { |post| puts post.author.name }

# GOOD — eager_load forces a JOIN (useful when filtering on association)
posts = Post.eager_load(:author).where(authors: { verified: true })

Turbo Frame Setup (partial page update)

<%# app/views/posts/index.html.erb %>
<%= turbo_frame_tag "posts" do %>
  <%= render @posts %>
  <%= link_to "Load More", posts_path(page: @next_page) %>
<% end %>

<%# app/views/posts/_post.html.erb %>
<%= turbo_frame_tag dom_id(post) do %>
  <h2><%= post.title %></h2>
  <%= link_to "Edit", edit_post_path(post) %>
<% end %>
# app/controllers/posts_controller.rb
def index
  @posts = Post.includes(:author).page(params[:page])
  @next_page = @posts.next_page
end

Sidekiq Worker Template

# app/jobs/send_welcome_email_job.rb
class SendWelcomeEmailJob < ApplicationJob
  queue_as :default
  sidekiq_options retry: 3, dead: false

  def perform(user_id)
    user = User.find(user_id)
    UserMailer.welcome(user).deliver_now
  rescue ActiveRecord::RecordNotFound => e
    Rails.logger.warn("SendWelcomeEmailJob: user #{user_id} not found — #{e.message}")
    # Do not re-raise; record is gone, no point retrying
  end
end

# Enqueue from controller or model callback
SendWelcomeEmailJob.perform_later(user.id)

Strong Parameters (controller template)

# app/controllers/posts_controller.rb
class PostsController < ApplicationController
  before_action :set_post, only: %i[show edit update destroy]

  def create
    @post = Post.new(post_params)
    if @post.save
      redirect_to @post, notice: "Post created."
    else
      render :new, status: :unprocessable_entity
    end
  end

  private

  def set_post
    @post = Post.find(params[:id])
  end

  def post_params
    params.require(:post).permit(:title, :body, :published_at)
  end
end

Constraints

MUST DO

  • Prevent N+1 queries with includes/eager_load on every collection query involving associations
  • Write comprehensive specs targeting >95% coverage
  • Use service objects for complex business logic; keep controllers thin
  • Add database indexes for every column used in WHERE, ORDER BY, or JOIN
  • Offload slow operations to Sidekiq — never run them synchronously in a request cycle

MUST NOT DO

  • Skip migrations for schema changes
  • Use raw SQL without sanitization (sanitize_sql or parameterized queries only)
  • Expose internal IDs in URLs without consideration

Output Templates

When implementing Rails features, provide: 1. Migration file (if schema changes needed) 2. Model file with associations and validations 3. Controller with RESTful actions and strong parameters 4. View files or Hotwire setup 5. Spec files for models and requests 6. Brief explanation of architectural decisions

Documentation

Related skills

How it compares

rails-expert is an agent skill for optimize rails 7+ active record queries, turbo streams, action cable, and hotwire partial updates, not a generic alternative.

FAQ

Who is rails-expert for?

Developers using Backend & APIs workflows with agent-guided SKILL.md steps.

When should I use rails-expert?

Optimize Rails 7+ Active Record queries, Turbo Streams, Action Cable, and Hotwire partial updates.

Is rails-expert safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.