This skill covers Tailwind CSS v4 (2025) with CSS-native configuration, Oxide engine, and modern patterns. The architecture has fundamentally changed from v3.
What This Skill Provides
The Tailwind CSS Patterns skill provides comprehensive knowledge of Tailwind v4’s modern, CSS-first approach to styling. It covers the architectural shift from JavaScript configuration to CSS-based theming.Core Concepts
CSS-First Configuration
Theme definition using
@theme directive instead of JavaScript config filesOxide Engine
Rust-based compiler providing 10x faster builds with always-on JIT
Container Queries
Native support for container-based responsive design without breakpoints
Modern Color System
OKLCH color space for perceptually uniform color tokens
When This Skill Is Loaded
Agents load this skill when:- Implementing CSS styling with Tailwind
- Configuring Tailwind v4 themes
- Working with responsive design and container queries
- Setting up design tokens and color systems
- Optimizing CSS performance
- Migrating from Tailwind v3 to v4
Key Changes from v3 to v4
| v3 (Legacy) | v4 (Current) |
|---|---|
tailwind.config.js | CSS-based @theme directive |
| PostCSS plugin | Oxide engine (10x faster) |
| JIT mode | Native, always-on |
| Plugin system | CSS-native features |
@apply directive | Still works, discouraged |
Use Cases
CSS-Based Theme Configuration
Define design tokens directly in CSS:Container Queries (v4 Native)
Respond to parent element width instead of viewport: When to use:- Page-level layouts → Viewport breakpoints (
md:,lg:) - Component-level responsive → Container queries (
@md:,@lg:) - Reusable components → Container queries (context-independent)
Container Query Pattern
Define container on parent with
@container, then use @sm:, @md:, @lg: prefixes on children to respond to parent width instead of viewport.Modern Layout Patterns
Flexbox Patterns:- Center both axes:
flex items-center justify-center - Vertical stack:
flex flex-col gap-4 - Space between:
flex justify-between items-center
- Auto-fit responsive:
grid grid-cols-[repeat(auto-fit,minmax(250px,1fr))] - Asymmetric (Bento):
grid grid-cols-3 grid-rows-2with spans - Sidebar layout:
grid grid-cols-[auto_1fr]
Dark Mode Strategies
| Method | Behavior | Use When |
|---|---|---|
class | .dark class toggles | Manual theme switcher |
media | Follows system preference | No user control |
selector | Custom selector (v4) | Complex theming |
Modern Color System
OKLCH vs RGB/HSL
OKLCH
Perceptually uniform, better for design systems
HSL
Intuitive hue/saturation control
RGB
Legacy compatibility
Color Token Architecture
Three-Layer System:
- Primitive - Raw color values (
--blue-500) - Semantic - Purpose-based naming (
--color-primary) - Component - Component-specific (
--button-bg)
Typography System
Font Stack Pattern
| Type | Recommended |
|---|---|
| Sans | 'Inter', 'SF Pro', system-ui, sans-serif |
| Mono | 'JetBrains Mono', 'Fira Code', monospace |
| Display | 'Outfit', 'Poppins', sans-serif |
Type Scale
| Class | Size | Use |
|---|---|---|
text-xs | 0.75rem | Labels, captions |
text-sm | 0.875rem | Secondary text |
text-base | 1rem | Body text |
text-lg | 1.125rem | Lead text |
text-xl+ | 1.25rem+ | Headings |
Animation & Transitions
Built-in Animations
animate-spin- Continuous rotation (loading spinners)animate-ping- Attention pulse (notifications)animate-pulse- Subtle opacity pulse (loading state)animate-bounce- Bouncing effect (scroll indicators)
Transition Patterns
- All properties:
transition-all duration-200 - Specific:
transition-colors duration-150 - With easing:
ease-outorease-in-out - Hover effect:
hover:scale-105 transition-transform
Related Skills
Frontend Design
Design principles for color, typography, and layout decisions
Next.js React Expert
Performance optimization for CSS and rendering
Web Design Guidelines
Accessibility and best practices for implementations
Which Agents Use This Skill
Frontend Specialist
The Frontend Specialist loads this skill for all styling work with Tailwind CSS. It’s used in conjunction with
frontend-design for design decisions and nextjs-react-expert for performance considerations.Component Extraction
When to Extract
| Signal | Action |
|---|---|
| Same class combo 3+ times | Extract component |
| Complex state variants | Extract component |
| Design system element | Extract + document |
Extraction Methods
React/Vue Component
When dynamic behavior or JS needed
@apply in CSS
For static styles without JS
Design Tokens
For reusable values across components
Anti-Patterns to Avoid
Performance Principles
Automatic Optimizations
- Purge unused CSS - Automatic in v4
- Oxide compiler - Default, 10x faster than v3
- JIT compilation - Always on, no configuration needed
- CSS caching - Leverage CI/CD caching for builds
Remember: Tailwind v4 is CSS-first. Embrace CSS variables, container queries, and native features. The JavaScript config file is now optional.
