---
name: tailwind
description: Tailwind CSS v4 styling and configuration.
title: tailwind
canonical_url: https://skilld.dev/gh/pymodel/react-frontend-skills/tailwind
last_updated: 2026-11-12T09:04:44.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> 42 supporting files sit beside this SKILL.md. When the Skill refers to one, fetch https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/PATH with PATH replaced.
>
> If the user asked to install this Skill, run `npx skilld install pymodel/react-frontend-skills/tailwind`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/tailwind`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/pymodel/react-frontend-skills/tailwind) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/tailwind`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/tailwind --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/tailwind --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Tailwind Labs Tailwind CSS v4 Best Practices

Comprehensive performance optimization guide for Tailwind CSS v4 applications, maintained by Tailwind Labs. Contains 42 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation. Current: Tailwind CSS 4.3.5.

## When to Apply

Reference these guidelines when:
- Configuring Tailwind CSS v4 build tooling (Vite plugin, PostCSS, CLI)
- Writing styles with v4's CSS-first approach
- Optimizing CSS bundle size and build performance
- Implementing responsive designs with breakpoints or container queries
- Setting up theming with @theme directive and design tokens

## Rule Categories by Priority

| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Build Configuration | CRITICAL | `build-` |
| 2 | CSS Generation | CRITICAL | `gen-` |
| 3 | Bundle Optimization | HIGH | `bundle-` |
| 4 | Utility Patterns | HIGH | `util-` |
| 5 | Component Architecture | MEDIUM-HIGH | `comp-` |
| 6 | Theming & Design Tokens | MEDIUM | `theme-` |
| 7 | Responsive & Adaptive | MEDIUM | `resp-` |
| 8 | Animation & Transitions | LOW-MEDIUM | `anim-` |

## Quick Reference

### 1. Build Configuration (CRITICAL)

- [`build-vite-plugin`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/build-vite-plugin.md) - Use Vite Plugin Over PostCSS
- [`build-css-import`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/build-css-import.md) - Import Tailwind With a Single CSS Import
- [`build-turbopack-loader`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/build-turbopack-loader.md) - Use the Turbopack Loader in Next.js
- [`build-content-detection`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/build-content-detection.md) - Leverage Automatic Content Detection
- [`build-postcss-simplify`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/build-postcss-simplify.md) - Use Only the Tailwind PostCSS Plugin
- [`build-cli-package`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/build-cli-package.md) - Use the @tailwindcss/cli Package

### 2. CSS Generation (CRITICAL)

- [`gen-css-first-config`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/gen-css-first-config.md) - Use CSS-First Configuration Over JavaScript
- [`gen-avoid-theme-bloat`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/gen-avoid-theme-bloat.md) - Avoid Excessive Theme Variables
- [`gen-oklch-colors`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/gen-oklch-colors.md) - Use OKLCH Color Space for Vivid Colors
- [`gen-utility-directive`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/gen-utility-directive.md) - Use @utility for Custom Utilities
- [`gen-dynamic-utilities`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/gen-dynamic-utilities.md) - Use Dynamic Utility Values
- [`gen-css-variable-syntax`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/gen-css-variable-syntax.md) - Use Parentheses for CSS Variable References

### 3. Bundle Optimization (HIGH)

- [`bundle-remove-unused-plugins`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/bundle-remove-unused-plugins.md) - Use Built-in Features Instead of Plugins
- [`bundle-avoid-preprocessors`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/bundle-avoid-preprocessors.md) - Avoid Sass/Less Preprocessors
- [`bundle-css-minification`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/bundle-css-minification.md) - Enable CSS Minification in Production
- [`bundle-avoid-cdn-production`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/bundle-avoid-cdn-production.md) - Avoid Play CDN in Production
- [`bundle-split-critical-css`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/bundle-split-critical-css.md) - Extract Critical CSS for Initial Render

### 4. Utility Patterns (HIGH)

- [`util-important-modifier`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/util-important-modifier.md) - Use Trailing Important Modifier
- [`util-variant-stacking`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/util-variant-stacking.md) - Stack Variants Left to Right
- [`util-explicit-colors`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/util-explicit-colors.md) - Use Explicit Border and Ring Colors
- [`util-opacity-modifier`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/util-opacity-modifier.md) - Use Slash Opacity Modifier
- [`util-gradient-via-none`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/util-gradient-via-none.md) - Use via-none to Reset Gradient Stops
- [`util-current-scale-names`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/util-current-scale-names.md) - Use the Current Utility Scale Names

### 5. Component Architecture (MEDIUM-HIGH)

- [`comp-avoid-apply-overuse`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/comp-avoid-apply-overuse.md) - Avoid Overusing @apply
- [`comp-reference-directive`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/comp-reference-directive.md) - Use @reference for CSS Module Integration
- [`comp-utility-file-scope`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/comp-utility-file-scope.md) - Understand Utility File Scope
- [`comp-smart-sorting`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/comp-smart-sorting.md) - Leverage Smart Utility Sorting
- [`comp-container-customize`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/comp-container-customize.md) - Customize Container with @utility

### 6. Theming & Design Tokens (MEDIUM)

- [`theme-semantic-tokens`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/theme-semantic-tokens.md) - Use Semantic Design Token Names
- [`theme-dark-mode-class`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/theme-dark-mode-class.md) - Use Class-Based Dark Mode for Control
- [`theme-prefix-variables`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/theme-prefix-variables.md) - Use Prefix for Variable Namespacing
- [`theme-runtime-variables`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/theme-runtime-variables.md) - Leverage Runtime CSS Variables
- [`theme-color-scheme`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/theme-color-scheme.md) - Set color-scheme for Native Dark Mode

### 7. Responsive & Adaptive (MEDIUM)

- [`resp-mobile-first`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/resp-mobile-first.md) - Use Mobile-First Responsive Design
- [`resp-container-queries`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/resp-container-queries.md) - Use Container Queries for Component-Level Responsiveness
- [`resp-custom-breakpoints`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/resp-custom-breakpoints.md) - Define Custom Breakpoints in @theme
- [`resp-hover-capability`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/resp-hover-capability.md) - Understand Hover Behavior on Touch Devices
- [`resp-logical-properties`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/resp-logical-properties.md) - Use Logical Properties for RTL Support

### 8. Animation & Transitions (LOW-MEDIUM)

- [`anim-gpu-accelerated`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/anim-gpu-accelerated.md) - Use GPU-Accelerated Transform Properties
- [`anim-starting-style`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/anim-starting-style.md) - Use @starting-style for Entry Animations
- [`anim-gradient-interpolation`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/anim-gradient-interpolation.md) - Use OKLCH Gradient Interpolation
- [`anim-3d-transforms`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/tailwind/references/anim-3d-transforms.md) - Use Built-in 3D Transform Utilities

## How to Use

Run in the project root first:

```bash
npx -y @pymodel/react-frontend-skills detect  # installed vs. targeted versions
```

Read `references/<rule-id>.md` for each rule above that matches the task: why it matters, then incorrect vs. correct code.
