tailwind-usage

tailwind-usage is a cursor rule for Cursor from n9e/fe. It costs 0 tokens per session (593 once invoked), scanned A, original, Apache-2.0.

Frontend styling rules for using Tailwind utility classes first, with a small amount of Less or CSS when needed. Tailwind is a way to apply common visual styles directly in markup.

In plain words
What is it for?
Use it when building or updating layouts, buttons, forms, interaction states, and styles for third-party components.
Why use it?
It reduces conflicting style definitions and keeps component styling local and easier to maintain.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when building or updating layouts, buttons, forms, interaction states, and styles for third-party components.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/n9e/fe/tailwind-usage
View source ↗ n9e/fe
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.

Clone the repo
git clone --depth 1 https://github.com/n9e/fe

Made for: Cursor.

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 tailwind-usage

README.md
[![agentmods](https://agentmods.dev/badge/rules/n9e/fe/tailwind-usage/github.svg)](https://agentmods.dev/rules/n9e/fe/tailwind-usage)
Your own site
<a href="https://agentmods.dev/rules/n9e/fe/tailwind-usage"><img src="https://agentmods.dev/badge/rules/n9e/fe/tailwind-usage/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tailwind-usage

Your own site · 80×15
<a href="https://agentmods.dev/rules/n9e/fe/tailwind-usage"><img src="https://agentmods.dev/badge/rules/n9e/fe/tailwind-usage.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 593 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.00593
Opus 5.5 $0.00000 $0.00237
Sonnet 5.5 $0.00000 $0.00119
Haiku 4.5 $0.00000 $0.00059

Measured 1mo ago against content hash fba48ff439bc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tailwind-usage 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 1mo 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.

.cursor/rules/tailwind-usage.mdc · 47 lines

What it actually says

样式:Tailwind 优先 + 少量 Less

全局约定(颜色变量、最小改动等)见 .cursor/rules/app.mdc。

原则

  1. 能直接用 Tailwind 表达的(布局、间距、排版、圆角、常见交互态)→ 用 Tailwind。
  2. Tailwind 不划算或做不到的 → 少量 Less/CSS,选择器尽量收束在页面/模块根类名下。
  3. 同一视觉属性不要同时被 Tailwind 与 Less 争抢(避免难排查的覆盖问题)。

优先用 Tailwind

  • 容器布局:flex / grid / gap / 内外边距 / 对齐。
  • 业务界面:按钮、表单外观、文案层级、状态色(需与主题变量一致时,用已有 Tailwind 主题映射或 CSS 变量类,不硬编码色值)。
  • 局部状态:hover / focus / disabled 等。
  • 仅当前组件使用的展示类样式。

用 Less / 普通 CSS 更合适的情况

  • 覆盖第三方组件内部结构(如 antd 深层节点、复杂表格头)。
  • 全局或跨多页复用的 token、keyframes、无法用工具类清晰表达的动画。
  • 强依赖复杂选择器(深层后代、兄弟组合、兼容向 hack 等)。

Less/CSS 侧要求:

  • 选择器尽量局部化;嵌套不宜过深(≤3 层为宜)。
  • 不复制一套与 Tailwind 等价的冗长规则。

实践技巧

  • 可在 className 中使用 antd 定向写法(如 [&_.ant-input-affix-wrapper])以减少裸 Less。
  • 单处 className 过长时,抽成本地常量字符串或小组件,不要为此回到大段 Less。
  • 改旧页面时优先增量迁移:先动当前需求触及的区块(如工具栏、列表行),再逐步收拢公共块。

自检

  • 是否出现 Tailwind 与 Less 同时控制同一属性?
  • 是否新增了大段可被 Tailwind 替代的 Less?
  • 明暗主题下视觉是否与现有变量体系一致?
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. 1mo ago First seen · 47 lines · 0 tokens per session scan A fba48ff439bc

Subscribe to this mod's changes

tailwind-usage is a cursor rule published in the GitHub repository n9e/fe (307 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 593 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-09-01.