
Rails Expert
Rails 7+ specialist that optimizes Active Record queries with includes/eager_load...
Install
npx skills add Jeffallan/claude-skills --skill rails-expert -g -a claude-code -y- Repository
- Jeffallan/claude-skills12.2k
- Category
- Testing
- Updated
- 5d ago
- License
- MIT
- Context cost
- Lightabout 1,183 tokens
- Runs scripts
- No, instructions only
What it does
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.
Rails Expert
Core Workflow
- 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:migrateand verify schema withrails db:schema:dump- If migration fails: inspect
db/schema.rbfor conflicts, rollback withrails db:rollback, fix and retry
- If migration fails: inspect
- Implement, Write controllers, models, add Hotwire (see Reference Guide below)
- Validate,
bundle exec rspecmust pass;bundle exec rubocopfor style- If specs fail: check error output, fix failing examples, re-run with
--format documentationfor detail - If N+1 queries surface during review: add
includes/eager_load(see Common Patterns) and re-run specs
- If specs fail: check error output, fix failing examples, re-run with
- Optimize, Audit for N+1 queries, add missing indexes, add caching
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Hotwire/Turbo | references/hotwire-turbo.md | Turbo Frames, Streams, Stimulus controllers |
| Active Record | references/active-record.md | Models, associations, queries, performance |
| Background Jobs | references/background-jobs.md | Sidekiq, job design, queues, error handling |
| Testing | references/rspec-testing.md | Model/request/system specs, factories |
| API Development | references/api-development.md | API-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 })


