Home › Ruby on Rails › Ruby on Rails Copilot instructions

Ruby on Rails Copilot instructions

GitHub Copilot custom instructions for Rails 8 apps with Hotwire, RSpec and Rubocop.

GitHub CopilotRuby on Rails

How to use

Save this as .github/copilot-instructions.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.github/copilot-instructions.mdDownload  
# Copilot instructions — Rails app

This is a Rails 8 app using Hotwire (Turbo + Stimulus), PostgreSQL, Solid Queue, and RSpec.

- Follow Rails conventions over configuration. Prefer built-in Rails features before adding gems.
- Keep controllers skinny: strong params, one model call, respond. Put business logic in models or `app/services/*` POROs.
- Use Turbo Frames/Streams for interactivity; write Stimulus controllers for small JS behavior. No React.
- Avoid N+1 queries: use `includes` and check with Bullet in development.
- Every migration must be reversible; add DB-level constraints and indexes alongside validations.
- Background work goes in Active Job classes in `app/jobs`.
- Tests: RSpec request specs for endpoints, model specs for logic, FactoryBot for data. System specs for critical flows.
- Style: Rubocop (rails-omakase). Run `bin/rubocop -a` and `bundle exec rspec` before proposing changes.

Related rules

Laravel Copilot instructions

GitHub Copilot instructions for Laravel 11+ apps with Eloquent, Pest, and Form Requests.

GitHub CopilotLaravel

TypeScript Node.js API Copilot instructions

Copilot instructions for Node.js + TypeScript APIs with Hono/Express, zod and Vitest.

GitHub CopilotNode.js / TypeScript

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.