rails-cursorrules-prompt-file — Cursor rule: Rails 8 conventions
A Cursor rule file that tells the agent how to write Rails 8 code: generators, bin/dev, the Solid stack, Minitest and Hotwire.
.cursor/rules/rails-cursorrules-prompt-file.mdcWhat rails-cursorrules-prompt-file does
This is a Cursor rules file that steers the agent toward Rails 8 conventions in your project. The content is a short list of habits: reach for Rails command-line generators instead of hand-written boilerplate, run local development with bin/dev, and check logs after significant changes.
Rails 8 specifics get their own line — Solid Queue, Solid Cache, Solid Cable, Propshaft and Kamal where appropriate. Controllers should stay RESTful and focused, and complex business logic belongs in service objects. On the database side the rule asks for PostgreSQL, proper indexes, connection pooling and safe migrations.
Testing means Minitest coverage for models, controllers and integration flows. For interactivity the rule prefers Hotwire and brings in Vite only when npm-managed JavaScript is needed. One thing to know before you drop it in: the frontmatter sets alwaysApply: false, so the rule will not fire on its own. You have to enable it yourself, and that is easy to miss.
What it helps with
- keep the agent on one coding style across a Rails 8 project
- push Cursor toward generators instead of hand-written boilerplate
- settle on RESTful controllers with service objects for complex logic
- spell out PostgreSQL, indexes and safe migrations
- standardise on Minitest and Hotwire for tests and interactivity
Example prompts for the agent
- Add a new resource for articles: generate the model, controller and migration following the Rails 8 rules
- Refactor this controller — it grew too big, move the logic into a service object
- Set up local development with
bin/devand check the logs after the changes
How to install rails-cursorrules-prompt-file
Manually: put the files in place
.cursor/rules/rails-cursorrules-prompt-file.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/rails-cursorrules-prompt-file.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/rails-cursorrules-prompt-file.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/rails-cursorrules-prompt-file.mdManually: put the files in place
.clinerules/rails-cursorrules-prompt-file.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about rails-cursorrules-prompt-file
How do I install rails-cursorrules-prompt-file in Cursor?
Create .cursor/rules/rails-cursorrules-prompt-file.mdc in your project root and paste the rule content into it.
What does rails-cursorrules-prompt-file do?
It gives the Cursor agent a set of Rails 8 conventions: generators, bin/dev, Solid Queue and Cache, Propshaft, Kamal, PostgreSQL, Minitest and Hotwire.
Does the rule apply automatically?
No. The frontmatter sets alwaysApply: false, so you need to enable the rule manually or Cursor will not pick it up.
Source text
rails-cursorrules-prompt-file.mdc · CC0-1.0
--- description: "Cursor rules for Rails development with basic setup." globs: **/* alwaysApply: false --- Rails 8 Development Guidelines - Prefer Rails command-line generators over hand-written boilerplate. - Use `bin/dev` for local development and check logs after significant changes. - Follow Rails 8 conventions for Solid Queue, Solid Cache, Solid Cable, Propshaft, and Kamal where appropriate. - Keep controllers RESTful and focused; use service objects for complex business logic. - Use PostgreSQL, proper indexes, connection pooling, and safe migrations. - Write Minitest coverage for models, controllers, and integration flows. - Use Hotwire for standard Rails interactivity and Vite only when npm-managed JavaScript is needed.
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules