c/frontend › command
0votes

Cursor rules for Tailwind CSS

TemplateLow risk
submitted by u/client to c/frontend · 0 copies

A .cursor/rules/tailwind.mdc that keeps utility classes consistent, readable and on-brand.

Template · 3 variables
---
description: Tailwind CSS conventions
globs: ["**/*.tsx","**/*.jsx","**/*.vue","**/*.svelte","**/*.html"]
alwaysApply: false
---

# Tailwind CSS

- Use theme tokens from `{{tailwind_config_path}}` (colors, spacing, radius); no arbitrary values like `text-[#123456]` unless the design requires it.
- Mobile first: base classes for phones, then `sm:`, `md:`, `lg:`.
- Order classes: layout → box → typography → color → state (or rely on the Prettier Tailwind plugin).
- Extract repeated class groups (3+ uses) into a component, not `@apply`.
- Every interactive element gets visible `focus-visible:` styles.
- Dark mode via `{{dark_mode_strategy}}`; check contrast in both themes.

## When you change code
- Follow the patterns in the nearest existing file before inventing new ones.
- Add or update a test for behavior changes; run `{{test_command}}`.
- Keep diffs small; explain anything surprising in your reply.
0 commentsreport

How to use this command

  1. Fill in the blanks. Type your details into the boxes above. This command has 3 blanks:
    • {{tailwind_config_path}} Tailwind config path
    • {{dark_mode_strategy}} Dark mode strategy
    • {{test_command}} Test command
  2. Copy itwith the Copy button. Your answers are filled in automatically. Use “copy raw” to keep the blanks for later.
  3. Paste it into Cursor, Claude, ChatGPT or Codex and send it.
  4. Tip: This produces a file or document. Save the filled-in result in your project (for example as CLAUDE.md or AGENTS.md) so you can reuse it.

More from c/frontend

See all of c/frontend →
0 comments

Log in to join the discussion.