tailwind-v4-configuration

Configure Tailwind CSS v4 with CSS-first approach. Use when installing, migrating from v3, setting up build tools (Vite/PostCSS/CLI), customizing themes with @theme, or configuring plugins.

210 stars

Best use case

tailwind-v4-configuration is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Configure Tailwind CSS v4 with CSS-first approach. Use when installing, migrating from v3, setting up build tools (Vite/PostCSS/CLI), customizing themes with @theme, or configuring plugins.

Teams using tailwind-v4-configuration should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/tailwind-v4-configuration/SKILL.md --create-dirs "https://raw.githubusercontent.com/flpbalada/my-opencode-config/main/skills/tailwind-v4-configuration/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/tailwind-v4-configuration/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How tailwind-v4-configuration Compares

Feature / Agenttailwind-v4-configurationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Configure Tailwind CSS v4 with CSS-first approach. Use when installing, migrating from v3, setting up build tools (Vite/PostCSS/CLI), customizing themes with @theme, or configuring plugins.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Tailwind CSS v4 Configuration

A complete guide to configuring Tailwind CSS v4 with its new CSS-first approach, unified toolchain, and modern feature set.

## When to Use This Skill

- **Installing Tailwind v4** for the first time in a new project
- **Migrating from Tailwind v3** to v4 (breaking changes and setup differences)
- **Setting up build tools**: Vite, PostCSS, or standalone CLI
- **Customizing themes** using the `@theme` directive
- **Configuring content paths** and template detection
- **Adding plugins** or creating custom utilities
- **Configuring dark mode**, prefixes, or other global options
- **Troubleshooting** v4 configuration issues

## Key v4 Changes Overview

| Aspect             | v3                                | v4                                              |
| ------------------ | --------------------------------- | ----------------------------------------------- |
| **Configuration**  | `tailwind.config.js` (JavaScript) | `@theme` block in CSS                           |
| **Import**         | Three `@tailwind` directives      | Single `@import "tailwindcss"`                  |
| **Content paths**  | Explicit `content` array          | Automatic detection (respects `.gitignore`)     |
| **Build pipeline** | Requires PostCSS + plugins        | Integrated Lightning CSS (all-in-one)           |
| **Performance**    | Fast                              | 10x faster (Oxide engine)                       |
| **Colors**         | hex, rgb, hsl                     | Native `oklch()` + modern color spaces          |
| **Variants**       | `outline-none` removed outline    | `outline-hidden` + proper `outline-none`        |
| **Shadows**        | `shadow-sm` (smallest)            | `shadow-xs` (smallest), `shadow-md` (default)   |
| **Border radius**  | `rounded-sm` (smallest)           | `rounded-xs` (smallest), `rounded-md` (default) |

## Core Concepts

### CSS-First Configuration

All configuration now lives in your CSS file using the `@theme` directive:

```css
@import "tailwindcss";

@theme {
  --color-brand-primary: oklch(0.65 0.24 354.31);
  --font-display: "Satoshi", "sans-serif";
  --breakpoint-3xl: 1920px;
}
```

### Automatic Content Detection

v4 automatically discovers templates - no configuration needed for most projects.

### Key Utility Changes

- `shadow-sm` (v3) → `shadow-xs` (v4)
- `rounded-sm` (v3) → `rounded-xs` (v4)
- `bg-gradient-to-r` (v3) → `bg-linear-to-r` (v4)

## Progressive Disclosure

This skill provides detailed examples through context files. Load them when needed:

| Context File                                    | When to Load                                      |
| ----------------------------------------------- | -------------------------------------------------- |
| `context/setup-examples.md`                     | Setting up installation, CSS config, custom utils  |
| `context/migration-guide.md`                    | Migrating from v3 to v4                            |
| `context/framework-examples.md`                 | Setting up Next.js, React, Vue, SvelteKit          |
| `context/advanced-config.md`                    | Multi-stylesheets, theming, animations            |

## Best Practices

### ✅ DO

