1003-rails-views

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

A set of rules for building Ruby on Rails 8.0 web-page templates with Tailwind CSS, a utility-based styling system, and ERB, Rails' HTML template format.

In plain words
What is it for?
It guides developers when creating Rails pages, forms, buttons, cards, alerts, navigation, page titles, and live-updating sections.
Why use it?
It keeps views consistent across a project and reduces repeated decisions about responsive layouts, dark mode, forms, accessibility, and reusable page parts.

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/1003-rails-views
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 1003-rails-views

README.md
[![agentmods](https://agentmods.dev/badge/rules/andyw8/rails_rules/1003-rails-views.svg)](https://agentmods.dev/rules/andyw8/rails_rules/1003-rails-views)
Your own site
<a href="https://agentmods.dev/rules/andyw8/rails_rules/1003-rails-views"><img src="https://agentmods.dev/badge/rules/andyw8/rails_rules/1003-rails-views.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 1,122 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.01122
Opus 5 $0.00000 $0.00561
Sonnet 5 $0.00000 $0.00224
Haiku 4.5 $0.00000 $0.00112

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

Security

Grade A, and why

1003-rails-views 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/1003-rails-views.mdc · 108 lines

How it starts

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

Rails View Standards with Tailwind

Context

  • In Ruby on Rails 8.0 views
  • Using Tailwind CSS for styling
  • ERB templates with responsive design
  • Support for dark mode

Requirements

  • Always use Tailwind CSS classes for styling
  • Make all views responsive with breakpoints (sm:, md:, lg:, xl:, 2xl:)
  • Add dark mode support (dark: prefix for Tailwind classes)
  • For forms:
    • Add autofocus: true on first input for new records
    • Add asterisks (*) for required fields
    • Use HTML5 validation
    • Use form-group, form-control classes
    • For buttons use btn btn-primary, btn-small, btn-block, etc.
    • Use f.button instead of f.submit
    • Add proper disable_with for buttons showing loading state: disable_with: "Saving..."
  • Use content_for :title for page titles
  • For components like cards, alerts, navigation:
    • Use corresponding Tailwind component classes
  • Use Turbo Stream for real-time updates
  • Use dom_id for HTML element IDs
  • Use partials for reusable components
  • Use proper spacing with Tailwind (mt-4, mb-4, py-2, etc.)
  • Implement proper aria attributes for accessibility

Examples

  <div class="form-group">
    <%= f.label :email, "Email *" %>
    <%= f.email_field :email, class: "form-control", required: true %>
  </div>

  <div class="form-group">
    <%= f.label :avatar %>
    <div class="file-input-group">
      <label for="avatar" class="btn btn-tertiary">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-5 h-5 mr-1">
          <path fill-rule="evenodd" d="M1.5 6a2.25 2.25 0 0 1 2.25-2.25h16.5A2.25 2.25 0 0 1 22.5 6v12a2.25 2.25 0 0 1-2.25 2.25H3.75A2.25 2.25 0 0 1 1.5 18V6ZM3 16.06V18c0 .414.336.75.75.75h16.5A.75.75 0 0 0 21 18v-1.94l-2.69-2.689a1.5 1.5 0 0 0-2.12 0l-.88.879.97.97a.75.75 0 1 1-1.06 1.06l-5.16-5.159a1.5 1.5 0 0 0-2.12 0L3 16.061Zm10.125-7.81a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Z" clip-rule="evenodd" />
        </svg>
        <span>Upload Avatar</span>
      </label>
      <%= f.file_field :avatar, id: "avatar" %>
    </div>
  </div>

  <div class="mt-6">
    <%= f.button button_text("Save Changes", disable_with: "Saving..."), class: "btn btn-primary" %>
  </div>
<% end %>

Read the full file on GitHub · 108 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 · 108 lines · 0 tokens per session scan A 6a4f47d85299

Subscribe to this mod's changes

1003-rails-views 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 1,122 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.