Skip to content
Back to skills

Tailwindcss Custom Styles

ASecurity

Use when creating a new named utility class, writing conditional/dark-mode variants, defining a custom variant selector, or using @apply.

  • 29 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 7, 2026
design

Security analysis

A100/100

Scanned September 29, 2026

npx -y skills add fusengine/agents --skill tailwindcss-custom-styles --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tailwindcss Custom Styles?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tailwindcss Custom Styles
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/fusengine-tailwindcss-custom-styles/badge)](https://www.skillsdirectory.com/skills/fusengine-tailwindcss-custom-styles)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tailwindcss-custom-styles
description: "Use when creating a new named utility class, writing conditional/dark-mode variants, defining a custom variant selector, or using @apply."
user-invocable: false
---

<objective>
Custom CSS authoring in Tailwind CSS v4.3 via the `@utility`, `@variant`, `@custom-variant`, `@apply`, and `@layer` directives: defining a new named utility class, writing conditional styles (including dark mode) inline with `@variant`, declaring a brand-new custom variant selector with `@custom-variant`, applying utility classes inside a custom CSS rule with `@apply`, and organizing custom CSS into `@layer components`/`@layer utilities`.
</objective>

# Custom Styles

## @utility - Create a utility
```css
@utility glass-effect {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.1);
}
/* Usage: class="glass-effect hover:glass-effect" */
```

### Functional utility with a default value (since v4.3)
`--default(…)` inside `--value(…)` / `--modifier(…)` makes the bare utility work too.
```css
@utility tab-* {
  tab-size: --value(integer, --default(4));
}
/* class="tab" → tab-size: 4; class="tab-2" → tab-size: 2 */
```

## @variant - Conditional style
```css
.card {
  background: white;
  @variant dark { background: #1a1a2e; }
  @variant hover { transform: scale(1.05); }
}
```

### Stacked and compound @variant (since v4.3)
```css
.button {
  background: var(--color-sky-500);
  /* Stacked: hover AND focus */
  @variant hover:focus { background: var(--color-sky-600); }
  /* Compound: same block for hover OR focus */
  @variant hover, focus { color: white; }
}
```

## @custom-variant - New variant
```css
@custom-variant theme-midnight (&:where([data-theme="midnight"] *));
/* Usage: theme-midnight:bg-black */
```

## @apply - Inline utilities
```css
.btn-primary {
  @apply bg-blue-500 text-white px-4 py-2 rounded-lg;
}
```

## @layer - CSS organization
```css
@layer components {
  .card { @apply bg-white shadow-md rounded-xl p-4; }
}
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…