tailwind-css
paulrberg/agent-skills
Expert Tailwind CSS v4 styling: CSS-first config, utilities, variants, and animations.
What is tailwind-css?
Provides guidance for Tailwind CSS v4 styling, including CSS-only configuration with @theme directives, type-safe component variants using tailwind-variants, and modern animation patterns. Use this when adding or fixing Tailwind classes, configuring design tokens, migrating to v4, or implementing component variants.
- CSS-first configuration using @theme, @utility, and @custom-variant directives instead of config files
- Type-safe component variants with tailwind-variants (tv) for reusable styled components
- ESLint integration via eslint-plugin-better-tailwindcss for class validation and style enforcement
- Animation utilities via tw-animate-css with enter/exit, slide, fade, and zoom effects
- CSS Modules support with @reference "#tailwind" for complex styles that need Tailwind integration
How to install tailwind-css
npx skills add https://github.com/paulrberg/agent-skills --skill tailwind-css- Tailwind CSS v4 installed in the project
- eslint-plugin-better-tailwindcss for linting (recommended)
- tailwind-variants package for component variants (recommended)
How to use tailwind-css
- 1.Check the project's @theme configuration in CSS files to see available design tokens
- 2.Use @theme { } directives in CSS files to define or extend design tokens like colors, spacing, and fonts
- 3.Apply Tailwind utility classes to elements, using theme tokens automatically (e.g., bg-brand from --color-brand)
- 4.For component variants, import tv from tailwind-variants and define variants with base styles and variant options
- 5.Run ESLint to validate classes and catch conflicts or unknown utilities
- 6.For animations, combine base classes (animate-in/animate-out) with effect classes (fade-in, slide-in-from-bottom-4)
Use cases
- Adding or fixing Tailwind utility classes in React/Vue components
- Migrating existing Tailwind projects from v3 to v4 CSS-first configuration
- Creating reusable component variants with type-safe props using tailwind-variants
- Implementing entrance and exit animations with tw-animate-css
- Debugging style conflicts and validating class names with ESLint rules
- Frontend developers using Tailwind CSS v4
- React/Vue component library maintainers
- Teams migrating from Tailwind v3 to v4
- Developers building type-safe, variant-based component systems
tailwind-css FAQ
Tailwind v4 uses CSS-only configuration. Add @import "tailwindcss" at the top of your CSS file, then define tokens with @theme { --color-name: value; }. These automatically become utilities like bg-name, text-name, etc.
@theme generates utility classes for all defined tokens (e.g., --color-brand becomes bg-brand). @theme static defines tokens that should not generate utilities, useful for internal values.
Use tailwind-variants: import { tv } from 'tailwind-variants', define a tv() function with base styles and variant options, then call it with props to get merged class names.
Check if the color exists in the project's @theme configuration first. Avoid arbitrary hex values like bg-[#4f46e5]; instead, define colors in @theme and use semantic names like bg-brand.
Use tw-animate-css patterns: combine a base class (animate-in or animate-out) with effect classes like fade-in, slide-in-from-bottom-4, and duration-300. See references/tw-animate-css.md for all available animations.
Full instructions (SKILL.md)
Source of truth, from paulrberg/agent-skills.
disable-model-invocation: false name: tailwind-css user-invocable: false description: 'Use for Tailwind v4 styling: add/fix classes, configure or migrate Tailwind, use tailwind-variants, or tw-animate-css.'
Tailwind CSS v4
Expert guidance for Tailwind CSS v4, CSS-first configuration, modern utility patterns, and type-safe component styling with tailwind-variants.
CSS-First Configuration
Tailwind CSS v4 eliminates tailwind.config.ts in favor of CSS-only configuration. All configuration lives in CSS files using special directives.
Core Directives:
@import "tailwindcss"- Entry point that loads Tailwind@theme { }- Define or extend design tokens@theme static { }- Define tokens that should not generate utilities@utility- Create custom utilities@custom-variant- Define custom variants
Minimal Example:
@import "tailwindcss";
@theme {
--color-brand: oklch(0.72 0.11 178);
--font-display: "Inter", sans-serif;
--spacing-edge: 1.5rem;
}
All theme tokens defined with @theme automatically become available as utility classes. For example, --color-brand can be used as bg-brand, text-brand, border-brand, etc.
ESLint Integration
Use eslint-plugin-better-tailwindcss for Tailwind CSS v4 class validation and style enforcement.
Correctness Rules (errors):
no-conflicting-classes- Detect classes that override each otherno-unknown-classes- Flag classes not registered with Tailwind
Stylistic Rules (warnings):
enforce-canonical-classes- Use standard v4 class namesenforce-shorthand-classes- Use abbreviated class versionsno-deprecated-classes- Remove outdated class namesno-duplicate-classes- Eliminate redundant declarationsno-unnecessary-whitespace- Clean up extra spacing
Examples:
// ❌ Bad: separate padding
<div className="px-6 py-6">
// ✅ Good: shorthand
<div className="p-6">
// ❌ Bad: separate width/height
<div className="w-6 h-6">
// ✅ Good: size utility
<div className="size-6">
Run the project's ESLint check after modifying Tailwind classes to validate all changes across the codebase.
Coding Preferences
For detailed coding patterns covering layout, spacing, typography, colors, borders, gradients, arbitrary values, class merging, image sizing, z-index, and dark mode, see references/coding-preferences.md.
CSS Modules
Use CSS Modules only as a last resort for complex CSS that cannot be easily written with Tailwind classes.
All .module.css files must include @reference "#tailwind"; at the top to enable Tailwind utilities and theme tokens inside the module.
Example:
/* component.module.css */
@reference "#tailwind";
.component {
/* Complex CSS that can't be expressed with Tailwind utilities */
/* Can still use Tailwind utilities and theme tokens */
}
Common Tasks
Adding a Component with Variants
- Read
references/tailwind-variants.mdfor patterns - Check the project's
@themeconfiguration for available tokens - Use
tv()fromtailwind-variantsfor type-safe variants
Example:
import { tv } from "tailwind-variants";
const button = tv({
base: "rounded-lg px-4 py-2 font-medium",
variants: {
color: {
primary: "bg-blue-600 text-white",
secondary: "bg-gray-600 text-white",
},
size: {
sm: "text-sm",
md: "text-base",
lg: "text-lg",
},
},
});
Debugging Styles
- Check
references/tailwind-v4-rules.mdfor breaking changes - Verify gradient syntax (
bg-linear-*, notbg-gradient-*) - Verify CSS variable syntax (
bg-my-color, notbg-[--var-my-color]) - Check if arbitrary value exists in the project's
@themeconfiguration
Working with Colors
- Check the project's
@themeconfiguration first to see available colors - Use semantic color names when available
- Use opacity modifiers for transparency (
/20,/50, etc.) - Avoid arbitrary colors unless absolutely necessary
Example:
// ✅ Good: theme token with opacity
<div className="bg-brand/20 text-brand">
// ❌ Avoid: arbitrary hex
<div className="bg-[#4f46e5]/20 text-[#4f46e5]">
Adding Animations
- Read
references/tw-animate-css.mdfor available animations - Combine a base class (
animate-inoranimate-out) with effect classes - Note decimal spacing gotcha: use
[0.625rem]syntax, not2.5
Example:
// Enter: fade + slide up
<div className="fade-in slide-in-from-bottom-4 duration-300 animate-in">
// Exit: fade + slide down
<div className="fade-out slide-out-to-bottom-4 duration-200 animate-out">
Quick Reference Table
| Aspect | Pattern |
|---|---|
| Configuration | CSS-only: @theme, @utility, @custom-variant |
| Gradients | bg-linear-*, bg-radial, bg-conic |
| Opacity | Modifier syntax: bg-black/50 |
| Line Height | Modifier syntax: text-base/7 |
| Font Features | font-features-zero, font-features-ss01, etc. |
| CSS Variables | bg-my-color (auto-created from @theme) |
| CSS Modules | @reference "#tailwind"; at top |
| Class Merging | cn() for conditionals; plain string for static |
| Viewport | min-h-dvh (not min-h-screen) |
| Component Variants | references/tailwind-variants.md |
| Animations | references/tw-animate-css.md |
| V4 Rules | references/tailwind-v4-rules.md |
Reference Documentation
- Tailwind v4 Rules & Best Practices:
references/tailwind-v4-rules.md— Breaking changes, removed/renamed utilities, layout rules, typography, gradients, CSS variables, new v4 features, common pitfalls - tailwind-variants Patterns:
references/tailwind-variants.md— Component variants, slots API, composition, TypeScript integration, responsive variants - tw-animate-css Reference:
references/tw-animate-css.md— Enter/exit animations, slide/fade/zoom utilities, spacing gotchas
Related skills
More from paulrberg/agent-skills and the wider catalog.

yeet
Create and manage GitHub PRs, issues, and discussions with semantic understanding of intent.

biome-js
This skill should be used when the user asks to "configure Biome", "extend biome config", "set up BiomeJS", "add biome overrides", "biome lint-staged", "fix biome errors", or mentions biome.jsonc, Biome linting, or Biome formatting configuration.

bump-deps
Auto-update Node.js dependencies with smart prompting for major versions and maturity-period support.

bump-release
Automate release versioning, changelogs, commits, and tags for single and monorepo packages.

payload
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.

cms-migration
Use when user wants to migrate content from another CMS (WordPress, Contentful, Strapi, Sanity, Webflow, etc.) to Payload CMS