tailwind

Migrate Tailwind v3 projects to v4 with @theme tokens and component patterns.

4|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/rbaumier/skills --skill tailwind-rbaumier
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tailwind
Source: https://github.com/rbaumier/skills/tree/main/tailwind
Command: npx skills add https://github.com/rbaumier/skills --skill tailwind-rbaumier

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Modern frontend teams struggle to keep Tailwind-based codebases consistent, accessible, and safe during migrations to Tailwind v4. This Skill provides clear conventions and actionable rules to avoid common pitfalls (dynamic class purging, inconsistent spacing, fragile dark-mode handling) and to adopt CSS-first configuration, semantic tokens, and robust component patterns.

Core Features & Use Cases

  • Migration guidance: move tailwind.config.js into @theme CSS blocks, replace @tailwind with @import "tailwindcss", and apply v4 opacity and utility directives.
  • Class management & component patterns: use cn() (twMerge + clsx) for merges, cva() for component variants, avoid @apply for component styling, and prefer tailwind-variants for slot-based components.
  • Design tokens & color system: define OKLCH tokens in @theme, clear defaults with --color-*: initial, use color-mix(in oklab) for translucent variants, and override tokens in .dark for theme toggles.
  • Responsive, accessibility & performance rules: mobile-first breakpoints, container queries for components, focus rings, 44x44 touch targets, motion-reduce support, and GPU-only animations (transform/opacity).
  • Build & tooling: prefer @tailwindcss/vite or @tailwindcss/postcss for v4 integration, use @plugin/@utility/@custom-variant directives instead of legacy config arrays, and avoid scanning node_modules.

Quick Start

Audit your project for tailwind v3 patterns, convert theme values into a CSS @theme block using OKLCH tokens, replace @tailwind directives with @import "tailwindcss", and apply cn()/cva() patterns while ensuring accessibility and motion-reduce support.

Frequently Asked Questions about tailwind

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate Tailwind v3 to v4 using the new CSS-first configuration?

Migrate Tailwind v3 to v4 by moving tailwind.config.js values into @theme CSS blocks, replacing @tailwind directives with @import "tailwindcss", and applying v4 opacity and utility directives.

What is the best way to implement dark mode in Tailwind v4?

Implement dark mode in Tailwind v4 by defining OKLCH tokens in @theme, clearing defaults with --color-*: initial, and overriding those tokens in a .dark selector using @custom-variant for robust theme toggles.

How does class merging with cva and twMerge work for component variants?

Class merging for component variants works by using cva() to define variant patterns and cn()—combining twMerge and clsx—to safely merge classes and prevent Tailwind style conflicts.

Does Tailwind v4 support OKLCH color tokens and translucent variants?

Yes, Tailwind v4 supports OKLCH color tokens by defining them directly in the @theme block, and you can generate translucent variants using the color-mix(in oklab) CSS function.

Why should I avoid @apply for component styling in Tailwind projects?

Avoid @apply for component styling because it creates hidden dependencies and purging issues; instead, use tailwind-variants for slot-based components and cn() for safe utility merges.

What build tools do I need for Tailwind v4 integration?

For Tailwind v4 integration, use @tailwindcss/vite or @tailwindcss/postcss build plugins, and replace legacy config arrays with @plugin, @utility, and @custom-variant directives while avoiding node_modules scanning.