css-variable-linting-standards

A set of CSS rules that checks whether styles use shared CSS variables instead of repeated hardcoded values. CSS variables are reusable names for values such as colors and spacing.

In plain words
What is it for?
Use it during code review or commits to check staged CSS for hardcoded colors, spacing, and similar values, and replace supported violations with variables.
Why use it?
It catches inconsistent styling before commits are accepted and can suggest or apply fixes to the affected lines.

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

Copies of this mod

1 near-identical copy found in the catalogue:

.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/da-express-milo (6 stars, last pushed 2d 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. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.