AI SummaryCursor Rules booster provides Rails 8 + Ruby 3.2.2 development guidelines covering code style, naming conventions, and project structure for RESTful applications using PostgreSQL. Developers working on Rails projects in Cursor will benefit from standardized conventions and best practices.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to add the "tofc-roro — Cursor Rules" prompt rules to my project. Repository: https://github.com/allenTong31415926/tofc-roro Please read the repo to find the rules/prompt file, then: 1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type) 2. If there's an existing rules file, merge the new rules in rather than overwriting 3. Confirm what was added
Description
This is a Ruby on Rails 8 project built with Ruby 3.2.2. The application follows RESTful principles and uses PostgreSQL as the database.
Code Style and Structure (applies to: **/*.rb)
• Write concise, idiomatic Ruby code with accurate examples. • Follow Rails conventions and best practices. • Follow Rails naming conventions: • Model names are singular (e.g., User, Post). • Controller names are plural (e.g., UsersController, PostsController). • Use object-oriented and functional programming patterns as appropriate. • Prefer iteration and modularization over code duplication. • Use CamelCase for class and module names. • Use descriptive variable and method names (e.g., user_signed_in?, calculate_total). • Use snake_case for variables, methods, and file names (e.g., current_user, app/models/user.rb). • Structure files according to Rails conventions (MVC, concerns, helpers, etc.). • Use Ruby's expressive syntax (e.g., unless, ||=, &.) • Prefer single quotes for strings unless interpolation is needed. • Keep lines under 80 characters, per RuboCop defaults. • Use 2-space indentation, no tabs.
Routing and Controllers (applies to: app/controllers/*_controller.rb, config/routes.rb)
• Define routes in config/routes.rb using RESTful resources (e.g., resources :posts). • Keep controller actions lean: limit to 1-2 method calls, delegate complex logic to service objects. • Use Rails 8’s built-in authentication (e.g., authenticate DSL) where applicable. • Always include before_action filters for authentication or authorization when needed.
Models (applies to: app/models/*.rb)
• Use ActiveRecord for database interactions. • Define associations (e.g., has_many, belongs_to) explicitly with foreign_key if non-standard. • Add validations (e.g., validates :email, presence: true) for required fields. • Avoid business logic in models; extract shared logic into Concerns and complex logic into Service Objects.
Concerns (applies to: app/{models,controllers}/concerns/*.rb)
• Use Concerns to share reusable code between models or controllers: • Place model concerns in app/models/concerns/ (e.g., app/models/concerns/auditable.rb). • Place controller concerns in app/controllers/concerns/ (e.g., app/controllers/concerns/authenticable.rb). • Name concerns with a descriptive suffix (e.g., Auditable, Searchable). • Include concerns using include (e.g., include Auditable in a model).
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster
Works With
Any AI assistant that accepts custom rules or system prompts