Stats
Actions
Tags
From qe-framework
Rails 7+ specialist optimizing Active Record queries, implementing Turbo Frames/Streams, configuring Action Cable, setting up Sidekiq workers, and writing RSpec test suites.
How this skill is triggered — by the user, by Claude, or both
Slash command
/qe-framework:Qrails-expertThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
1. **Analyze requirements** — Identify models, routes, real-time needs, background jobs
rails generate model User name:string email:string, rails generate controller Usersrails db:migrate and verify schema with rails db:schema:dump
db/schema.rb for conflicts, rollback with rails db:rollback, fix and retrybundle exec rspec must pass; bundle exec rubocop for style
--format documentation for detailincludes/eager_load (see Common Patterns) and re-run specsLoad 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 |
# app/controllers/posts_controller.rb
class PostsController < ApplicationController
# Display all published posts with pagination.
# @param [Integer] page Page number for results (default: 1)
# @return [Array<Post>] Posts for the requested page
def index
@posts = Post.where(published: true).includes(:author).page(params[:page])
end
end
class ApplicationController < ActionController::Base
rescue_from ActiveRecord::RecordNotFound, with: :handle_not_found
rescue_from StandardError, with: :handle_server_error
# @param [Exception] exception The caught exception
# @return [void]
private def handle_not_found(exception)
render "errors/not_found", status: :not_found
end
private def handle_server_error(exception)
Rails.logger.error("Server error: #{exception.message}")
render "errors/server_error", status: :internal_server_error
end
end
# app/models/concerns/publishable.rb
module Publishable
extend ActiveSupport::Concern
# @return [ActiveRecord::Relation] Published records ordered by date
scope :published, -> { where(published: true).order(published_at: :desc) }
# @return [Boolean] True if published and not expired
def available?
published? && published_at <= Time.current
end
end
# app/models/post.rb
class Post < ApplicationRecord
include Publishable
end
# @param [Type] param_name Description of parameter
# @return [Type] Description of return value
# @raise [ErrorClass] Description of error condition
def method_name(param_name)
# implementation
end
bundle exec rubocop for style violations; auto-fix with rubocop -a.rubocop.yml — enforce line length, method length, block nestingbrakeman -z for high/medium severity issuesstrong_params to whitelist input (never permit!)html_safe only on trusted outputauthenticity_token in all forms; verify_authenticity_token is automaticreset_session| Wrong | Correct |
|---|---|
| Business logic in controller actions | Extract to service objects or concerns |
N+1 queries: Post.all.map { |p| p.author.name } | Use includes(:author) before the loop |
| Business logic in ActiveRecord callbacks | Use service objects or job queues instead |
| No database indexes on WHERE/ORDER BY columns | Add indexes: add_index :posts, :user_id |
skip_before_action to bypass auth | Refactor; don't disable security middleware |
includes/eager_load on every collection query involving associationsWHERE, ORDER BY, or JOINsanitize_sql or parameterized queries only)When implementing Rails features, provide:
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub inho-team/qe-framework --plugin qe-framework