rails-expert
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.
By jeffallan · 4,130 installs
npx skills add jeffallan/claude-skills --skill rails-expert
Source repository · Upstream listing
Rails Expert
Core Workflow
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 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:
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
Turbo Frame Setup (partial page update)
Sidekiq Worker Template
Strong Parameters (controller template)
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](https://jeffallan.github.io/claude skills/skills/backend/rails expert/)