Skip to content

Instantly share code, notes, and snippets.

@jpbalarini
Last active June 13, 2025 16:29
Show Gist options
  • Select an option

  • Save jpbalarini/7826ee221ddc8a7c2f7aa7fbea82b481 to your computer and use it in GitHub Desktop.

Select an option

Save jpbalarini/7826ee221ddc8a7c2f7aa7fbea82b481 to your computer and use it in GitHub Desktop.
Cursor templates for effective vibe coding

I have a web app idea I'd like to develop. Here's my initial concept:

{{IDEA}}

I'm looking to collaborate with you to turn this into a detailed project request. Let's iterate together until we have a complete request that I find to be complete.

After each of our exchanges, please return the current state of the request in this format:

# Project Name
## Project Description
[Description]

## Target Audience
[Target users]

## Desired Features
### [Feature Category]
- [ ] [Requirement]
    - [ ] [Sub-requirement]

## Design Requests
- [ ] [Design requirement]
    - [ ] [Design detail]

## Other Notes
- [Additional considerations]

Please:

  1. Ask me questions about any areas that need more detail
  2. Suggest features or considerations I might have missed
  3. Help me organize requirements logically
  4. Show me the current state of the spec after each exchange
  5. Flag any potential technical challenges or important decisions

We'll continue iterating and refining the request until I indicate it's complete and ready.

You are an AI task planner responsible for breaking down a complex Ruby on Rails application development project into manageable steps.

Your goal is to create a detailed, step-by-step plan that will guide the code generation process for building a fully functional Rails application based on a provided technical specification.

First, carefully review the following inputs:

<project_request> {{PROJECT_REQUEST}} </project_request>

After reviewing these inputs, your task is to create a comprehensive, detailed plan for implementing the Rails application.

Before creating the final plan, analyze the inputs and plan your approach. Wrap your thought process in tags.

Break down the development process into small, manageable steps that can be executed sequentially by a code generation AI.

Each step should focus on a specific aspect of the application and should be concrete enough for the AI to implement in a single iteration.

When creating your plan, follow these guidelines:

  1. Start with the core project structure, essential configurations, and Gemfile setup.
  2. Progress through database schema design, migrations, and model definitions.
  3. Move on to controllers, routes, and service objects.
  4. Break down the implementation of individual views, partials, and helpers into smaller, focused steps.
  5. Include steps for integrating authentication, authorization, and third-party services.
  6. Incorporate steps for implementing ActiveRecord associations, validations, and callbacks.
  7. Include steps for writing tests (RSpec, Minitest, etc.) and implementing the specified testing strategy.
  8. Consider steps for asset pipeline or Webpacker configuration if needed.
  9. Ensure that each step builds upon the previous ones in a logical manner, following Rails conventions.

Present your plan using the following markdown-based format. This format is specifically designed to integrate with the subsequent code generation phase, where an AI will systematically implement each step and mark it as complete. Each step must be atomic and self-contained enough to be implemented in a single code generation iteration, and should modify no more than 20 files at once (ideally less) to ensure manageable changes. Make sure to include any instructions the user should follow for things you can't do like installing gems, setting up database configurations, etc.

# Implementation Plan

## [Section Name]
- [ ] Step 1: [Brief title]
  - **Task**: [Detailed explanation of what needs to be implemented]
  - **Files**: [Maximum of 20 files, ideally less]
    - `path/to/file1.rb`: [Description of changes]
  - **Step Dependencies**: [Step Dependencies]
  - **User Instructions**: [Instructions for User]

[Additional steps...]

After presenting your plan, provide a brief summary of the overall approach and any key considerations for the implementation process.

Remember to:

  • Ensure that your plan covers all aspects of the technical specification.
  • Break down complex features into smaller, manageable tasks.
  • Consider the logical order of implementation, ensuring that dependencies are addressed in the correct sequence.
  • Include steps for error handling, data validation, and edge case management.
  • Follow Rails conventions and best practices (MVC architecture, RESTful routes, etc.).
  • Consider database performance and optimization where relevant.

Begin your response with your brainstorming, then proceed to the creation your detailed implementation plan for the Rails application based on the provided specification.

Once you are done, we will pass this specification to the AI code generation system.

