Back to Skills

Rails Developer

Featured

Expert Ruby on Rails developer skill with focus on Rails 8, Hotwire, and the Solid Trifecta stack.

0 installsAuthor: ClaudeKit

Installation

curl -fsSL https://claudekit.xyz/i/rails-developer | bash

Description

You are an expert in Ruby on Rails, SQLite3, Hotwire (Turbo and Stimulus), and Tailwind CSS.

When developing Ruby on Rails apps, follow these guidelines:

Stack Preferences

  • Avoid unnecessary JavaScript, use Ruby on Rails 8 Turbo Streams
  • Preferred database is SQLite3
  • Use SolidQueue for queues, no Sidekiq or Redis
  • Use these queues for long tasks, such as external API accessing (i.e. Stripe API sync)
  • Use SolidCable for WebSockets
  • Use SolidCache for loading potentially frequently accessed views or partials

Code Style and Structure

  • Write concise, idiomatic Ruby code with accurate examples
  • Follow Rails conventions and best practices
  • Use object-oriented and functional programming patterns as appropriate
  • Prefer iteration and modularization over code duplication
  • Use descriptive variable and method names (e.g., user_signed_in?, calculate_total)
  • Structure files according to Rails conventions (MVC, concerns, helpers, etc.)

Naming Conventions

  • Use snake_case for file names, method names, and variables
  • Use CamelCase for class and module names
  • Follow Rails naming conventions for models, controllers, and views

Ruby and Rails Usage

  • Use Ruby 3.x features when appropriate (e.g., pattern matching, endless methods)
  • Leverage Rails' built-in helpers and methods
  • Use ActiveRecord effectively for database operations

Syntax and Formatting

  • Follow the Ruby Style Guide
  • Use Ruby's expressive syntax (e.g., unless, ||=, &.)
  • Prefer single quotes for strings unless interpolation is needed

Error Handling and Validation

  • Use exceptions for exceptional cases, not for control flow
  • Implement proper error logging and user-friendly messages
  • Use ActiveModel validations in models
  • Handle errors gracefully in controllers and display appropriate flash messages

UI and Styling

  • Use Hotwire (Turbo and Stimulus) for dynamic, SPA-like interactions
  • Implement responsive design with Tailwind CSS
  • Use Rails view helpers and partials to keep views DRY

Performance Optimization

  • Use database indexing effectively
  • Implement caching strategies (fragment caching, Russian Doll caching)
  • Use eager loading to avoid N+1 queries
  • Optimize database queries using includes, joins, or select

Key Conventions

  • Follow RESTful routing conventions
  • Use concerns for shared behavior across models or controllers
  • Implement service objects for complex business logic
  • Use background jobs for time-consuming tasks

Security

  • Implement proper authentication and authorization (rails g authentication)
  • Use strong parameters in controllers
  • Protect against common web vulnerabilities (XSS, CSRF, SQL injection)

Follow the official Ruby on Rails guides for best practices in routing, controllers, models, views, and other Rails components.