1000-rails-general

1000-rails-general is a cursor rule for coding agents from andyw8/rails_rules. It costs 0 tokens per session (501 once invoked), scanned A, original, MIT.

A set of general conventions for Rails 8 applications, the Ruby web framework. It covers code style, application structure, database access, background jobs, views, browser behavior, accessibility, and responsive dark-mode interfaces.

In plain words
What is it for?
Building or reviewing Rails features, organizing business logic, writing controllers and views, adding Hotwire interactions, handling credentials and jobs, and checking accessible responsive UI.
Why use it?
It gives changes a consistent shape across the application and helps preserve Rails and project conventions.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/andyw8/rails_rules/1000-rails-general
Clone the repo
git clone --depth 1 https://github.com/andyw8/rails_rules

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 1000-rails-general

README.md
[![agentmods](https://agentmods.dev/badge/rules/andyw8/rails_rules/1000-rails-general.svg)](https://agentmods.dev/rules/andyw8/rails_rules/1000-rails-general)
Your own site
<a href="https://agentmods.dev/rules/andyw8/rails_rules/1000-rails-general"><img src="https://agentmods.dev/badge/rules/andyw8/rails_rules/1000-rails-general.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 501 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00501
Opus 5 $0.00000 $0.00251
Sonnet 5 $0.00000 $0.00100
Haiku 4.5 $0.00000 $0.00050

Measured 4d ago against content hash 049c7c272ca3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

1000-rails-general scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

lib/generators/rails_rules/templates/1000-rails-general.mdc · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

General Rails 8.0 Conventions

Context

  • In Ruby on Rails 8.0 application
  • Using modern Rails features and patterns
  • Follows Ruby style conventions

Requirements

  • Follow Ruby style guidelines (2 spaces for indentation, snake_case for variables/methods)
  • Use Service Objects for complex business logic
  • Use concerns for shared functionality
  • Use modules for namespacing and code organization
  • Use class Module::ClassName instead of nested module/class definitions
  • Add YARD documentation to methods and classes
  • Use positional arguments in enums and other Rails 8.0 features
  • Use credentials with Rails.application.credentials syntax
  • Pass models to jobs, not IDs (they'll be serialized automatically)
  • Use has_prefix_id for models with UUIDs
  • Use ActiveRecord conventions for database operations
  • Follow RESTful conventions for controllers
  • Use Tailwind CSS for styling views
  • Make all UI components responsive and support dark mode
  • Use Hotwire (Turbo, Stimulus) for JavaScript functionality
  • Ensure accessibility in all UI components

Examples

Good - Using Service Object

user = CreateUserService.new(user_params).run

Good - Using positional arguments in enum

class Article < ApplicationRecord enum status: [:draft, :published, :archived] end

Good - Class namespacing

class Api::V1::UsersController < ApplicationController

...

end

</example>

<example type="invalid">
```ruby
# Bad - Using outdated credentials pattern
api_key = Rails.application.secrets.anthropic_api_key

# Bad - Complex logic in controller
def create
  @user = User.new(user_params)
  if @user.save
    # Complex business logic here
  end
end

# Bad - Using hash for enum
class Article < ApplicationRecord
  enum status: { draft: 0, published: 1, archived: 2 }
end

# Bad - Nested modules
module Api
  module V1
    class UsersController < ApplicationController
      # ...
    end
  end
end

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 88 lines · 0 tokens per session scan A 049c7c272ca3

Subscribe to this mod's changes

1000-rails-general is a cursor rule published in the GitHub repository andyw8/rails_rules (4 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 501 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.