# Rails 8 Development Guidelines
## 1. Rails 8 Core Features
** Prefer the command line utilities to manually generated code **
e.g use `rails generate model` instead of creating a model from scratch
** IMPORTANT: Server Management **
- Always use `bin/dev` to start the server (uses Procfile.dev)
- Check logs after every significant change
- Monitor development.log for errors and performance issues
- Use `tail -f log/development.log` for real-time monitoring
- Review logs before considering any change complete
1. **Modern Infrastructure**
- Use Thruster for asset compression and caching
- Implement Kamal 2 for deployment orchestration
- Utilize Solid Queue for background job processing
- Leverage Solid Cache for caching
- Use Solid Cable for real-time features
- Configure healthcheck silencing in production logs
2. **Database Best Practices**
- Use PostgreSQL full-text search capabilities
- Configure proper database extensions in database.yml
- Implement database partitioning for large datasets
- Use proper database indexing strategies
- Configure connection pooling
- Implement proper backup strategies
- Use PostgreSQL-specific features (arrays, jsonb, etc)
- Monitor and optimize query performance
3. **Controller Patterns**
- Use `params.expect()` for safer parameter handling
- Implement rate limiting via cache store
- Use the new sessions generator for authentication
- Silence healthcheck requests in production
- Keep controllers RESTful and focused
- Use service objects for complex business logic
4. **Progressive Web App Features**
- Utilize default PWA manifest
- Implement service worker functionality
- Configure browser version requirements
- Use `allow_browser` to set minimum versions
- Implement offline capabilities
- Configure proper caching strategies
## 2. Development Standards
1. **Code Organization**
- Follow Single Responsibility Principle
- Use service objects for complex business logic
- Keep controllers skinny
- Use concerns for shared functionality
- Use `params.expect()` instead of strong parameters
- Follow Rails 8 conventions
2. **Performance**
- Use Thruster for asset compression
- Implement proper caching with Solid Cache
- Configure connection pooling
- Use Solid Queue for background jobs
- Monitor application metrics
- Regular performance profiling
- Optimize database queries
- Use proper indexing strategies
3. **Testing**
- Write comprehensive RSpec tests
- Use factories instead of fixtures
- Test happy and edge cases
- Keep tests DRY but readable
- Use parallel testing by default
- Regular security testing
- Performance testing
- Load testing for critical paths
4. **Security**
- Use `params.expect()` for parameter handling
- Implement proper authorization
- Sanitize user input
- Follow OWASP guidelines
- Configure rate limiting via cache store
- Regular security audits
- Keep dependencies updated
- Use secure communication (HTTPS)
5. **Hotwire Patterns**
- Use Turbo Frames for partial page updates
- Use Turbo Streams for real-time updates
- Keep Stimulus controllers focused and simple
- Use data attributes for JavaScript hooks
- Use Solid Cable for real-time features
6. **Deployment**
- Use Kamal 2 for deployment orchestration
- Configure healthcheck silencing
- Use Propshaft for asset pipeline
- Implement PWA features by default
- Use devcontainer for development
- Implement blue-green deployments
- Configure proper health checks
- Set up monitoring and alerts
7. **Logging and Monitoring**
- Check logs after every code change
- Monitor development.log for errors
- Use `tail -f log/development.log` for real-time monitoring
- Review logs before marking tasks as complete
- Set up proper log rotation
- Configure log levels appropriately
- Monitor performance metrics
- Track error rates and patterns
## 3. Directory Structure
```
/app
├── components/ # View components
│ └── ui/ # UI components
├── controllers/ # Controllers
├── models/ # Active Record models
├── views/ # View templates
├── helpers/ # View helpers
├── javascript/ # Stimulus controllers
│ └── controllers/
├── services/ # Service objects
├── jobs/ # Background jobs
├── mailers/ # Action Mailer classes
└── assets/ # Assets (if not using importmap)
```
## 4. Tech Stack
- **Backend**: Ruby on Rails 8
- **Frontend**: Hotwire (Turbo + Stimulus)
- **Styling**: Tailwind CSS
- **Database**: PostgreSQL
- **Testing**: RSpec, Capybara
- **Background Jobs**: Solid Queue (default in Rails 8)
- **Caching**: Solid Cache (default in Rails 8)
- **Real-time**: Solid Cable
- **Authentication**: Built-in Sessions Generator
- **Authorization**: Cancancan gem
- **Deployment**: Kamal 2 (default in Rails 8)
- **Asset Pipeline**: Propshaft (default in Rails 8)
- **Container**: Docker (development & production)
## 5. Rails-Specific Reminders
1. Use `--skip-solid` if not using Solid Stack
2. Configure healthcheck silencing in production
3. Ensure Docker services are running before development
4. Follow the new Rails 8 maintenance policy
5. Keep dependencies updated
6. Monitor application performance
7. Regular security audits
8. Use `params.expect()` instead of strong parameters
9. Use Propshaft for asset pipeline
10. Implement PWA features by default
11. Always use `bin/dev` to start the server
12. Check logs after every significant change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment