Skip to main content

rails-patterns

Ruby on Rails 7+ patterns and conventions. Covers Hotwire, Turbo, Stimulus, Active Record, and modern Rails architecture.

소스 정보

저장소
skeletorflet/opencode-kit
최근 소스 활동
2026년 3월 31일 18:16
감지된 SKILL.md 언어
영어
스타
9
포크
1

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
rails-patterns
description
Ruby on Rails 7+ patterns and conventions. Covers Hotwire, Turbo, Stimulus, Active Record, and modern Rails architecture.
license
MIT
compatibility
opencode
metadata
{"audience":"developers","category":"backend"}
# Rails Patterns ## What I Do - Build Rails 7+ applications with Hotwire (Turbo + Stimulus) - Design Active Record models with proper associations - Implement background jobs with Sidekiq or Good Job - Structure Rails applications for maintainability - Apply Rails security best practices ## When to Use Me - Creating or extending Rails applications - Implementing Hotwire/Turbo features - Designing database schemas with migrations - Setting up background job processing - Refactoring Rails code for maintainability ## Key Principles 1. **Fat Model, Skinny Controller**: Business logic in models/services 2. **Convention Over Configuration**: Follow Rails conventions 3. **Strong Parameters**: Always whitelist permitted params 4. **N+1 Prevention**: Use includes/eager_load for associations 5. **Service Objects**: Extract complex logic into PORO services ## Common Patterns ### Service Object ```ruby class UserRegistrationService def initialize(params) @params = params end def call User.transaction do @user = User.new(@params) @user.save! UserMailer.welcome(@user).deliver_later @user end rescue ActiveRecord::RecordInvalid => e errors: e.record.errors end end ``` ### Turbo Frame ```erb <%= turbo_frame_tag "messages" do %> <%= render @messages %> <%= link_to "Load more", messages_path(page: @page + 1), data: { turbo_frame: "messages" } %> <% end %> ``` ## Validation ```bash bundle exec rails db:migrate bundle exec rails test bundle exec rubocop ```
GitHub에서 보기