- Use `@import "tailwindcss"` with a single import
- Define theme tokens in `@theme` block
- Leverage automatic content detection
- Use CSS variables with `@theme` for dynamic theming
- Use `@utility` for custom utilities (not `@apply` for components)
- Use `@custom-variant` for reusable variant logic
- Test the automated upgrade tool before manual migration

### ❌ DON'T

- Create a `tailwind.config.js` file (use CSS `@theme` instead)
- Use `@tailwind base/components/utilities` separately
- Configure `content` paths unless you have a specific need
- Forget to update breaking utility changes (shadow, blur, radius)
- Use opacity utilities like `bg-opacity-50` (use `/50` instead)
- Ignore browser compatibility (v4 targets modern browsers)
- Try to load legacy `autoprefixer` or `postcss-import`

## Browser Compatibility

Tailwind CSS v4 targets modern browsers:

- **Chrome/Edge:** 111+
- **Firefox:** 128+
- **Safari:** 16.4+

## Quick Decision Guide

```
Need to install Tailwind v4?
├─ New project? → Use Vite plugin (recommended)
├─ Existing project? → Use PostCSS plugin
└─ Static site? → Use CLI

Migrating from v3?
└─ Run: npx @tailwindcss/upgrade

Need custom utilities?
└─ Use @utility directive in CSS

Need framework setup?
└─ See context/framework-examples.md
```

## References

- [Tailwind CSS v4 Documentation](https://tailwindcss.com/docs)
- [Tailwind CSS v4 Upgrade Guide](https://tailwindcss.com/docs/upgrade-guide)
- [Automatic Upgrade Tool](https://github.com/tailwindlabs/upgrade)

Related Skills

code-architecture-tailwind-v4-best-practices

204
from flpbalada/my-opencode-config

Guides Tailwind CSS v4 patterns for buttons and components. Use this skill when creating components with variants, choosing between CVA/tailwind-variants, or configuring Tailwind v4's CSS-first approach.

what-not-to-do-as-product-manager

210
from flpbalada/my-opencode-config

Anti-patterns and mistakes to avoid as a product manager. Use when evaluating leadership behaviors, improving team dynamics, reflecting on management practices, or onboarding new product managers.

visual-cues-cta-psychology

210
from flpbalada/my-opencode-config

Design effective CTAs using visual attention and gaze psychology principles. Use when designing landing pages, button hierarchies, conversion elements, or optimizing user attention flow through interfaces.

vercel-sandbox

210
from flpbalada/my-opencode-config

Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include "Vercel Sandbox browser", "microVM Chrome", "agent-browser in sandbox", "browser automation on Vercel", or any task requiring Chrome in a Vercel Sandbox.

value-realization

210
from flpbalada/my-opencode-config

Analyze if end users discover clear value. Use when evaluating product concepts, analyzing adoption, or uncertain about direction.

user-story-fundamentals

210
from flpbalada/my-opencode-config

Capture requirements from user perspective with structured user stories. Use when writing backlog items, defining acceptance criteria, prioritizing features, or communicating requirements between product and development.

typescript-satisfies-operator

210
from flpbalada/my-opencode-config

Guides proper usage of TypeScript's satisfies operator vs type annotations. Use this skill when deciding between type annotations (colon) and satisfies, validating object shapes while preserving literal types, or troubleshooting type inference issues.

typescript-interface-vs-type

210
from flpbalada/my-opencode-config

Guides when to use interface vs type in TypeScript. Use this skill when defining object types, extending types, or choosing between interface and type aliases.

typescript-best-practices

210
from flpbalada/my-opencode-config

Guides TypeScript best practices for type safety, code organization, and maintainability. Use this skill when configuring TypeScript projects, deciding on typing strategies, writing async code, or reviewing TypeScript code quality.

typescript-advanced-types

210
from flpbalada/my-opencode-config

Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.

trust-psychology

210
from flpbalada/my-opencode-config

Build trust signals that reduce perceived risk and enable user action. Use when designing landing pages, checkout flows, onboarding experiences, or any conversion point where user hesitation is a barrier.

theme-epic-story

210
from flpbalada/my-opencode-config

Structure product work hierarchically using themes, epics, and stories. Use when organizing backlogs, planning releases, communicating with stakeholders, or breaking down large initiatives into manageable work.