fractaldirk
Joined 2/2/2022
fractaldirk said about 1 year ago on Vibe Coding :
You just need a proper .cursorrules file and you have solved 9 out of 10 issues like it uses TurboStream and your styling framework by default. Also if you use a thinking model like openai-03 of claude 3.7 thinking, it will think through the consequences of one change and update multiple files. Your issues are due to settings rather than mistakes the model / software makes.

Here is my .cursorrules, feel free to edit it, include it in your project and try again (and use the cursor extension of VScode).

You are an expert in Ruby on Rails 7, Hotwire (Turbo and Stimulus), and Twitter Bootstrap 5.

Code Style and Structure
- Write concise, idiomatic Ruby code with accurate examples.
- Follow Rails conventions and best practices.
- Use object-oriented and functional programming patterns as appropriate.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable and method names (e.g., user_signed_in?, calculate_total).
- Structure files according to Rails conventions (MVC, concerns, helpers, etc.).
- Prevent using gems that are not necessary. For API calls use net/http or open-uri.
- Do not delete functional code while adding and deleting the features.

Naming Conventions
- Use snake_case for file names, method names, and variables.
- Use CamelCase for class and module names.
- Follow Rails naming conventions for models, controllers, and views.

Ruby and Rails Usage
- Use Ruby 3.x features when appropriate (e.g., pattern matching, endless methods).
- Leverage Rails' built-in helpers and methods.
- Use ActiveRecord effectively for database operations.

Syntax and Formatting
- Follow the Ruby Style Guide (https://rubystyle.guide/)
- Use Ruby's expressive syntax (e.g., unless, ||=, &.)
- Prefer single quotes for strings unless interpolation is needed.

Error Handling and Validation
- Use exceptions for exceptional cases, not for control flow.
- Implement proper error logging and user-friendly messages.
- Use ActiveModel validations in models.
- Handle errors gracefully in controllers and display appropriate flash messages.

UI and Styling
- Use Hotwire (Turbo and Stimulus) for dynamic, SPA-like interactions.
- Implement responsive design with Twitter Bootstrap 5.
- Use Rails view helpers and partials to keep views DRY.
- Use glypicons for icons where possible.

Performance Optimization
- Use database indexing effectively.
- Use eager loading to avoid N+1 queries.
- Optimize database queries using includes, joins, or select.

Key Conventions
- Follow RESTful routing conventions.
- Use concerns for shared behavior across models or controllers.
- Implement service objects for complex business logic.
- Use background jobs (e.g., Sidekiq) for time-consuming tasks.
 
Security
- Implement proper authentication and authorization (e.g., Devise, Pundit).
- Use strong parameters in controllers.
- Protect against common web vulnerabilities (XSS, CSRF, SQL injection).
- Avoid deprecated npm packages (discard anything not updated in the last two years).

Follow the official Ruby on Rails guides for best practices in routing, controllers, models, views, and other Rails components. 

fractaldirk said about 1 year ago on Vibe Coding :
Yes I saw the tag of "april-fools", I just wanted to get it out there (that the tech works). If you do a tutorial with a correct setup it is pretty interesting. Maybe not for million dollar back-end apps but for people with small projects, MVP or side projects it's very interesting.