Skill

Implement Modern Tailwind CSS Patterns

Reference patterns for Tailwind CSS v4's CSS-first theming, container queries, OKLCH colors, and modern responsive layouts.

Works with github

91
Spark score
out of 100
Updated 9 days ago
Version 15.7.0

Add to Favorites

Why it matters

Leverage advanced patterns and features of Tailwind CSS v4 to build modern, performant, and maintainable web interfaces. This skill guides you through CSS-first configuration, container queries, and optimized layout techniques.

Outcomes

What it gets done

01

Configure Tailwind v4 using CSS-first theme and design tokens.

02

Implement responsive designs with container queries and viewport breakpoints.

03

Apply modern layout patterns using Flexbox and Grid.

04

Optimize color and typography systems with semantic tokens and font stacks.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-tailwind-patterns | bash

Overview

Tailwind CSS Patterns (v4 - 2025)

A quick-reference guide to Tailwind CSS v4 patterns: CSS-first @theme configuration, container queries, OKLCH color tokens, dark mode strategies, and layout/typography conventions, structured as decision tables rather than prose. Use when configuring Tailwind v4 projects, migrating from v3's JS config to CSS-native theming, or choosing between viewport breakpoints and container queries for responsive components.

What it does

This skill provides a structured reference for Tailwind CSS v4's CSS-first architecture, covering the shift from tailwind.config.js to the @theme directive, the Rust-based Oxide engine, and always-on JIT compilation. It documents how to define design tokens directly in CSS using --color-*, --spacing-*, and --font-* variables, and lays out the difference between extending Tailwind's default scale versus overriding it entirely with semantic tokens. It also covers native container queries (@container, @sm:/@md: on children) as a v4-first alternative to viewport-based breakpoints for component-level responsiveness.

Beyond configuration, it catalogs dark mode strategies (class, media, selector), common flexbox and grid layout patterns (including asymmetric "Bento" grids preferred over symmetric 3-column layouts), the OKLCH color model and its three-tier token architecture (primitive/semantic/component), a typography scale, and built-in animation/transition utility classes.

When to use - and when NOT to

Use this skill when setting up or auditing a Tailwind v4 project: writing the @theme block, deciding whether a responsive concern belongs to viewport breakpoints or container queries, picking a dark mode strategy, or choosing when a repeated class combination should be extracted into a component versus handled with @apply. It also works as an anti-pattern checklist - flagging arbitrary values, !important, inline style= attributes, mixed v3/v4 configuration, and duplicated long class lists.

It is not a replacement for Tailwind's official documentation on individual utility class names, and it does not cover Tailwind v3 configuration in depth beyond noting what changed. Projects still on Tailwind v3 with a JavaScript config file should treat the v4-specific sections (CSS-first theming, Oxide engine, native container queries) as forward-looking migration guidance, not as applicable today.

Inputs and outputs

Input is a Tailwind CSS v4 project (or one being migrated to v4) with a specific styling question - theme configuration, responsive strategy, dark mode setup, or component extraction. Output is a concrete pattern: a CSS snippet, a table-driven decision (e.g. breakpoint vs container query), or a checklist item from the anti-patterns/performance sections.

# Example @theme block (CSS, not shell, but shown verbatim from source)
@theme {
  --color-primary: oklch(0.7 0.15 250);
  --spacing-md: 1rem;
  --font-sans: 'Inter', system-ui, sans-serif;
}

Integrations

Applies directly within any Tailwind CSS v4 build pipeline (Oxide engine, native CSS nesting) and is framework-agnostic - the same patterns apply to React, Vue, or plain HTML projects using Tailwind utility classes.

Who it's for

Frontend developers and designers working with Tailwind CSS v4 who need a fast lookup for CSS-first configuration syntax, container query usage, dark mode wiring, or a gut-check against common Tailwind anti-patterns, rather than a full tutorial.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.