useclassy-authoring.cursor-rule

A coding rule for writing UseClassy modifier attributes, which move Tailwind CSS variants such as hover or responsive styles from class names into separate attributes.

In plain words
What is it for?
Use it when adding or migrating static Tailwind variants in HTML, Vue, Svelte, Blade, React, or similar files.
Why use it?
It keeps styling syntax consistent and helps refactor existing variant classes without changing their behavior.

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/jrmybtlr/useclassy/useclassy-authoring.cursor-rule
Clone the repo
git clone --depth 1 https://github.com/jrmybtlr/useclassy
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 525 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.00525
Opus 5 $0.00000 $0.00262
Sonnet 5 $0.00000 $0.00105
Haiku 4.5 $0.00000 $0.00052

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

Security

Grade A, and why

useclassy-authoring.cursor-rule 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 3d 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.

templates/useclassy-authoring.cursor-rule.mdc · 40 lines

What it actually says

UseClassy authoring and refactoring

When this project uses vite-plugin-useclassy, write new static Tailwind variants as modifier attributes and migrate existing static variant tokens when behavior is preserved.

Conversion

<!-- Before -->
<button class="rounded px-4 hover:bg-blue-500 hover:text-white sm:px-6">

<!-- After -->
<button class="rounded px-4" class:hover="bg-blue-500 text-white" class:sm="px-6">
<button className="rounded px-4" className:hover="bg-blue-500" className:focus="ring-2">
// React: JSX expressions with string literals are supported
<button className:hover={on ? 'bg-blue-500' : 'bg-gray-200'} />

Rules

  • Base utilities on class / className; variants on class:mod="…" / className:mod="…".
  • Group static utilities by identical modifier prefix (including chains such as sm:hover) and remove that prefix from each modifier value.
  • Vue / Blade / Svelte / HTML: values must be double-quoted static strings.
  • React: prefer double-quoted static strings; className:mod={cond ? 'a' : 'b'} is also valid when literals should be prefixed.
  • Leave Vue :class, Svelte native class:name={cond}, and unrelated dynamic base expressions unchanged.
  • Svelte: only transform quoted UseClassy modifiers (class:hover="…"). Do not rewrite native class:name={cond} or class:name.
  • Keep arbitrary variants such as [&>*]:mt-2 and data-[state=open]:block in the base string. Named groups (group-hover/item) and @md container queries work as Vue/HTML modifier names; in React JSX, keep named groups on className because / is not a valid attribute-name character.
  • Chained attributes match Tailwind/Uno composition: class:sm:hover="underline" generates sm:hover:underline only. Converting sm:hover:underline to class:sm:hover="underline" is behavior-preserving.
  • After refactoring, run formatting and relevant tests/build; verify dynamic classes and rendered states are unchanged.
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. 3d ago First seen · 40 lines · 0 tokens per session scan A 13af16c986d3

Subscribe to this mod's changes

useclassy-authoring.cursor-rule is a cursor rule published in the GitHub repository jrmybtlr/useclassy (28 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 525 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-30.