css-variable-linting-standards

A code-review and commit rule for CSS variables, which are named values such as colors and spacing stored in one place. It checks for hardcoded CSS values and can suggest or apply matching variables.

In plain words
What is it for?
Use it when reviewing CSS or committing changes that should use variables from `:root`, the document-wide CSS variable section. It checks staged files, reports file and line details, and can fix detected values.
Why use it?
It helps keep styles consistent and makes shared design changes easier. It also catches violations before a commit is accepted.

Cursor rule for Cursor

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/adobecom/express-milo/css-variable-linting-standards
Clone the repo
git clone --depth 1 https://github.com/adobecom/express-milo

Made for: Cursor.

Per session 2,859 This file is loaded in full into every session.
When invoked 2,859 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.02859 $0.02859
Opus 5 $0.01430 $0.01430
Sonnet 5 $0.00572 $0.00572
Haiku 4.5 $0.00286 $0.00286

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

Security

Grade A, and why

css-variable-linting-standards 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 2d 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.

Origin

This is a copy

100% identical to css-variable-linting-standards — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/css-variable-linting-standards.mdc · 373 lines

How it starts

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

CSS Variable Linting Standards

APPLY: "Code review" queries and block creation

Automated CSS Variable Enforcement

Based on PR #496: CSS Variable Linter and enhanced by PR #527: Auto-fix Improvements, this rule enforces consistent use of CSS variables from :root instead of hardcoded values.

Pre-commit Hook Integration

Automatic Enforcement

  • Blocks commits until violations are fixed
  • Staged files only - only checks files being committed
  • Clear feedback - shows exact file, line, and suggested fixes
  • Reliable auto-fix - actually replaces values (enhanced in PR #527)
  • Multiple values per line - handles padding: 40px 32px; correctly
  • Precise line targeting - accurate line number calculation for fixes

What Gets Detected

1. Color Values (All Formats)
/* ❌ VIOLATIONS: Hardcoded colors */
color: #ffffff;
background: #000;
border-color: #E9E9E9;
background: rgb(255, 255, 255);
border: 1px solid rgba(0, 0, 0, 0.1);
color: black;           /* ✨ NEW: Named colors now detected */
background: white;      /* ✨ NEW: Named colors now detected */
color: transparent;     /* ✨ NEW: Named colors now detected */

/* ✅ CORRECT: CSS variables */
color: var(--color-white);
background: var(--color-black);
border-color: var(--color-light-gray);
background: var(--color-white);
border: 1px solid var(--color-black-10);
color: var(--color-black);      /* ✨ NEW: Better variable suggestions */
background: var(--color-white); /* ✨ NEW: Better variable suggestions */
color: var(--color-transparent);/* ✨ NEW: Better variable suggestions */
2. Spacing Values (All Units)
/* ❌ VIOLATIONS: Hardcoded spacing */
margin-top: 16px;
padding: 8px 16px;          /* ✨ FIXED: Multiple values now handled */
gap: 24px;
margin: 40px 32px 24px 16px; /* ✨ FIXED: All values replaced correctly */
width: 320px;
height: 2rem;

/* ✅ CORRECT: CSS variables (auto-fix now works reliably) */
margin-top: var(--spacing-300);
padding: var(--spacing-100) var(--spacing-300);     /* ✨ FIXED: Both values replaced */
gap: var(--spacing-400);
margin: var(--spacing-600) var(--spacing-500) var(--spacing-400) var(--spacing-300); /* ✨ FIXED: All values replaced */
width: var(--size-mobile-width);
height: var(--spacing-600);

Read the full file on GitHub · 373 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. 2d ago First seen · 373 lines · 2,859 tokens per session scan A e87f08170c90

Subscribe to this mod's changes

css-variable-linting-standards is a cursor rule published in the GitHub repository adobecom/express-milo (6 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 2,859 tokens to every session, about $0.0143 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to css-variable-linting-standards, differing in 0 lines, and is treated as a copy.