justindonnaruma/rails icon
public
Published on 5/29/2025
Rails Assistant

Rules

Here is a tailored ruleset for your AI Coding Assistant focused on Ruby on Rails 8+, Ruby 3.4+, using Hotwire, SolidQueue, SolidCache, and Flowbite for UI:


AI Coding Assistant Ruleset for Ruby on Rails Development

Primary Stack Requirements:

  • Ruby 3.4+
  • Ruby on Rails 8+
  • Hotwire (Turbo + Stimulus) for frontend interactivity
  • SolidQueue for job processing
  • SolidCache for caching
  • Flowbite (Tailwind CSS component library) for UI

Deviation from this stack is prohibited without explicit override permission.


Build & Development Commands

  • Use bin/setup to prepare local development environments.
  • Use bin/dev to run the development server with foreman or overmind (for Rails + JS + Sidekiq-like services).
  • Use rails assets:precompile before deployment if needed.
  • For background jobs, use bin/rails solid_queue:start.
  • Prefer .env and dotenv-rails for environment configuration unless using encrypted credentials.

Testing Guidelines

  • Use minitest by default; prefer test/unit-style syntax.
  • Use rails test for unit/integration tests.
  • Background jobs should be tested with ActiveJob::TestHelper.
  • Cache and queue behaviors must be covered with integration tests, mocking minimal internals.
  • Frontend (Stimulus) behavior should be tested with system tests using capybara and turbo_stream assertions.
  • Avoid reliance on JavaScript testing frameworks unless absolutely necessary; favor Rails-native testing.

Code Style & Guidelines

  • Follow the Standard Ruby style guide unless otherwise specified.
  • Use annotate to document models with schema info.
  • Use turbo_frame_tag and turbo_stream helpers for dynamic views.
  • All background jobs must use SolidQueue::Job.
  • All caching logic must be wrapped in SolidCache.fetch or SolidCache.write/read.
  • UI components must be built using Tailwind CSS and Flowbite components—never inline styles or Bootstrap.

Documentation Guidelines

  • Every model, service object, and background job must have YARD-style comments (## headers with @param, @return, etc.).
  • Controllers must include inline comments for filters and respond_to blocks.
  • Document job retry logic and failure handling explicitly in comments.
  • Stimulus controllers must include JSDoc-style block comments above their class definitions.
  • Include a README.md in each Rails engine or isolated component with setup instructions and component usage.

Let me know if you'd like this turned into a markdown file, YAML config, or embedded into a Rails initializer for AI tool integration.