File contents Community Tailwind CSS v4 Best Practices
Comprehensive performance optimization guide for Tailwind CSS v4 applications. Contains 44 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
Configuring Tailwind CSS v4 build tooling (Vite plugin, PostCSS, CLI)
Writing or migrating styles using 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 - Use Vite Plugin Over PostCSS
build-css-import - Use CSS Import Over @tailwind Directives
build-content-detection - Leverage Automatic Content Detection
build-node-version - Use Node.js 20+ for Optimal Performance
build-postcss-simplify - Remove Redundant PostCSS Plugins
build-cli-package - Use Correct CLI Package
2. CSS Generation (CRITICAL)
gen-css-first-config - Use CSS-First Configuration Over JavaScript
gen-avoid-theme-bloat - Avoid Excessive Theme Variables
gen-oklch-colors - Use OKLCH Color Space for Vivid Colors
gen-utility-directive - Use @utility for Custom Utilities
gen-dynamic-utilities - Use Dynamic Utility Values
gen-css-variable-syntax - Use Parentheses for CSS Variable References
3. Bundle Optimization (HIGH)
bundle-remove-unused-plugins - Remove Built-in Plugins
bundle-avoid-preprocessors - Avoid Sass/Less Preprocessors
bundle-css-minification - Enable CSS Minification in Production
bundle-avoid-cdn-production - Avoid Play CDN in Production
bundle-split-critical-css - Extract Critical CSS for Initial Render
4. Utility Patterns (HIGH)
util-renamed-utilities - Use Renamed Utility Classes
util-important-modifier - Use Trailing Important Modifier
util-variant-stacking - Use Left-to-Right Variant Stacking
util-explicit-colors - Use Explicit Border and Ring Colors
util-opacity-modifier - Use Slash Opacity Modifier
util-gradient-via-none - Use via-none to Reset Gradient Stops
5. Component Architecture (MEDIUM-HIGH)
comp-avoid-apply-overuse - Avoid Overusing @apply
comp-reference-directive - Use @reference for CSS Module Integration
comp-utility-file-scope - Understand Utility File Scope
comp-smart-sorting - Leverage Smart Utility Sorting
comp-container-customize - Customize Container with @utility
comp-custom-variant - Use @custom-variant for Custom Variant Definitions
6. Theming & Design Tokens (MEDIUM)
theme-semantic-tokens - Use Semantic Design Token Names
theme-dark-mode-class - Use Class-Based Dark Mode for Control
theme-prefix-variables - Use Prefix for Variable Namespacing
theme-runtime-variables - Leverage Runtime CSS Variables
theme-color-scheme - Set color-scheme for Native Dark Mode
theme-inline-static - Use @theme inline and @theme static for Variable Control
7. Responsive & Adaptive (MEDIUM)
resp-mobile-first - Use Mobile-First Responsive Design
resp-container-queries - Use Container Queries for Component-Level Responsiveness
resp-custom-breakpoints - Define Custom Breakpoints in @theme
resp-hover-capability - Pair Hover with Active for Touch-Friendly Interactions
resp-logical-properties - Use Logical Properties for RTL Support
8. Animation & Transitions (LOW-MEDIUM)
anim-gpu-accelerated - Use GPU-Accelerated Transform Properties
anim-starting-style - Use @starting-style for Entry Animations
anim-gradient-interpolation - Use OKLCH Gradient Interpolation
anim-3d-transforms - Use Built-in 3D Transform Utilities
How to Use
Read individual reference files for detailed explanations and code examples:
Section definitions - Category structure and impact levels
Rule template - Template for adding new rules
Full Compiled Document
For a complete guide with all rules expanded, see AGENTS.md.
Reference Files
File
Description
AGENTS.md
Complete compiled guide with all rules
references/_sections.md
Category definitions and ordering
assets/templates/_template.md
Template for new rules
metadata.json
Version and reference information
1 --- 2 name: tailwind 3 description: Community Tailwind CSS v4 Best Practices 4 --- 5 # Community Tailwind CSS v4 Best Practices 6 7 Comprehensive performance optimization guide for Tailwind CSS v4 applications. Contains 44 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation. 8 9 ## When to Apply 10 11 Reference these guidelines when: 12 - Configuring Tailwind CSS v4 build tooling (Vite plugin, PostCSS, CLI) 13 - Writing or migrating styles using v4's CSS-first approach 14 - Optimizing CSS bundle size and build performance 15 - Implementing responsive designs with breakpoints or container queries 16 - Setting up theming with @theme directive and design tokens 17 18 ## Rule Categories by Priority 19 20 | Priority | Category | Impact | Prefix | 21 |----------|----------|--------|--------| 22 | 1 | Build Configuration | CRITICAL | `build-` | 23 | 2 | CSS Generation | CRITICAL | `gen-` | 24 | 3 | Bundle Optimization | HIGH | `bundle-` | 25 | 4 | Utility Patterns | HIGH | `util-` | 26 | 5 | Component Architecture | MEDIUM-HIGH | `comp-` | 27 | 6 | Theming & Design Tokens | MEDIUM | `theme-` | 28 | 7 | Responsive & Adaptive | MEDIUM | `resp-` | 29 | 8 | Animation & Transitions | LOW-MEDIUM | `anim-` | 30 31 ## Quick Reference 32 33 ### 1. Build Configuration (CRITICAL) 34 35 - [`build-vite-plugin`](references/build-vite-plugin.md) - Use Vite Plugin Over PostCSS 36 - [`build-css-import`](references/build-css-import.md) - Use CSS Import Over @tailwind Directives 37 - [`build-content-detection`](references/build-content-detection.md) - Leverage Automatic Content Detection 38 - [`build-node-version`](references/build-node-version.md) - Use Node.js 20+ for Optimal Performance 39 - [`build-postcss-simplify`](references/build-postcss-simplify.md) - Remove Redundant PostCSS Plugins 40 - [`build-cli-package`](references/build-cli-package.md) - Use Correct CLI Package 41 42 ### 2. CSS Generation (CRITICAL) 43 44 - [`gen-css-first-config`](references/gen-css-first-config.md) - Use CSS-First Configuration Over JavaScript 45 - [`gen-avoid-theme-bloat`](references/gen-avoid-theme-bloat.md) - Avoid Excessive Theme Variables 46 - [`gen-oklch-colors`](references/gen-oklch-colors.md) - Use OKLCH Color Space for Vivid Colors 47 - [`gen-utility-directive`](references/gen-utility-directive.md) - Use @utility for Custom Utilities 48 - [`gen-dynamic-utilities`](references/gen-dynamic-utilities.md) - Use Dynamic Utility Values 49 - [`gen-css-variable-syntax`](references/gen-css-variable-syntax.md) - Use Parentheses for CSS Variable References 50 51 ### 3. Bundle Optimization (HIGH) 52 53 - [`bundle-remove-unused-plugins`](references/bundle-remove-unused-plugins.md) - Remove Built-in Plugins 54 - [`bundle-avoid-preprocessors`](references/bundle-avoid-preprocessors.md) - Avoid Sass/Less Preprocessors 55 - [`bundle-css-minification`](references/bundle-css-minification.md) - Enable CSS Minification in Production 56 - [`bundle-avoid-cdn-production`](references/bundle-avoid-cdn-production.md) - Avoid Play CDN in Production 57 - [`bundle-split-critical-css`](references/bundle-split-critical-css.md) - Extract Critical CSS for Initial Render 58 59 ### 4. Utility Patterns (HIGH) 60 61 - [`util-renamed-utilities`](references/util-renamed-utilities.md) - Use Renamed Utility Classes 62 - [`util-important-modifier`](references/util-important-modifier.md) - Use Trailing Important Modifier 63 - [`util-variant-stacking`](references/util-variant-stacking.md) - Use Left-to-Right Variant Stacking 64 - [`util-explicit-colors`](references/util-explicit-colors.md) - Use Explicit Border and Ring Colors 65 - [`util-opacity-modifier`](references/util-opacity-modifier.md) - Use Slash Opacity Modifier 66 - [`util-gradient-via-none`](references/util-gradient-via-none.md) - Use via-none to Reset Gradient Stops 67 68 ### 5. Component Architecture (MEDIUM-HIGH) 69 70 - [`comp-avoid-apply-overuse`](references/comp-avoid-apply-overuse.md) - Avoid Overusing @apply 71 - [`comp-reference-directive`](references/comp-reference-directive.md) - Use @reference for CSS Module Integration 72 - [`comp-utility-file-scope`](references/comp-utility-file-scope.md) - Understand Utility File Scope 73 - [`comp-smart-sorting`](references/comp-smart-sorting.md) - Leverage Smart Utility Sorting 74 - [`comp-container-customize`](references/comp-container-customize.md) - Customize Container with @utility 75 - [`comp-custom-variant`](references/comp-custom-variant.md) - Use @custom-variant for Custom Variant Definitions 76 77 ### 6. Theming & Design Tokens (MEDIUM) 78 79 - [`theme-semantic-tokens`](references/theme-semantic-tokens.md) - Use Semantic Design Token Names 80 - [`theme-dark-mode-class`](references/theme-dark-mode-class.md) - Use Class-Based Dark Mode for Control 81 - [`theme-prefix-variables`](references/theme-prefix-variables.md) - Use Prefix for Variable Namespacing 82 - [`theme-runtime-variables`](references/theme-runtime-variables.md) - Leverage Runtime CSS Variables 83 - [`theme-color-scheme`](references/theme-color-scheme.md) - Set color-scheme for Native Dark Mode 84 - [`theme-inline-static`](references/theme-inline-static.md) - Use @theme inline and @theme static for Variable Control 85 86 ### 7. Responsive & Adaptive (MEDIUM) 87 88 - [`resp-mobile-first`](references/resp-mobile-first.md) - Use Mobile-First Responsive Design 89 - [`resp-container-queries`](references/resp-container-queries.md) - Use Container Queries for Component-Level Responsiveness 90 - [`resp-custom-breakpoints`](references/resp-custom-breakpoints.md) - Define Custom Breakpoints in @theme 91 - [`resp-hover-capability`](references/resp-hover-capability.md) - Pair Hover with Active for Touch-Friendly Interactions 92 - [`resp-logical-properties`](references/resp-logical-properties.md) - Use Logical Properties for RTL Support 93 94 ### 8. Animation & Transitions (LOW-MEDIUM) 95 96 - [`anim-gpu-accelerated`](references/anim-gpu-accelerated.md) - Use GPU-Accelerated Transform Properties 97 - [`anim-starting-style`](references/anim-starting-style.md) - Use @starting-style for Entry Animations 98 - [`anim-gradient-interpolation`](references/anim-gradient-interpolation.md) - Use OKLCH Gradient Interpolation 99 - [`anim-3d-transforms`](references/anim-3d-transforms.md) - Use Built-in 3D Transform Utilities 100 101 ## How to Use 102 103 Read individual reference files for detailed explanations and code examples: 104 105 - [Section definitions](references/_sections.md) - Category structure and impact levels 106 - [Rule template](assets/templates/_template.md) - Template for adding new rules 107 108 ## Full Compiled Document 109 110 For a complete guide with all rules expanded, see [AGENTS.md](AGENTS.md). 111 112 ## Reference Files 113 114 | File | Description | 115 |------|-------------| 116 | [AGENTS.md](AGENTS.md) | Complete compiled guide with all rules | 117 | [references/_sections.md](references/_sections.md) | Category definitions and ordering | 118 | [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules | 119 | [metadata.json](metadata.json) | Version and reference information |
ComeOnOliver/skillshub/tree/main/skills/pproenca/dot-skills/tailwind commit df3cb8c17a
Frequently asked questions How do I install the Tailwind skill? Run npx skillmds@latest add comeonoliver/tailwind in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Tailwind skill do? Community Tailwind CSS v4 Best Practices It is listed under Web & Frontend on SkillMD.
Is Tailwind safe to use? This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Tailwind? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Tailwind free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Tailwind? ComeOnOliver (@comeonoliver) published this skill. Their other Agent Skills are listed on their SkillMD profile.