--- name: forge-tailwindcss-conventions description: "Load when the task involves Tailwind CSS — styling components, utility classes, className work, converting custom CSS to utilities, or Tailwind build/config issues. Covers v4 (CSS-first) and flags v3 differences." source: https://raw.githubusercontent.com/weselben/RooForge/main/skills/forge-tailwindcss-conventions/SKILL.md --- # Tailwind CSS Conventions **Leading word: utility-first.** Check if a utility class exists before writing custom CSS. Custom CSS is the last resort. Tailwind CSS v4 (released January 2025) is a **CSS-first, zero-config framework**. Key changes from v3: no `tailwind.config.js` required; configuration lives in CSS via `@theme`, `@utility`, and `@source` directives. The Oxide engine delivers sub-10ms builds with automatic tree-shaking and <10KB output. **Verify which version the project uses before applying conventions** — v3 used `tailwind.config.js`. ## Core architecture (v4) Import `@import "tailwindcss";` in the main CSS file. Configuration lives in CSS: ```css @import "tailwindcss"; @theme { --color-brand: #0ea5e9; --font-sans: "Inter", sans-serif; } @utility clip-blob { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); } ``` - **`@theme`** — defines design tokens as CSS custom properties. `--color-purple-500` in `@theme` auto-generates `bg-purple-500`, `text-purple-500`, `border-purple-500`, etc. OKLCH by default. - **`@source`** — controls which files Tailwind scans. `source(none)` disables auto-detection; add extra paths for libraries. ## Class ordering convention Order classes consistently (layout → sizing → typography → color → effects → states → responsive → dark): ```jsx