ruby-rails — скилл для Claude Code: конвенции Rails и Hotwire
Скилл задаёт агенту правила разработки на Ruby on Rails: генераторы, ActiveRecord, Hotwire, фоновые задачи и тесты. Пригодится, когда проект уже на Rails или только заводится.
npx skills add Mindrally/skills --skill ruby-rails -a claude-codeЧто делает ruby-rails
Скилл описывает, как писать код на Ruby и Rails: идиоматичный Ruby, следование Convention over Configuration, стиль из Ruby Style Guide. Агент получает указание генерировать каркас через bin/rails generate ..., а не писать шаблонный код руками, и запускать локальный сервер через bin/dev.
Внутри — разделы по архитектуре, фронтенду, безопасности и тестам. Для базы советует PostgreSQL с индексами, пулингом соединений и обратимыми миграциями, eager loading против N+1, фрагментное и Russian Doll кэширование, service objects для сложной логики. Из коробки Rails 8 скилл предлагает Solid Queue, Solid Cache, Solid Cable, Propshaft и Kamal вместо внешних сервисов. Интерактивность — Hotwire (Turbo и Stimulus), вёрстка на Tailwind CSS, переиспользуемые компоненты через ViewComponents.
Тесты — Minitest или RSpec по TDD, данные через FactoryBot, внешние сервисы замоканы, каждый тест независим. Аутентификация и авторизация — Devise или Pundit, плюс strong parameters и CSRF-токены. Учтите: скилл советует не подключать Vite и npm-сборку по умолчанию — только если в проекте реально есть React или Vue.
Какие задачи решает
- сгенерировать каркас Rails-приложения и не писать boilerplate вручную
- спроектировать модели ActiveRecord и безопасные обратимые миграции
- убрать N+1 запросы через eager loading
- подключить Turbo и Stimulus без полной перезагрузки страниц
- написать покрытие на RSpec или Minitest с FactoryBot
Примеры запросов агенту
- Сгенерируй модель Order с миграцией и индексом по user_id
- Перепиши контроллер так, чтобы не было N+1 при загрузке заказов
- Добавь Turbo Frame для обновления списка задач без перезагрузки
Как установить ruby-rails
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby-rails -a claude-code2Вручную: положить файлы
~/.claude/skills/ruby-rails/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/ruby-rails/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby-rails -a codex2Вручную: положить файлы
.agents/skills/ruby-rails/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby-rails -a cursor2Вручную: положить файлы
.cursor/skills/ruby-rails/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills ruby-rails2Вручную: положить файлы
.github/skills/ruby-rails/SKILL.md1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby-rails -a gemini-cli2Командой платформы
gemini skills install https://github.com/Mindrally/skills --path ruby-railsВручную: положить файлы
.devin/skills/ruby-rails/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill ruby-rails -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора168
Похожие
Рядом в теме «Бэкенд и API»
Всё по теме «Бэкенд и API» →Вопросы о ruby-rails
Как установить ruby-rails в Claude?
Выполните npx skills add Mindrally/skills --skill ruby-rails -a claude-code. После этого файл скилла окажется в ~/.claude/skills/ruby-rails/SKILL.md.
Что делает ruby-rails?
Задаёт агенту конвенции Rails: генераторы вместо ручного кода, паттерны ActiveRecord, Hotwire, фоновые задачи, кэширование и тесты. Работает при скаффолдинге, проектировании моделей и написании покрытия.
Нужен ли Redis для фоновых задач и кэша?
Скилл отталкивается от стека Rails 8 и предлагает Solid Queue, Solid Cache и Solid Cable на базе БД. Redis или Sidekiq стоит добавлять только при особых требованиях к объёму задач.
Исходный текст
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