Skip to main content
skill CX Codex

ruby-rails — Claude Code skill: Rails conventions and Hotwire

This skill hands your agent Rails conventions: generators over boilerplate, ActiveRecord patterns, Hotwire, background jobs and tests. Useful on a fresh app or an existing one.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill ruby-rails -a claude-code
Open on GitHub

What ruby-rails does

The skill covers Ruby and Rails development: idiomatic Ruby, Convention over Configuration, the Ruby Style Guide. It tells the agent to scaffold with bin/rails generate ... instead of writing boilerplate by hand, and to run the dev server with bin/dev.

Sections cover architecture, frontend, security and testing. For the database it recommends PostgreSQL with indexes, connection pooling and reversible migrations, eager loading against N+1, fragment and Russian Doll caching, service objects for complex logic. On Rails 8 it points to Solid Queue, Solid Cache, Solid Cable, Propshaft and Kamal instead of external services. Interactivity goes through Hotwire (Turbo and Stimulus), styling through Tailwind CSS, reusable UI through ViewComponents.

Testing means Minitest or RSpec with TDD, FactoryBot for data, mocked external services, independent tests. Auth is Devise or Pundit, plus strong parameters and CSRF tokens. One caveat worth checking: the skill advises against adding a Vite-managed npm pipeline by default, so reach for it only when the project actually has React or Vue components.

What it helps with

  • scaffold a Rails app without hand-writing boilerplate
  • design ActiveRecord models and safe reversible migrations
  • kill N+1 queries with eager loading
  • wire up Turbo and Stimulus without full page reloads
  • write RSpec or Minitest coverage with FactoryBot

Example prompts for the agent

  • Generate an Order model with a migration and an index on user_id
  • Rewrite this controller so loading orders doesn't trigger N+1
  • Add a Turbo Frame that refreshes the task list without a reload

How to install ruby-rails

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill ruby-rails -a claude-code

2Manually: put the files in place

~/.claude/skills/ruby-rails/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/ruby-rails/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about ruby-rails

How do I install ruby-rails in Claude?

Run npx skills add Mindrally/skills --skill ruby-rails -a claude-code. The skill file then lands at ~/.claude/skills/ruby-rails/SKILL.md.

What does ruby-rails do?

It gives the agent Rails conventions: generators instead of manual code, ActiveRecord patterns, Hotwire, background jobs, caching and tests. It kicks in during scaffolding, model design and test writing.

Do I need Redis for jobs and caching?

The skill leans on the Rails 8 stack and suggests Solid Queue, Solid Cache and Solid Cable backed by the database. Add Redis or Sidekiq only when job volume or features call for it.

Source text

SKILL.md · Apache-2.0
---
name: ruby-rails
description: "Conventions and best practices for building web applications with Ruby on Rails. Use when scaffolding Rails apps or generators, designing ActiveRecord models and migrations, wiring up Hotwire/Turbo/Stimulus interactivity, setting up background jobs or caching, or writing RSpec/Minitest coverage for Rails code."
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Ruby on Rails

This skill covers Ruby and Ruby on Rails development, including Rails conventions, ActiveRecord patterns, frontend integration, security, and testing.

## Core Principles

- Write concise, idiomatic Ruby code with accurate examples
- Adhere to Rails conventions (Convention over Configuration)
- Follow the Ruby Style Guide for formatting consistency
- Leverage Ruby 3.x features like pattern matching and endless methods
- Prefer Rails command-line generators (`bin/rails generate ...`) over hand-written boilerplate — they keep files consistent with framework conventions and wire up tests/routes automatically
- Use `bin/dev` to run the local development server (it boots the web process plus any configured watchers) and check logs after significant changes

## Naming Conventions

- Use snake_case for files, methods, and variables
- Use CamelCase for classes and modules
- Follow Rails naming conventions for models, controllers, views

## Architecture & Performance

- Utilize ActiveRecord for database operations with proper indexing
- Use PostgreSQL in production, with proper indexes, connection pooling, and safe/reversible migrations
- Implement eager loading to prevent N+1 query problems
- Apply fragment caching and Russian Doll caching strategies
- Use service objects for complex business logic
- Follow MVC architecture strictly
- Keep controllers RESTful and focused

## Rails 8 Defaults

Rails 8 ships with a "no PaaS needed" stack — favor these built-ins over adding external services unless there's a specific reason not to:

- **Solid Queue** — database-backed ActiveJob adapter; use it as the default background job backend instead of standing up Redis/Sidekiq unless job volume or feature needs (e.g., Sidekiq Pro batches) require it
- **Solid Cache** — database-backed cache store; a reasonable default for Rails.cache without a separate Redis/Memcached deployment
- **Solid Cable** — database-backed Action Cable adapter for WebSockets without Redis
- **Propshaft** — the default asset pipeline; simpler than Sprockets, just serves fingerprinted files without a bundling step
- **Kamal** — the default deployment tool for shipping containerized Rails apps to your own servers

## Frontend & UI

- Employ Hotwire (Turbo and Stimulus) for standard Rails interactivity and dynamic interactions without full page reloads
- Reach for a Vite-managed JS pipeline (e.g., vite_rails) only when you actually need npm-managed JavaScript (React/Vue components, complex bundling) — don't add it by default
- Design responsively with Tailwind CSS
- Maintain DRY views through helpers and partials
- Use ViewComponents for reusable UI components

## Security

- Implement authentication/authorization via Devise or Pundit
- Use strong parameters in controllers to prevent mass assignment vulnerabilities
- Sanitize user inputs appropriately
- Use CSRF protection tokens
- Implement proper session management

## Testing

- Write comprehensive Minitest or RSpec coverage for models, controllers, and integration flows, following TDD practices
- Use FactoryBot for test data generation rather than fixtures
- Mock external services; stub predefined return values
- Use shared examples for common behaviors across different contexts
- Ensure each test is independent; avoid shared state between tests

## Best Practices

- Keep controllers thin, models fat (but not too fat)
- Use concerns for shared functionality
- Implement background jobs with Sidekiq or ActiveJob
- Use proper database migrations
- Follow RESTful routing conventions

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for Backend and APIs →

From the same set168

django-rest-api-development A skill that gives your coding agent a house style for Django REST APIs: project layout, serializers, JWT auth and query performance. CX Codex +1 868installs data-jupyter-python Tells your agent how to write data analysis code: pandas and numpy, matplotlib and seaborn plots, reproducible notebooks, fewer loops. CX Codex +1 865installs openai-api-development A skill that steers your coding agent through Anthropic API work: Claude calls, function calling, embeddings and Assistants API, with Python examples. CX Codex +1 864installs jest A skill that tells your agent how to write Jest tests: structure, mocks, assertions, async. Useful when AI writes the tests in your repo. CX Codex +1 864installs seo-best-practices Provides search optimization guidelines for web apps. Helps configure metadata, JSON-LD schemas, rendering modes, and Core Web Vitals. CX Codex +1 858installs fastify-typescript Gives the agent a rulebook for Fastify and TypeScript: validation schemas, plugins, Prisma access and Jest tests. Useful when you build a typed REST API. CX Codex +1 856installs performance-optimization A rule set for web performance: server-side rendering, CSS, JavaScript, assets and caching. Useful when your agent writes frontend code and you want a bar to hold it to. CX Codex +1 848installs sass-best-practices A skill that hands your agent a rulebook for indented-syntax Sass: file layout, variables, mixins, BEM. Useful when the project stylesheets are .sass, not SCSS. CX Codex +1 845installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor