/tailwind-4:configuring-tailwind-v4from tailwind-4
Configure Tailwind CSS v4 using Vite plugin, PostCSS, or CLI with CSS-first configuration via @import and @theme directives. Use when setting up new projects or migrating build tools.
Ships in tailwind-4. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Configure Tailwind CSS v4 using modern CSS-first configuration. Tailwind v4 eliminates JavaScript configuration files in favor of CSS-based setup using @import and @theme directives.
Step 1: Install Dependencies
npm install tailwindcss @tailwindcss/vite
Step 2: Configure Vite Plugin
Add the Tailwind plugin to vite.config.js:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [react(), tailwindcss()],
});
Step 3: Import Tailwind in CSS
Create or update your main CSS file (e.g., src/index.css):
@import 'tailwindcss';
Step 1: Install Dependencies
npm install tailwindcss @tailwindcss/postcss
Step 2: Configure PostCSS
Create postcss.config.js:
export default {
plugins: {
'@tailwindcss/postcss': {},
},
};
Step 3: Import Tailwind in CSS
@import 'tailwindcss';
Step 1: Install CLI
npm install tailwindcss @tailwindcss/cli
Step 2: Create Input CSS
@import 'tailwindcss';
Step 3: Run Build Command
npx @tailwindcss/cli -i input.css -o output.css --watch
Tailwind v4 uses the @theme directive for all customization:
@import 'tailwindcss';
@theme {
--font-display: 'Satoshi', 'sans-serif';
--font-body: 'Inter', 'sans-serif';
--color-brand-primary: oklch(0.65 0.25 270);
--color-brand-accent: oklch(0.75 0.22 320);
--breakpoint-3xl: 120rem;
--breakpoint-4xl: 160rem;
--spacing-18: 4.5rem;
--spacing-72: 18rem;
--radius-4xl: 2rem;
--shadow-brutal: 8px 8px 0 0 rgb(0 0 0);
}
Template files are discovered automatically using built-in heuristics. No content array configuration required. Files in .gitignore are automatically excluded.
Manual Source Control (when needed):
@import 'tailwindcss';
@source "../node_modules/@my-company/ui-lib";
@source "./legacy-components";
Exclude paths:
@source not "./legacy";
@source not "./docs";
Disable automatic detection:
@import 'tailwindcss' source(none);
@source "./src";
| v3 | v4 |
|---|---|
tailwind.config.js | CSS @theme directive |
@tailwind base; | @import 'tailwindcss'; |
content: [] array | Automatic detection |
postcss-tailwindcss | @tailwindcss/postcss |
Tailwind v4 requires:
Projects requiring older browser support must stay on v3.4.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub djankies/claude-configs --plugin tailwind-47 skills in this plugin
/creating-custom-utilitiesCreate custom utilities with @utility directive supporting static utilities, functional utilities with values, theme-based utilities, and multi-value utilities. Use when extending Tailwind with custom CSS properties or patterns./handling-animationsDefine animations with @keyframes within @theme directive, use animate-{name} utilities, and implement entry animations with starting: variant. Use when creating custom animations or entry effects./migrating-from-v3Migrate from Tailwind CSS v3 to v4 including configuration migration (JS to CSS), utility renames, opacity changes, and color system updates. Use when upgrading existing projects to v4.Other plugins' skills for the same job