prassamin/skills/tailwind-best-practice
Claude Code and agent skill by prassamin/skills
- community
Checking that the SKILL.md file is still in the repository.
Tailwind CSS v4 best practices for theming, design tokens, dark mode, gradients, responsive design, and animations. Use when writing, reviewing, or refactoring Tailwind CSS code. Triggers on tasks involving styling, CSS, colors, theming, dark mode, responsive design, gradients, animations, transitions, layout, or UI styling decisions. Also use when setting up a new project's design system or reviewing CSS/Tailwind code quality.
Install
npx vskill@latest install prassamin/skills/tailwind-best-practiceSKILL.md
Tailwind CSS v4 Best Practices
Team standard for styling with Tailwind CSS v4 — CSS-first config, design tokens via CSS variables, class-based dark mode.
No Hardcoded Colors (MANDATORY)
Never use raw color values in components. All colors must come from the design token system defined in globals.css.
Before writing any styles: Confirm the color theme with the user. Register all colors in globals.css as CSS variables, then use them everywhere.
No Arbitrary Brackets (MANDATORY)
Tailwind v4 dynamically generates values — stop using `[brackets]` for things Tailwind already supports natively.
How it works in v4:
| Type | Formula | Example | |
|---|---|---|---|
| Spacing (w, h, p, m, gap...) | value × 4px | w-100 = 400px, p-8 = 32px, w-2500 = 10000px | |
| Opacity | Integer = percent | bg-primary/4 = 4% opacity, bg-primary/80 = 80% | |
| Z-index | Any integer | z-999, z-6969 — no brackets needed |
Rule: Only use [brackets] when there is truly no Tailwind equivalent (e.g., grid-cols-[1fr_2fr]).
Gradients — Use v4 Syntax (MANDATORY)
Tailwind v4 renamed gradients and added radial/conic support. Stop using v3 `bg-gradient-to-*`.
| v3 (old) | v4 (new) | |
|---|---|---|
bg-gradient-to-r | bg-linear-to-r | |
bg-gradient-to-br | bg-linear-to-br | |
| Not available | bg-linear-45 (any angle) | |
| Not available | bg-radial | |
| Not available | bg-conic-180 (any angle) |
Gradient stops support positions: from-primary from-20% via-accent via-60% to-secondary to-100%
Theming Setup (MANDATORY)
First ask the user: Do you need one theme or two (light + dark)?
Every project must define its color system in globals.css using CSS variables + Tailwind's @theme directive.
Single theme (light only)
If the user only needs one theme, define everything in :root. No .dark, no @custom-variant.
Two themes (light + dark)
If the user needs both themes, :root = light, .dark = dark, plus enable class-based toggle.
Then use semantic classes everywhere:
For full theming guide, see references/theming.md.
Dark Mode (only when two themes are used)
Class-based toggle via .dark on <html>. Semantic tokens handle it automatically.
Never use `dark:` with hardcoded colors:
Component Styling
| Pattern | When to Use | |
|---|---|---|
| Utility classes | Default — most styling | |
cn() utility | Conditional/merged classes | |
| CSS variables + @theme | Design tokens, theme colors | |
@variant | Custom CSS needing Tailwind variants | |
@apply | Rarely — only base element resets |
Responsive Design
Mobile-first. Use breakpoint prefixes to scale up:
Always ascending order: base → sm: → md: → lg: → xl: → 2xl:
Tailwind v4 also provides max-* and not-* variants:
Animation
Define custom animations in globals.css via @theme + @keyframes:
Always respect reduced motion: motion-safe:animate-fade-in
For full responsive + animation guide, see references/responsive-animation.md.
Code Review
Quick checks for Tailwind code:
- No hardcoded colors? (
bg-blue-500,text-[#fff]) - Semantic tokens used? (
bg-primary,text-foreground) cn()for conditional classes?- Focus styles on all interactive elements?
- Mobile-first responsive? Breakpoints ascending?
- Reduced motion respected?
For full checklist, see references/code-review-checklist.md.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/tailwind-best-practice/SKILL.md
Popularity
- 7-day trend score
- 0
Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/prassamin/skills/tailwind-best-practice)