원클릭으로
tailwind-v4
Tailwind CSS v4 best practices. CSS-first configuration with @theme, new utilities, migration from v3, and modern patterns.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Tailwind CSS v4 best practices. CSS-first configuration with @theme, new utilities, migration from v3, and modern patterns.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Keeps a wiki for your code that updates itself — reads your git history and docs so you can ask questions about your codebase. Use when the user asks about codebase documentation, architectural decisions, commit history, changelog generation, or maintaining a wiki for their project.
Open-source memory infrastructure for pi agents. Provides peer representations, reasoning, context assembly, dreaming, and hybrid memory (global + project-scoped) capabilities. Use when tracking user preferences, maintaining context across sessions, building peer mental models, or enabling persistent agent memory.
Generic git↔GitHub sync tools. Push/pull subdirectories (subtree) or standalone repos, manage issues/PRs, and work with git worktrees. Works for any org, any directory structure.
Chat UI building blocks for React/Next.js from ui.inference.sh. Components: container, messages, input, typing indicators, avatars. Capabilities: chat interfaces, message lists, input handling, streaming. Use for: building custom chat UIs, messaging interfaces, AI assistants. Triggers: chat ui, chat component, message list, chat input, shadcn chat, react chat, chat interface, messaging ui, conversation ui, chat building blocks
0xKobold's core programming philosophy. Use when writing code, reviewing PRs, or making architectural decisions. Covers DRY, KISS, functional programming, and NASA's 10 coding rules for safety-critical code.
Curated registry of high-quality agent skills and tools. Use for discovering and installing capabilities for AI agents.
| name | tailwind-v4 |
| description | Tailwind CSS v4 best practices. CSS-first configuration with @theme, new utilities, migration from v3, and modern patterns. |
| risk | safe |
| source | research |
| date_added | 2026-03-16 |
A completely rewritten Tailwind with CSS-first configuration, 5x faster builds, and modern CSS features.
npm install tailwindcss @tailwindcss/vite
// vite.config.ts
import { defineConfig } from "vite";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
plugins: [tailwindcss()],
});
npm install tailwindcss @tailwindcss/postcss
// postcss.config.js
export default {
plugins: {
"@tailwindcss/postcss": {},
},
};
/* styles.css - That's it! */
@import "tailwindcss";
No more:
tailwind.config.js (optional now)postcss-import pluginautoprefixer plugin@tailwind base/components/utilities directivesDefine design tokens directly in CSS:
@import "tailwindcss";
@theme {
/* Colors */
--color-brand-50: oklch(0.98 0.01 250);
--color-brand-100: oklch(0.95 0.03 250);
--color-brand-500: oklch(0.65 0.15 250);
--color-brand-900: oklch(0.30 0.08 250);
/* Typography */
--font-display: "Cal Sans", sans-serif;
--font-body: "Inter", system-ui, sans-serif;
/* Spacing (derived from single --spacing value) */
--spacing: 0.25rem; /* px-4 = 1rem */
/* Breakpoints */
--breakpoint-xs: 375px;
--breakpoint-3xl: 1920px;
/* Animations */
--animate-fade-in: fade-in 0.5s ease-out;
--animate-slide-up: slide-up 0.3s ease-out;
/* Shadows */
--shadow-glow: 0 0 20px var(--color-brand-500);
}
| @theme | :root |
|---|---|
| Generates utility classes | Just CSS variables |
| Tailwind-specific | Generic CSS |
| Required for utilities | For custom properties only |
| Must be top-level | Can be nested |
Use @theme for design tokens that should have utility classes.
Use :root for CSS-only variables.
All theme variables follow namespace conventions:
| Namespace | Creates |
|---|---|
--color-* | bg-*, text-*, border-*, etc. |
--font-* | font-* utilities |
--text-* | text-* size utilities |
--font-weight-* | font-* weight utilities |
--breakpoint-* | responsive *: variants |
--container-* | @* container variants |
--spacing-* | p-*, m-*, w-*, h-*, gap-* |
--radius-* | rounded-* utilities |
--shadow-* | shadow-* utilities |
--animate-* | animate-* utilities |
--ease-* | ease-* timing functions |
No more arbitrary value syntax for simple values:
<!-- v3: Required arbitrary values -->
<div class="grid-cols-[15]">
<div class="w-[137px]">
<!-- v4: Just use the number -->
<div class="grid-cols-15">
<div class="w-[137px]"> <!-- Still works for complex values -->
No plugin needed:
<div class="@container">
<div class="@sm:grid-cols-2 @lg:grid-cols-4 @max-md:flex-col">
...
</div>
</div>
<div class="perspective-distant">
<div class="rotate-x-45 rotate-y-12 transform-3d">
3D content
</div>
</div>
<!-- Angles -->
<div class="bg-linear-45 from-blue-500 to-purple-600">
<!-- Interpolation modes -->
<div class="bg-linear-to-r/oklch from-blue-500 to-green-500">
<div class="bg-linear-to-r/srgb from-blue-500 to-green-500">
<!-- Radial and conic gradients -->
<div class="bg-radial from-blue-500 to-transparent">
<div class="bg-conic from-blue-500 via-purple-500 to-red-500">
Entry transitions without JavaScript:
@starting-style {
.modal {
opacity: 0;
transform: translateY(-20px);
}
}
.modal {
opacity: 1;
transform: translateY(0);
transition: all 0.3s ease-out;
}
<div class="opacity-0 translate-y-[-20px] transition-all starting:opacity-0 starting:translate-y-[-20px]">
Style elements that don't match a condition:
<div class="not-hover:bg-gray-100">
<div class="not-data-active:opacity-50">
Colors now use oklch for wider gamut:
--color-red-500: oklch(0.635 0.242 25.623);
--color-blue-500: oklch(0.651 0.274 264.054);
--color-green-500: oklch(0.723 0.191 142.5);
npx @tailwindcss/upgrade
Handles:
| v3 | v4 |
|---|---|
@tailwind base; | @import "tailwindcss"; |
tailwind.config.js | @theme { ... } |
tailwindcss package | @tailwindcss/vite or @tailwindcss/postcss |
postcss-import | Built-in |
autoprefixer | Built-in |
| v3 | v4 |
|---|---|
shadow-sm | shadow-xs |
shadow | shadow-sm |
rounded-sm | rounded-xs |
rounded | rounded-sm |
blur-sm | blur-xs |
blur | blur-sm |
outline-none | outline-hidden |
ring | ring-1 (was ring-3) |
bg-opacity-* | bg-*/opacity (e.g., bg-red-500/50) |
| Removed | Use Instead |
|---|---|
bg-opacity-* | bg-red-500/50 |
text-opacity-* | text-red-500/50 |
border-opacity-* | border-red-500/50 |
flex-grow-* | grow-* |
flex-shrink-* | shrink-* |
overflow-ellipsis | text-ellipsis |
No more content: [...] config:
// v3 tailwind.config.js
module.exports = {
content: ['./src/**/*.{js,ts,jsx,tsx}', './public/index.html'],
}
/* v4 - Automatic detection! */
@import "tailwindcss";
/* Scans your project automatically */
To add sources explicitly:
@import "tailwindcss";
@source "../node_modules/@my-company/ui-lib";
@source "../packages/shared";
@import "tailwindcss";
/* Design tokens first */
@theme {
/* Brand colors */
--color-brand-*: ...;
/* Extended colors */
--color-accent-*: ...;
/* Typography scale */
--font-*: ...;
--text-*: ...;
/* Custom utilities */
--animate-*: ...;
}
/* Global styles after */
:root {
--other-custom-property: value;
}
body {
@apply bg-white text-gray-900;
}
@theme {
--color-primary: var(--brand-color);
}
<!-- Override via JS or CSS -->
<div style="--brand-color: oklch(0.6 0.2 250)">
@layer components {
.btn {
@apply px-4 py-2 rounded-lg font-medium transition-colors;
}
}
@layer utilities {
.text-gradient {
@apply bg-clip-text text-transparent bg-linear-to-r;
}
}
| Metric | v3.4 | v4.0 | Improvement |
|---|---|---|---|
| Full build | 378ms | 100ms | 3.78x |
| Incremental (new CSS) | 44ms | 5ms | 8.8x |
| Incremental (no new CSS) | 35ms | 192µs | 182x |
| Method | Speed |
|---|---|
@tailwindcss/vite | Fastest (recommended) |
@tailwindcss/postcss | Fast |
v4 uses native @layer cascade:
@layer theme, base, components, utilities;
For custom utilities, use @layer utilities:
@layer utilities {
.content-visibility-auto {
content-visibility: auto;
}
}
@theme {
--color-bg: oklch(1 0 0);
--color-text: oklch(0.2 0 0);
}
@media (prefers-color-scheme: dark) {
@theme {
--color-bg: oklch(0.15 0 0);
--color-text: oklch(0.9 0 0);
}
}
@theme {
--color-primary: var(--user-primary, blue);
}
<div style="--user-primary: purple">
Uses purple theme
</div>
@theme {
/* Extends existing colors */
--color-brand-500: ...;
/* Overrides default (same name) */
--color-blue-500: oklch(0.65 0.2 250);
}
| Error | Cause | Fix |
|---|---|---|
Unknown word "use strict" | v4 syntax with v3 setup | Use @tailwindcss/vite plugin |
| Missing utilities | Wrong @theme namespace | Use proper namespace (--color-*) |
| Build slow on changes | Using PostCSS, not Vite | Switch to @tailwindcss/vite |
@import "tailwindcss" debug;
Use this skill when: