tailwind-css

A set of rules for using Tailwind CSS, a styling toolkit for building web interfaces from small reusable style classes. It covers responsive layouts, shared design values, and when to extract repeated styles into components.

In plain words
What is it for?
Use it when writing or reviewing Tailwind CSS for mobile-friendly layouts, design tokens, typography, colors, spacing, and reusable components.
Why use it?
It keeps styles consistent and makes common changes, such as updating a brand color or spacing value, easier to manage.

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/nedcodes-ok/cursorrules-collection/tailwind-css
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection
Per session 935 This file is loaded in full into every session.
When invoked 935 The same file — it is already loaded in full.
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.00935 $0.00935
Opus 5 $0.00467 $0.00467
Sonnet 5 $0.00187 $0.00187
Haiku 4.5 $0.00093 $0.00093

Measured yesterday against content hash 97f076eb7317, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tailwind-css 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 yesterday.

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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

rules-mdc/frameworks/tailwind-css.mdc · 50 lines

How it starts

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

Tailwind CSS Cursor Rules

You are an expert Tailwind CSS developer (v3.4+). Follow these rules:

Utility Usage

  • Utilities first. Extract components only after 3+ repetitions of the same combination
  • Mobile-first responsive: sm:, md:, lg: build upward from mobile — never max-width media queries
  • Group related utilities in consistent order: layout (flex, grid) → sizing (w, h) → spacing (p, m) → typography → colors → effects → transitions
  • Use arbitrary values [24px] only when the default scale genuinely doesn't cover it — check the docs first, Tailwind's spacing scale is more complete than people think (0.5, 1.5, 2.5 exist)
  • Prefer size-* (Tailwind v3.4+) when width and height are the same — size-8 not w-8 h-8

Design Tokens

  • Extend theme in tailwind.config — don't repeat arbitrary values across files
  • Define semantic color names: primary, surface, muted, destructive — not blue-500 scattered everywhere. When the brand color changes you want one edit, not fifty
  • Consistent spacing scale: extend the default, don't replace it — your custom values should fill gaps, not create a parallel system
  • Font size with leading: text-lg/7 for paired type + line-height. This is cleaner than separate text-lg leading-7
  • Use CSS variables for colors that need runtime switching (themes, white-label): --color-primary in tailwind.config, not hardcoded hex

Component Patterns

  • @apply in CSS files for truly atomic repeated patterns (.btn-primary, .input-base)
  • Prefer component extraction (React/Vue components) over @apply for anything with structure — @apply is for styling, components are for structure + styling
  • Never @apply responsive or state variants (hover:, sm:) — those belong in markup where you can see them
  • Use CVA (class variance authority) or a similar lib for variant management — avoids massive ternary chains in className
  • cn() utility (clsx + twMerge) for conditional classes — plain string concatenation breaks with conflicting utilities (p-4 p-2 doesn't resolve, twMerge picks the last one)

Read the full file on GitHub · 50 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. yesterday First seen · 50 lines · 935 tokens per session scan A 97f076eb7317

Subscribe to this mod's changes

tailwind-css is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 935 tokens to every session, about $0.0047 per session on Opus 5. 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-30.