rails-dev · pproenca — Claude Code skill: what it does, how to install
Set of guidelines for Ruby on Rails development. Helps build clean controllers, optimize ActiveRecord queries, and configure caching.
MIT 299 installs ★ 227 updated 2026-08-15
npx skills add pproenca/dot-skills --skill rails-dev -a claude-codeWhat rails-dev does
This skill defines 45 development rules across 8 categorized tiers. Database operations and controller routing carry critical priority, followed by security practices, model architecture, and caching. The instructions guide the agent when generating migrations, refactoring endpoints, or writing Turbo Streams.
The recommendations detail standard Rails conventions. They advise eager loading associations to eliminate N+1 queries, batching large datasets with find_each, and extracting business logic into service objects. Background jobs must stay idempotent and take IDs instead of full model instances.
Database patterns take precedence over frontend view changes. The assistant will insist on scoped queries and missing indexes before touching templates.
What it helps with
- eliminate N+1 database queries using eager loading
- refactor fat controllers into dedicated service objects
- configure Russian doll and fragment caching for view templates
- structure idempotent background jobs for Sidekiq or Active Job
- audit parameters and SQL queries for security flaws
Example prompts for the agent
- Review OrdersController and move the checkout logic into a service object
- Optimize queries in User.recent_activity to eliminate N+1 issues
- Write a zero-downtime database migration to add missing indexes
How to install rails-dev
1Skills CLI (Vercel)
npx skills add pproenca/dot-skills --skill rails-dev -a claude-code2Manually: put the files in place
~/.claude/skills/rails-dev/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/rails-dev/
1Skills CLI (Vercel)
npx skills add pproenca/dot-skills --skill rails-dev -a codex2Manually: put the files in place
.agents/skills/rails-dev/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add pproenca/dot-skills --skill rails-dev -a cursor2Manually: put the files in place
.cursor/skills/rails-dev/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install pproenca/dot-skills skills/.curated/rails-dev2Manually: put the files in place
.github/skills/rails-dev/SKILL.md1Skills CLI (Vercel)
npx skills add pproenca/dot-skills --skill rails-dev -a gemini-cli2Platform CLI
gemini skills install https://github.com/pproenca/dot-skills --path skills/.curated/rails-devManually: put the files in place
.devin/skills/rails-dev/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add pproenca/dot-skills --skill rails-dev -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about rails-dev
How to install rails-dev in Claude Code?
Run npx skills add pproenca/dot-skills --skill rails-dev -a claude-code in your terminal. The configuration is placed at ~/.claude/skills/rails-dev/SKILL.md.
What does rails-dev do?
It equips the coding agent with 45 Rails best practice rules split across 8 tiers. The agent relies on them to structure controllers, optimize ActiveRecord queries, and format API responses.
Which rule categories have the highest priority?
Database & ActiveRecord together with Controllers & Routing are labeled as critical. Background jobs and async processing have the lowest relative impact tier.
Source text
SKILL.md · MIT
--- name: rails-dev description: Ruby on Rails performance and maintainability optimization guidelines for building backend APIs and frontend web applications. This skill should be used when writing, reviewing, or refactoring Ruby on Rails code to ensure optimal patterns for controllers, models, ActiveRecord queries, caching, views, API design, security, and background jobs. Triggers on tasks involving Rails controllers, ActiveRecord queries, migrations, Turbo/Hotwire, API endpoints, background jobs, or Rails performance improvements. --- # Community Ruby on Rails Development Best Practices Comprehensive performance and maintainability optimization guide for Ruby on Rails applications, maintained by Community. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation. ## When to Apply Reference these guidelines when: - Writing new Rails controllers, models, or views - Optimizing ActiveRecord queries and database access patterns - Implementing caching strategies (fragment, Russian doll, low-level) - Building or refactoring API endpoints - Adding Turbo Frames and Streams for interactive UIs - Reviewing code for N+1 queries and security vulnerabilities - Designing background jobs with Sidekiq or Active Job - Writing or reviewing database migrations ## Rule Categories by Priority | Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Database & ActiveRecord | CRITICAL | `db-` | | 2 | Controllers & Routing | CRITICAL | `ctrl-` | | 3 | Security | HIGH | `sec-` | | 4 | Models & Business Logic | HIGH | `model-` | | 5 | Caching & Performance | HIGH | `cache-` | | 6 | Views & Frontend | MEDIUM-HIGH | `view-` | | 7 | API Design | MEDIUM | `api-` | | 8 | Background Jobs & Async | LOW-MEDIUM | `job-` | ## Quick Reference ### 1. Database & ActiveRecord (CRITICAL) - [`db-eager-load-associations`](references/db-eager-load-associations.md) - Eager load associations to eliminate N+1 queries - [`db-add-database-indexes`](references/db-add-database-indexes.md) - Add database indexes on queried columns - [`db-select-specific-columns`](references/db-select-specific-columns.md) - Select only needed columns - [`db-batch-processing`](references/db-batch-processing.md) - Use find_each for large dataset iteration - [`db-avoid-queries-in-loops`](references/db-avoid-queries-in-loops.md) - Avoid database queries inside loops - [`db-use-scopes`](references/db-use-scopes.md) - Define reusable query scopes on models - [`db-safe-migrations`](references/db-safe-migrations.md) - Write reversible zero-downtime migrations - [`db-exists-over-count`](references/db-exists-over-count.md) - Use exists? instead of count for existence checks ### 2. Controllers & Routing (CRITICAL) - [`ctrl-thin-controllers`](references/ctrl-thin-controllers.md) - Keep controllers thin by delegating to models and services - [`ctrl-strong-params`](references/ctrl-strong-params.md) - Always use strong parameters for mass assignment - [`ctrl-restful-routes`](references/ctrl-restful-routes.md) - Follow RESTful routing conventions - [`ctrl-before-action-scoping`](references/ctrl-before-action-scoping.md) - Scope before_action callbacks with only/except - [`ctrl-respond-to-format`](references/ctrl-respond-to-format.md) - Use respond_to for multi-format responses - [`ctrl-rescue-from`](references/ctrl-rescue-from.md) - Handle errors with rescue_from in controllers ### 3. Security (HIGH) - [`sec-parameterized-queries`](references/sec-parameterized-queries.md) - Never interpolate user input in SQL - [`sec-strong-params-whitelist`](references/sec-strong-params-whitelist.md) - Whitelist permitted params, never blacklist - [`sec-authenticate-before-authorize`](references/sec-authenticate-before-authorize.md) - Authenticate before authorize on every request - [`sec-csrf-protection`](references/sec-csrf-protection.md) - Enable CSRF protection for all form submissions - [`sec-scope-queries-to-user`](references/sec-scope-queries-to-user.md) - Scope queries to current user for authorization ### 4. Models & Business Logic (HIGH) - [`model-validate-at-model-level`](references/model-validate-at-model-level.md) - Validate data at the model level - [`model-avoid-callback-side-effects`](references/model-avoid-callback-side-effects.md) - Avoid side effects in model callbacks - [`model-use-service-objects`](references/model-use-service-objects.md) - Extract complex logic into service objects - [`model-scope-over-class-methods`](references/model-scope-over-class-methods.md) - Use scopes instead of class methods for query composition - [`model-use-enums`](references/model-use-enums.md) - Use enums for finite state fields - [`model-concerns-for-shared-behavior`](references/model-concerns-for-shared-behavior.md) - Use concerns for shared model behavior - [`model-query-objects`](references/model-query-objects.md) - Extract complex queries into query objects ### 5. Caching & Performance (HIGH) - [`cache-fragment-caching`](references/cache-fragment-caching.md) - Use fragment caching for expensive view partials - [`cache-russian-doll`](references/cache-russian-doll.md) - Use Russian doll caching for nested collections - [`cache-low-level`](references/cache-low-level.md) - Use Rails.cache.fetch for computed data - [`cache-counter-cache`](references/cache-counter-cache.md) - Use counter caches for association counts - [`cache-conditional-get`](references/cache-conditional-get.md) - Use conditional GET with stale? for HTTP caching ### 6. Views & Frontend (MEDIUM-HIGH) - [`view-collection-rendering`](references/view-collection-rendering.md) - Use collection rendering instead of loop partials - [`view-turbo-frames`](references/view-turbo-frames.md) - Use Turbo Frames for partial page updates - [`view-turbo-streams`](references/view-turbo-streams.md) - Use Turbo Streams for real-time page mutations - [`view-form-with`](references/view-form-with.md) - Use form_with instead of form_tag or form_for - [`view-avoid-logic-in-views`](references/view-avoid-logic-in-views.md) - Move display logic to helpers or presenters ### 7. API Design (MEDIUM) - [`api-serializers`](references/api-serializers.md) - Use serializers for consistent JSON responses - [`api-pagination`](references/api-pagination.md) - Always paginate collection endpoints - [`api-versioning`](references/api-versioning.md) - Version APIs from day one - [`api-error-responses`](references/api-error-responses.md) - Return structured error responses - [`api-avoid-jbuilder-hot-paths`](references/api-avoid-jbuilder-hot-paths.md) - Avoid Jbuilder on high-traffic endpoints ### 8. Background Jobs & Async (LOW-MEDIUM) - [`job-idempotent-design`](references/job-idempotent-design.md) - Design jobs to be idempotent - [`job-small-payloads`](references/job-small-payloads.md) - Pass IDs to jobs, not serialized objects - [`job-error-handling`](references/job-error-handling.md) - Configure retry and error handling for jobs - [`job-unique-jobs`](references/job-unique-jobs.md) - Prevent duplicate job enqueuing ## How to Use Read individual reference files for detailed explanations and code examples: - [Section definitions](references/_sections.md) - Category structure and impact levels - [Rule template](assets/templates/_template.md) - Template for adding new rules ## Reference Files | File | Description | |------|-------------| | [references/_sections.md](references/_sections.md) | Category definitions and ordering | | [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules | | [metadata.json](metadata.json) | Version and reference information |
© pproenca · MIT · pproenca/dot-skills
Similar skills
All skills for Backend and APIs →rails-dev by other authors comes first.