
Supercharging Rails Development with Cursor AI
At RapidRuby, I’m always exploring tools that help Rails developers build faster, ship cleaner code, and stay in flow. One of the best tools for that is Cursor — an AI-powered code editor built on top of VS Code.
If you're building Rails apps and not using Cursor yet, you’re missing a serious productivity boost. And if you are, here's how to level it up even further.
1. Use .cursor/rules/*.mdc
Files to Teach Cursor About Your Project
Create a .cursor/rules/
folder in your project and drop in files like:
rails_basics.mdc
hotwire_patterns.mdc
business_overview.mdc
Each file contains structured knowledge about your stack, code conventions, and business goals — and Cursor will automatically include them as context in chats and code generation.
Example: rails_basics.mdc
---
description: Rails & Turbo coding practices
globs: **/*
alwaysApply: true
---
## Tech Stack
- Ruby on Rails monolith
- Hotwire (Turbo + Stimulus) for interactivity
- TailwindCSS for styling
- PostgreSQL
- Sidekiq for background jobs
- RSpec for testing
## Conventions
- Use service objects for complex business logic
- Keep controllers skinny, use form objects when needed
- Use `render turbo_stream:` instead of full reloads
- Prefer keyword arguments and modern Ruby syntax
You can also target specific types of files using glob patterns. For example, if you only want a rule to apply to Ruby files, use patterns: **/*.rb
at the top of your .mdc file. This tells Cursor to only use that context when working inside Ruby files — super useful for separating backend, frontend, or test-specific guidance.
For a solid starting point, you can grab a prewritten rule tailored for Rails and Hotwire projects from the Cursor Rules Directory:
👉 Rails + Ruby Rule on cursor.directory
It covers common conventions and is a great baseline to tweak for your own projects.
2. Add Product & Business Context
To help Cursor understand your mission, audience, and business model, create a file like this in .cursor/rules/business_overview.mdc
:
---
description: Business & Product Overview
globs: **/*
alwaysApply: true
---
## Business Overview: RapidRuby.com
**Audience:** Ruby on Rails developers
**Mission:** Help devs level up fast with Hotwire, AI, and SaaS-focused training.
**Revenue:** Premium subscriptions, course sales, sponsorships
**Marketing:** YouTube (3.5k subs), X.com (1k followers)
**Goals:** Grow MRR, expand course offerings, launch mentorship programs
Now Cursor knows what you’re building and who you’re building it for. It unlocks context-aware AI that can help you write, refactor, and brainstorm like a teammate who actually gets it.
🔗 Learn how to generate a powerful reusable version of your Business Overview for any AI tool (ChatGPT, Claude, etc).
Now you can ask:
What should the homepage tagline be based on our audience?
And Cursor will actually know what you’re building and who it’s for.
3. Power Features via Cmd-K
Highlight code, press Cmd-K, and let Cursor:
- Refactor methods
- Add RSpec tests
- Rename variables clearly
- Explain complex Ruby
- Fix bugs or rewrite patterns
It’s like pair programming with an expert who already knows your stack.
4. Use @
Symbols to Reference Rules & Files
You can directly reference your .mdc
files and app files in prompts:
Refactor this controller to align with @rails_basics.mdc and the pattern in @app/services/create_invoice.rb
This helps Cursor blend your project rules with real code context for highly relevant responses.
5. Let Cursor Help With Git
Cursor can:
- Write meaningful commit messages
- Summarize large diffs
- Review pull requests
- Explain changes across multiple files
Ideal if you’re solo or working fast — it keeps your history clean without slowing you down.
6. Use It As a Mentor (If You’re Still Leveling Up)
Cursor is a fantastic tutor. Ask it things like:
“What’s happening in this Stimulus controller?”
“Why use delegate in this model?”
“Should I use Turbo Streams or Turbo Frames here?”
It’ll explain in context — no need to jump to Stack Overflow or ChatGPT separately.
Final Thoughts
Cursor is a game-changer for Rails devs — especially if you’re all-in on Hotwire, Tailwind, and modern conventions. Set up your .cursor/rules/*.mdc
files once, and let Cursor become your context-aware coding partner.
It’s the closest thing I’ve seen to an AI teammate that actually understands your project. 🚀