home / skills / openagentsinc / openagents / tailwindcss-development

This skill helps you style applications with Tailwind CSS v4 by guiding responsive, dark-mode, and component extraction patterns.

npx playbooks add skill openagentsinc/openagents --skill tailwindcss-development

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.7 KB
---
name: tailwindcss-development
description: "Styles applications using Tailwind CSS v4 utilities. Activates when adding styles, restyling components, working with gradients, spacing, layout, flex, grid, responsive design, dark mode, colors, typography, or borders; or when the user mentions CSS, styling, classes, Tailwind, restyle, hero section, cards, buttons, or any visual/UI changes."
license: MIT
metadata:
  author: laravel
---

# Tailwind CSS Development

## When to Apply

Activate this skill when:

- Adding styles to components or pages
- Working with responsive design
- Implementing dark mode
- Extracting repeated patterns into components
- Debugging spacing or layout issues

## Documentation

Use `search-docs` for detailed Tailwind CSS v4 patterns and documentation.

## Basic Usage

- Use Tailwind CSS classes to style HTML. Check and follow existing Tailwind conventions in the project before introducing new patterns.
- Offer to extract repeated patterns into components that match the project's conventions (e.g., Blade, JSX, Vue).
- Consider class placement, order, priority, and defaults. Remove redundant classes, add classes to parent or child elements carefully to reduce repetition, and group elements logically.

## Tailwind CSS v4 Specifics

- Always use Tailwind CSS v4 and avoid deprecated utilities.
- `corePlugins` is not supported in Tailwind v4.

### CSS-First Configuration

In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed:

<!-- CSS-First Config -->
```css
@theme {
  --color-brand: oklch(0.72 0.11 178);
}
```

### Import Syntax

In Tailwind v4, import Tailwind with a regular CSS `@import` statement instead of the `@tailwind` directives used in v3:

<!-- v4 Import Syntax -->
```diff
- @tailwind base;
- @tailwind components;
- @tailwind utilities;
+ @import "tailwindcss";
```

### Replaced Utilities

Tailwind v4 removed deprecated utilities. Use the replacements shown below. Opacity values remain numeric.

| Deprecated | Replacement |
|------------|-------------|
| bg-opacity-* | bg-black/* |
| text-opacity-* | text-black/* |
| border-opacity-* | border-black/* |
| divide-opacity-* | divide-black/* |
| ring-opacity-* | ring-black/* |
| placeholder-opacity-* | placeholder-black/* |
| flex-shrink-* | shrink-* |
| flex-grow-* | grow-* |
| overflow-ellipsis | text-ellipsis |
| decoration-slice | box-decoration-slice |
| decoration-clone | box-decoration-clone |

## Spacing

Use `gap` utilities instead of margins for spacing between siblings:

<!-- Gap Utilities -->
```html
<div class="flex gap-8">
    <div>Item 1</div>
    <div>Item 2</div>
</div>
```

## Dark Mode

If existing pages and components support dark mode, new pages and components must support it the same way, typically using the `dark:` variant:

<!-- Dark Mode -->
```html
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
    Content adapts to color scheme
</div>
```

## Common Patterns

### Flexbox Layout

<!-- Flexbox Layout -->
```html
<div class="flex items-center justify-between gap-4">
    <div>Left content</div>
    <div>Right content</div>
</div>
```

### Grid Layout

<!-- Grid Layout -->
```html
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
    <div>Card 1</div>
    <div>Card 2</div>
    <div>Card 3</div>
</div>
```

## Common Pitfalls

- Using deprecated v3 utilities (bg-opacity-*, flex-shrink-*, etc.)
- Using `@tailwind` directives instead of `@import "tailwindcss"`
- Trying to use `tailwind.config.js` instead of CSS `@theme` directive
- Using margins for spacing between siblings instead of gap utilities
- Forgetting to add dark mode variants when the project uses dark mode

Overview

This skill styles applications using Tailwind CSS v4 utilities and conventions. It focuses on practical, maintainable class usage for components, layouts, responsive design, dark mode, spacing, and typography. I apply v4-specific syntax and migration rules to avoid deprecated utilities and ensure consistent patterns across the project.

How this skill works

I inspect components and pages for styling needs, identify repeated patterns to extract into reusable components, and enforce Tailwind v4 syntax (CSS-first @theme and @import "tailwindcss"). I prioritize gap utilities for sibling spacing, dark: variants when the project supports dark mode, and replacements for removed v3 utilities. I also clean up redundant or conflicting classes and suggest grouping or moving classes to parent elements to reduce repetition.

When to use it

  • Adding or restyling components or pages
  • Implementing or auditing responsive layouts (flex, grid, gaps)
  • Adding or verifying dark mode support
  • Migrating from Tailwind v3 patterns or removing deprecated utilities
  • Extracting repeated UI patterns into reusable components

Best practices

  • Always use Tailwind v4 syntax: use @import "tailwindcss" and CSS-first @theme for variables
  • Prefer gap utilities for spacing between siblings instead of margins
  • Match existing project conventions before introducing new component patterns (JSX, Blade, Vue, etc.)
  • Replace deprecated utilities with v4 equivalents and remove @tailwind directives
  • Add dark: variants consistently when the project already supports dark mode

Example use cases

  • Style a hero section with responsive typography, gradient background, and dark-mode variants
  • Refactor a card list to use grid utilities with responsive column counts and gap spacing
  • Convert v3 classes to v4-safe equivalents and remove deprecated utilities
  • Create a reusable button component with consistent spacing, focus states, and color variables in @theme
  • Fix layout bugs by replacing margin-based spacing with gap and adjusting flex/grid alignment

FAQ

What is the key config change in Tailwind v4?

Tailwind v4 is CSS-first: use the @theme directive for variables and @import "tailwindcss" to bring in utilities instead of tailwind.config.js and @tailwind directives.

Which spacing approach should I use between sibling elements?

Use gap utilities (e.g., gap-4) on the parent container instead of applying margins to individual siblings for predictable spacing and simpler responsive adjustments.