rails-expert
하는 일
Ruby on Rails 7 이상으로 웹 애플리케이션을 만들도록 AI 에이전트를 안내합니다. 실시간 업데이트와 백그라운드 작업이 있는 Rails 앱을 만드는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓Hotwire, Turbo Frames, Turbo Streams로 Rails 7 앱을 만들 때.
- ✓Sidekiq 백그라운드 작업이나 Action Cable 실시간 기능이 필요할 때.
- ✓Active Record 쿼리가 N+1 문제를 일으켜 고쳐야 할 때.
스킬 링크
https://github.com/Jeffallan/claude-skills/blob/main/skills/rails-expert/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이메일 알림용 Sidekiq 작업과 Turbo Streams로 실시간 업데이트를 제공하는 Rails 7 작업 보드를 만들어 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 모델과 컨트롤러를 생성하고, Hotwire로 부분 페이지 업데이트를 추가한 뒤 백그라운드 작업을 설정합니다. 그다음 RSpec과 RuboCop으로 작업을 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
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 })
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_loadon 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, orJOIN - 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_sqlor parameterized queries only) - Expose internal IDs in URLs without consideration
Output Templates
When implementing Rails features, provide:
- Migration file (if schema changes needed)
- Model file with associations and validations
- Controller with RESTful actions and strong parameters
- View files or Hotwire setup
- Spec files for models and requests
- Brief explanation of architectural de
자주 묻는 질문
느린 데이터베이스 쿼리는 어떻게 고치나요?
includes나 eager_load를 추가해 N+1 쿼리를 없애며, 빠진 인덱스도 추가할 수 있습니다.
어떤 테스트 프레임워크를 쓰나요?
RSpec 모델, 요청, 시스템 스펙을 작성합니다.
캐싱도 다루나요?
네. 페이지 속도를 높이는 데 도움이 되는 곳에 캐싱을 추가합니다.
상세 정보
작성자의 원본 설명
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.
repo: Jeffallan/claude-skills
인기도
- GitHub 스타
- 12k
- 순위
- #11449
- 라이선스
- MIT
- 업데이트
- 2026. 10. 30.
댓글
- …
이 저장소의 다른 스킬
angular-architect
12k에이전트가 독립형 컴포넌트, 지연 로딩 라우팅, NgRx 상태 관리, RxJS 패턴, 성능 최적화를 갖춘 Angular 17 이상 앱을 만들도록 돕습니다.
api-designer
12k에이전트가 REST 또는 GraphQL API를 설계하고 OpenAPI 3.1 명세를 작성하도록 돕습니다. 리소스, 페이지네이션, 오류 형식, 버전 관리 규칙을 포함합니다.
architecture-designer
12k에이전트가 시스템 아키텍처를 설계하고, 패턴과 기술을 비교하며, 각 선택의 이유를 설명하는 ADR을 작성하도록 돕습니다.
atlassian-mcp
12kMCP를 통해 Jira 이슈와 Confluence 페이지를 검색하고 수정하도록 에이전트를 돕습니다. JQL과 CQL 검색, 스프린트, 문서 동기화를 포함합니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.