web-styling-tailwind
Tailwind CSS v4という、CSSの設定を柔軟に行える便利なツールを使って、ウェブサイトのデザインを効率的に、そして思い通りに調整するSkill。
📜 元の英語説明(参考)
Tailwind CSS v4 - utility-first CSS framework with CSS-first configuration
🇯🇵 日本人クリエイター向け解説
Tailwind CSS v4という、CSSの設定を柔軟に行える便利なツールを使って、ウェブサイトのデザインを効率的に、そして思い通りに調整するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o web-styling-tailwind.zip https://jpskill.com/download/10310.zip && unzip -o web-styling-tailwind.zip && rm web-styling-tailwind.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10310.zip -OutFile "$d\web-styling-tailwind.zip"; Expand-Archive "$d\web-styling-tailwind.zip" -DestinationPath $d -Force; ri "$d\web-styling-tailwind.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
web-styling-tailwind.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
web-styling-tailwindフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[Skill 名] web-styling-tailwind
Tailwind CSS v4+ パターン
クイックガイド: Tailwind CSS v4 は、
@import "tailwindcss"および@themeディレクティブ(tailwind.config.jsではない)による CSS ファーストの構成を使用します。デザイン トークンを@theme内の CSS 変数として定義し、@utilityでカスタムユーティリティを、@custom-variantでカスタムバリアントを作成します。自動コンテンツ検出(content配列は不要)。Vite には@tailwindcss/vite、Webpack には@tailwindcss/webpackを使用します。すべての色は oklch を使用します。v4.1 では、テキストシャドウ、マスク、および input-device バリアントが追加されました。Sass/Less/Stylus はサポートされていません。
詳細なリソース:
- コード例については、examples/ フォルダを参照してください。
- core.md - セットアップ、ソース検出、レスポンシブデザイン、ダークモード、ステートバリアント、テーマのカスタマイズ
- advanced.md - カスタムユーティリティ、カスタムバリアント、コンテナクエリ、3Dトランスフォーム、テキストシャドウ、マスク、input-device ターゲティング、アニメーション、コンポーネントの抽出
<critical_requirements>
重要: この Skill を使用する前に
すべてのコードは CLAUDE.md のプロジェクト規約に従う必要があります (kebab-case、名前付きエクスポート、インポート順序、
import type、名前付き定数)
(設定には必ず @import "tailwindcss" と @theme を使用してください - tailwind.config.js、@tailwind base、または module.exports は絶対に使用しないでください)
(カスタムユーティリティには必ず @utility を使用してください - @layer utilities {} (v3 構文) は絶対に使用しないでください)
(カスタムカラーには必ず @theme 内の oklch または CSS 変数参照を使用してください - テーマトークンに hex/rgb は絶対に使用しないでください)
(Vite には必ず @tailwindcss/vite、Webpack には @tailwindcss/webpack、その他には @tailwindcss/postcss を使用してください - tailwindcss を PostCSS プラグインとして直接使用しないでください)
(ボーダーカラーは明示的に指定する必要があります - v4 のデフォルトは gray-200 ではなく currentColor です)
</critical_requirements>
自動検出: Tailwind CSS, tailwindcss, @import "tailwindcss", @theme, @utility, @custom-variant, utility classes, bg-, text-, flex, grid, responsive design, dark:, hover:, focus:, @tailwindcss/vite, @tailwindcss/postcss, @tailwindcss/webpack, tailwind-merge, cn()
使用する場面:
- マークアップ内でユーティリティファーストの CSS クラスを使用して直接スタイリングする場合
- CSS ファーストの
@themeディレクティブでデザイン トークンを構成する場合 - ブレークポイントバリアントを使用してレスポンシブデザインを実装する場合
dark:バリアントでダークモードを追加する場合- CSS でカスタムユーティリティとバリアントを作成する場合
- Tailwind ユーティリティクラスでコンポーネントライブラリを構築する場合
- コンテナクエリ、3Dトランスフォーム、または最新の CSS 機能を使用する場合
カバーする主なパターン:
@import "tailwindcss"および@themeを使用した CSS ファーストのセットアップ- ブレークポイントバリアント (
sm:,md:,lg:) を使用したレスポンシブデザイン - ダークモード構成 (media, class, data-attribute 戦略)
- ステートバリアント (
hover:,focus:,group-*:,peer-*:) @theme名前空間を使用したテーマのカスタマイズ@utilityと関数値を使用したカスタムユーティリティ@custom-variantを使用したカスタムバリアント- コンテナクエリ (
@container,@sm:,@max-*:) - 3D トランスフォーム (
rotate-x-*,perspective-*,transform-3d) @starting-styleと@keyframesを使用したアニメーション- テキストシャドウ、マスク、overflow-wrap (v4.1)
cn()(clsx + tailwind-merge) を使用したコンポーネントの抽出- v3 から v4 への移行に関する注意点
使用しない場面:
- Sass/Less/Stylus を必要とするプロジェクト (v4 はスタンドアロンのプリプロセッサであり、Sass はサポートされていません)
- IE11 以前のブラウザのサポートが必要なプロジェクト (Safari 16.4 以降、Chrome 111 以降、Firefox 128 以降が必要)
- 完全なユーティリティフレームワークが過剰な小さなプロジェクト (プレーンな CSS を使用)
- すでに確立された CSS Modules または CSS-in-JS デザインシステムを使用しているプロジェクト
<philosophy>
Philosophy
Tailwind CSS v4 は、ユーティリティファースト、CSS ネイティブのアプローチに従います。構成可能なユーティリティクラスを使用してマークアップ内で直接スタイルを設定し、@theme を使用して CSS でデザイン トークンを構成し、@utility/@custom-variant ディレクティブで拡張します。JavaScript 構成ファイルは不要です。
コア原則:
- ユーティリティファースト: HTML 内の小さく、単一目的のクラスからスタイルを構成します
- CSS ファーストの構成: JavaScript ではなく、
@themeを介して CSS で定義されたデザイン トークン - ゼロ構成のデフォルト: 自動コンテンツ検出、賢明なデフォルトテーマ
- バリアント駆動のステート: レスポンシブ、ダークモード、hover、focus -- すべてクラスプレフィックス経由
- 最新の CSS 基盤: カスケードレイヤー、
@property、color-mix()、oklch カラー上に構築 - パフォーマンスファースト: v3 と比較して、5 倍高速なフルビルド、100 倍高速なインクリメンタルリビルド
v4 vs v3 -- 主な違い:
| 側面 | v3 | v4 |
|---|---|---|
| 設定 | tailwind.config.js |
CSS の @theme |
| インポート | @tailwind base/components/utilities |
@import "tailwindcss" |
| カスタムユーティリティ | @layer utilities {} |
@utility name {} |
| カスタムバリアント | addVariant() プラグイン |
@custom-variant |
| コンテンツ検出 | 手動 content: [] |
自動 |
| 色 | sRGB hex/rgb | oklch (P3 gamut) |
| ボーダーのデフォルト | gray-200 |
currentColor |
| リングのデフォルト | 3px blue-500 |
1px currentColor |
| Important 修飾子 | !flex |
flex! |
| 任意の変数 | bg-[--var] |
bg-(--var) |
| コンテナクエリ | プラグインが必要 | ビルトイン |
| 3D トランスフォーム | 利用不可 | ビルトイン |
| テキストシャドウ | 利用不可 | ビルトイン (v4.1) |
| マスク | 利用不可 | ビルトイン (v4.1) |
</philosophy>
<patterns>
コアパターン
パターン 1: CSS ファーストのセットアップと構成
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Tailwind CSS v4+ Patterns
Quick Guide: Tailwind CSS v4 uses CSS-first configuration with
@import "tailwindcss"and@themedirective (NOTtailwind.config.js). Define design tokens as CSS variables in@theme, create custom utilities with@utility, custom variants with@custom-variant. Automatic content detection (nocontentarray). Use@tailwindcss/vitefor Vite,@tailwindcss/webpackfor Webpack. All colors use oklch. v4.1 adds text shadows, masks, and input-device variants. No Sass/Less/Stylus support.
Detailed Resources:
- For code examples, see examples/ folder:
- core.md - Setup, source detection, responsive design, dark mode, state variants, theme customization
- advanced.md - Custom utilities, custom variants, container queries, 3D transforms, text shadows, masks, input-device targeting, animations, component extraction
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST use @import "tailwindcss" and @theme for configuration - NEVER use tailwind.config.js, @tailwind base, or module.exports)
(You MUST use @utility for custom utilities - NEVER use @layer utilities {} (v3 syntax))
(You MUST use oklch or CSS variable references for custom colors in @theme - NEVER use hex/rgb for theme tokens)
(You MUST use @tailwindcss/vite for Vite, @tailwindcss/webpack for Webpack, @tailwindcss/postcss for others - NEVER use tailwindcss directly as PostCSS plugin)
(You MUST specify border colors explicitly - v4 defaults to currentColor not gray-200)
</critical_requirements>
Auto-detection: Tailwind CSS, tailwindcss, @import "tailwindcss", @theme, @utility, @custom-variant, utility classes, bg-, text-, flex, grid, responsive design, dark:, hover:, focus:, @tailwindcss/vite, @tailwindcss/postcss, @tailwindcss/webpack, tailwind-merge, cn()
When to use:
- Styling with utility-first CSS classes directly in markup
- Configuring design tokens with CSS-first
@themedirective - Implementing responsive design with breakpoint variants
- Adding dark mode with
dark:variant - Creating custom utilities and variants in CSS
- Building component libraries with Tailwind utility classes
- Using container queries, 3D transforms, or modern CSS features
Key patterns covered:
- CSS-first setup with
@import "tailwindcss"and@theme - Responsive design with breakpoint variants (
sm:,md:,lg:) - Dark mode configuration (media, class, data-attribute strategies)
- State variants (
hover:,focus:,group-*:,peer-*:) - Theme customization with
@themenamespaces - Custom utilities with
@utilityand functional values - Custom variants with
@custom-variant - Container queries (
@container,@sm:,@max-*:) - 3D transforms (
rotate-x-*,perspective-*,transform-3d) - Animation with
@starting-styleand@keyframes - Text shadows, masks, overflow-wrap (v4.1)
- Component extraction with
cn()(clsx + tailwind-merge) - Migration notes from v3 to v4
When NOT to use:
- Projects requiring Sass/Less/Stylus (v4 is a standalone preprocessor, no Sass support)
- Projects needing IE11 or older browser support (requires Safari 16.4+, Chrome 111+, Firefox 128+)
- Tiny projects where a full utility framework is overkill (use plain CSS)
- Projects already using an established CSS Modules or CSS-in-JS design system
<philosophy>
Philosophy
Tailwind CSS v4 follows a utility-first, CSS-native approach: style directly in markup using composable utility classes, configure design tokens in CSS with @theme, and extend with @utility/@custom-variant directives. No JavaScript configuration files needed.
Core Principles:
- Utility-first: Compose styles from small, single-purpose classes in HTML
- CSS-first configuration: Design tokens defined in CSS via
@theme, not JavaScript - Zero configuration defaults: Automatic content detection, sensible default theme
- Variant-driven states: Responsive, dark mode, hover, focus -- all via class prefixes
- Modern CSS foundation: Built on cascade layers,
@property,color-mix(), oklch colors - Performance-first: 5x faster full builds, 100x faster incremental rebuilds vs v3
v4 vs v3 -- Key Differences:
| Aspect | v3 | v4 |
|---|---|---|
| Config | tailwind.config.js |
@theme in CSS |
| Import | @tailwind base/components/utilities |
@import "tailwindcss" |
| Custom utilities | @layer utilities {} |
@utility name {} |
| Custom variants | addVariant() plugin |
@custom-variant |
| Content detection | Manual content: [] |
Automatic |
| Colors | sRGB hex/rgb | oklch (P3 gamut) |
| Border default | gray-200 |
currentColor |
| Ring default | 3px blue-500 |
1px currentColor |
| Important modifier | !flex |
flex! |
| Arbitrary vars | bg-[--var] |
bg-(--var) |
| Container queries | Plugin required | Built-in |
| 3D transforms | Not available | Built-in |
| Text shadows | Not available | Built-in (v4.1) |
| Masks | Not available | Built-in (v4.1) |
</philosophy>
<patterns>
Core Patterns
Pattern 1: CSS-First Setup and Configuration
Tailwind v4 replaces JavaScript config with CSS-first configuration. Use @import "tailwindcss" instead of @tailwind directives, and @theme instead of tailwind.config.js.
Installation Options
Vite projects (recommended): Use @tailwindcss/vite for optimal performance.
Webpack projects: Use @tailwindcss/webpack (added in v4.2).
Other bundlers: Use @tailwindcss/postcss as PostCSS plugin.
CLI: Use @tailwindcss/cli for standalone builds.
Key Concepts
@import "tailwindcss"replaces the three@tailwinddirectives@themedefines design tokens that generate utility classes AND CSS variables@sourceadds paths not caught by automatic content detection@source notexcludes paths from scanning (v4.1)@source inline("...")safelists specific utilities without source files (v4.1)@referenceimports theme/utilities for scoped styles (Vue SFC, CSS Modules) without duplicating output- No
contentarray needed -- Tailwind auto-detects template files respecting.gitignore
For implementation examples, see examples/core.md.
Pattern 2: Responsive Design with Breakpoint Variants
Tailwind v4 uses mobile-first responsive design with breakpoint variants. Default breakpoints: sm (40rem), md (48rem), lg (64rem), xl (80rem), 2xl (96rem).
Key Concepts
- Mobile-first: base styles apply to all, breakpoint variants add overrides
- Custom breakpoints defined in
@themewith--breakpoint-*namespace - Stack breakpoints for ranges:
md:max-lg:hidden(hide between md and lg) - Use
max-*variants for max-width queries:max-md:hidden
For implementation examples, see examples/core.md.
Pattern 3: Dark Mode
Tailwind v4 supports three dark mode strategies: media query (default), class-based toggle, and data-attribute toggle. Override the dark variant with @custom-variant.
Strategies
- Media query (default): Uses
prefers-color-scheme: dark-- zero config - Class-based: Add
.darkclass to<html>-- use@custom-variant dark - Data-attribute: Use
data-theme="dark"-- use@custom-variant dark
Key Concepts
- Default dark mode works with system preference, no config needed
- For manual toggle, override the
darkvariant with@custom-variant - Use
(&:where(.dark, .dark *))selector for class strategy - Theme variables in
@themecan reference CSS variables set by theme class
For implementation examples, see examples/core.md.
Pattern 4: State Variants
Tailwind v4 provides comprehensive state variants for interactive styling. The not-* variant is new in v4.
Available Variants
- Pseudo-classes:
hover:,focus:,active:,visited:,first:,last:,odd:,even:,disabled:,required:,invalid: - Group/Peer:
group-hover:,group-focus:,peer-checked:,peer-invalid: - Data attributes:
data-[state=active]:,data-current: - New in v4.0:
not-hover:,not-focus:,inert:,starting:(for@starting-style) - New in v4.1:
pointer-fine:,pointer-coarse:,user-valid:,user-invalid:,noscript:,details-content:,inverted-colors: - Container queries:
@sm:,@md:,@lg:,@max-sm:
Key v4 Changes
hover:only applies on devices with hover capability (no more mobile ghost hovers)not-*variant styles when condition is NOT met- Variant stacking is left-to-right (CSS order):
dark:hover:bg-gray-700
For implementation examples, see examples/core.md.
Pattern 5: Theme Customization with @theme
The @theme directive defines design tokens that generate both utility classes and CSS variables. Each namespace maps to specific utility types.
Namespaces
| Namespace | Generates | Example |
|---|---|---|
--color-* |
Color utilities | bg-brand-500, text-brand-500 |
--font-* |
Font family | font-display |
--font-weight-* |
Font weight | font-bold |
--text-* |
Font size | text-display |
--tracking-* |
Letter spacing | tracking-wide |
--leading-* |
Line height | leading-tight |
--spacing-* |
Spacing and sizing | px-compact, max-h-16 |
--breakpoint-* |
Responsive variants | 3xl:flex |
--container-* |
Container query variants | @sm:*, max-w-md |
--radius-* |
Border radius | rounded-card |
--shadow-* |
Box shadows | shadow-card |
--inset-shadow-* |
Inset box shadows | inset-shadow-xs |
--drop-shadow-* |
Drop shadow filters | drop-shadow-md |
--ease-* |
Timing functions | ease-fluid |
--animate-* |
Animations | animate-fade-in |
--blur-* |
Blur filters | blur-card |
--perspective-* |
3D perspective | perspective-card |
--aspect-* |
Aspect ratios | aspect-cinema |
Key Concepts
--color-*: initialresets all default colors before defining custom ones--*: initialresets the entire default theme@theme inlineprevents CSS variable resolution issues when referencing other variables@theme staticgenerates CSS variables even when utilities are unused@keyframescan be defined inside@themefor animation tokens
For implementation examples, see examples/core.md.
Pattern 6: Custom Utilities with @utility
The @utility directive replaces v3's @layer utilities {}. Supports static utilities, functional utilities with --value(), and modifiers with --modifier().
Types of Custom Utilities
- Static: Fixed CSS declarations (
@utility content-auto { content-visibility: auto; }) - Functional: Accept values via
--value()(@utility tab-* { tab-size: --value(integer); }) - With modifiers: Optional modifiers via
--modifier()for secondary values
Value Resolution
--value(--namespace-*)matches theme variables--value(integer)matches bare integer values--value([length])matches arbitrary values in brackets- Multiple
--value()declarations cascade (last match wins)
For implementation examples, see examples/advanced.md.
Pattern 7: Custom Variants with @custom-variant
The @custom-variant directive replaces v3's addVariant() plugin API. Define conditional styling rules in CSS. The @variant directive applies existing variants inline within CSS rules.
Syntax Forms
- @custom-variant shorthand:
@custom-variant name (selector); - @custom-variant block:
@custom-variant name { /* rules with @slot */ } - @variant (inline):
@variant dark { /* styles */ }-- apply a variant inside custom CSS
For implementation examples, see examples/advanced.md.
Pattern 8: Container Queries
Container queries are built into v4 core (no plugin needed). Style elements based on container size, not viewport.
Key Concepts
@containermakes an element a query container@sm:,@md:,@lg:apply at container breakpoints (not viewport)@max-sm:,@max-md:for max-width container queries@min-md:@max-xl:for range queries- Named containers with
@container/nameand@sm/name:
For implementation examples, see examples/advanced.md.
Pattern 9: 3D Transforms and Modern CSS
Tailwind v4 adds first-class 3D transform utilities and leverages modern CSS features.
3D Transform Utilities
rotate-x-*,rotate-y-*,rotate-z-*for 3D rotationtranslate-z-*for depth translationscale-z-*for depth scalingperspective-*andperspective-origin-*for 3D perspectivetransform-3dto enable 3D transform contextbackface-hidden/backface-visiblefor card-flip effects
Other Modern Features
@starting-styleviastarting:variant for enter/exit animationsfield-sizing-contentfor auto-resizing textareascolor-scheme-darkfor native dark mode scrollbarsinset-shadow-*andinset-ring-*for layered box shadowstext-shadow-*for text shadows with color/opacity support (v4.1)mask-*for gradient and image masking (v4.1)wrap-break-word/wrap-anywherefor overflow-wrap control (v4.1)--alpha()function for adjusting color opacity in custom CSS
For implementation examples, see examples/advanced.md.
Pattern 10: Component Class Composition with cn()
Use cn() (clsx + tailwind-merge) to handle class composition and conflict resolution. Compose utility classes programmatically when components need variants or overridable styles.
Key Concepts
cn()combinesclsx(conditional classes) withtwMerge(conflict resolution)- External
classNameshould always be last incn()to allow consumer overrides - Use variant objects for multi-variant components,
cn()for simple composition - Prefer
cn()over@applyfor component extraction (keeps utilities visible in code)
For implementation examples, see examples/advanced.md.
</patterns>
<decision_framework>
Decision Framework
When to Use Which Styling Approach
Need component variants (size, intent, state)?
|-- YES --> Variant objects + cn() + Tailwind classes
|-- NO --> Just utility classes in markup
Need custom utility not in Tailwind?
|-- YES --> Is it a single fixed style?
| |-- YES --> @utility name { declarations }
| |-- NO --> @utility name-* { --value() }
|-- NO --> Use built-in utilities
Need conditional styling based on parent/sibling state?
|-- YES --> Is parent state?
| |-- YES --> group/group-* pattern
| |-- NO --> peer/peer-* pattern
|-- NO --> Direct state variants (hover:, focus:)
Need responsive behavior based on...?
|-- Viewport size --> sm:/md:/lg: breakpoint variants
|-- Container size --> @container + @sm:/@md: variants
|-- Neither --> Static styling
Dark Mode Strategy
Is dark mode automatic (system preference only)?
|-- YES --> No config needed (default prefers-color-scheme)
|-- NO --> Need manual toggle?
|-- YES --> Using class on <html>?
| |-- YES --> @custom-variant dark (&:where(.dark, .dark *))
| |-- NO --> @custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *))
|-- NO --> Default media query
Theme Customization Scope
Need to add a few custom tokens?
|-- YES --> Add to @theme alongside defaults
Need to replace an entire namespace?
|-- YES --> --namespace-*: initial; then define custom tokens
Need fully custom theme (no defaults)?
|-- YES --> --*: initial; then define everything
Need to share theme across projects?
|-- YES --> Create shared theme.css, import with @import
v3 to v4 Migration Decision
Is the project actively maintained?
|-- YES --> Does it use tailwind.config.js plugins?
| |-- YES --> Can plugins be replaced with @utility/@custom-variant?
| | |-- YES --> Migrate to v4
| | |-- NO --> Keep v3 or use @config/@plugin compatibility
| |-- NO --> Migrate to v4 (run npx @tailwindcss/upgrade)
|-- NO --> Stay on v3.4 (stable, still supported)
</decision_framework>
<integration>
Integration Notes
Bundler Setup:
- Use
@tailwindcss/vitefor Vite-based projects (fastest) - Use
@tailwindcss/webpackfor Webpack projects (v4.2+) - Use
@tailwindcss/postcssfor other bundlers - Use
@tailwindcss/clifor standalone builds autoprefixerandpostcss-importare NOT needed with v4
Component Integration:
- Use
cn()for class composition and conflict resolution - Forward
classNameprop for consumer overrides - Use
tailwind-mergeto resolve conflicting utility classes
What Tailwind Does NOT Replace:
- Complex CSS animations /
@keyframes(use@themefor tokens, custom CSS for complex sequences) - CSS variables for runtime values (use
bg-(--my-var)arbitrary syntax)
</integration>
<red_flags>
RED FLAGS
High Priority Issues:
- Using
tailwind.config.jswithout@configdirective (v4 does NOT auto-detect JS config) - Using
@tailwind base; @tailwind components; @tailwind utilities;(v3 syntax, use@import "tailwindcss") - Using
@layer utilities {}for custom utilities (use@utilitydirective) - Using
tailwindcssdirectly as PostCSS plugin (use@tailwindcss/postcss) - Using
!fleximportant syntax (v4 usesflex!-- trailing not leading) - Using
bg-[--my-var]for CSS variables (v4 usesbg-(--my-var)with parentheses) - Using hex/rgb colors in
@theme(use oklch for P3 gamut support) - Assuming
borderdefaults togray-200(v4 defaults tocurrentColor) - Assuming
ringdefaults to3px(v4 defaults to1px)
Medium Priority Issues:
- Using
@applyfor component extraction (usecn()with tailwind-merge instead -- keeps utilities visible) - Not specifying
@sourcefor node_modules UI libraries (automatic detection skips node_modules) - Using Sass/Less/Stylus with Tailwind v4 (not supported -- v4 is a standalone preprocessor)
- Using
autoprefixerorpostcss-import(not needed with v4) - Using
transform-noneto reset transforms (v4 uses individual properties, usescale-none/rotate-0)
Common Mistakes:
- Forgetting
@custom-variant darkwhen using class-based dark mode toggle - Using
content: ['./src/**/*.tsx'](v4 auto-detects, nocontentarray) - Mixing v3 and v4 syntax in the same project
- Not running
npx @tailwindcss/upgradefor automated migration
Gotchas and Edge Cases:
- Variant stacking order changed: v3 was right-to-left, v4 is left-to-right (follows CSS cascade)
hover:only triggers on devices with hover capability (no phantom hover on touch devices)space-y-*/divide-*changed selectors: v3 used:not([hidden]) ~ :not([hidden]), v4 uses:not(:last-child)-- prefergap-*with flex/grid- Grid template values use underscores for spaces:
grid-cols-[max-content_auto](not commas) shadow-smin v3 =shadow-xsin v4,shadowin v3 =shadow-smin v4 (whole scale shifted)rounded-smin v3 =rounded-xsin v4,roundedin v3 =rounded-smin v4outline-nonein v3 =outline-hiddenin v4 (accessibility improvement)ringin v3 (3px) =ring-3in v4 (default is now 1px)- Browser requirements: Safari 16.4+, Chrome 111+, Firefox 128+ (no IE11, no older browsers)
</red_flags>
<critical_reminders>
CRITICAL REMINDERS
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST use @import "tailwindcss" and @theme for configuration - NEVER use tailwind.config.js, @tailwind base, or module.exports)
(You MUST use @utility for custom utilities - NEVER use @layer utilities {} (v3 syntax))
(You MUST use oklch or CSS variable references for custom colors in @theme - NEVER use hex/rgb for theme tokens)
(You MUST use @tailwindcss/vite for Vite, @tailwindcss/webpack for Webpack, @tailwindcss/postcss for others - NEVER use tailwindcss directly as PostCSS plugin)
(You MUST specify border colors explicitly - v4 defaults to currentColor not gray-200)
Failure to follow these rules will produce v3 code that does not work with Tailwind CSS v4.
</critical_reminders>