Index of every page on this site: llms.txt
All skills
hairyf avatar

/tailwindcss

@ffa1f90
by Hairyhairyf/skills26 stars
5
Run it yourself

Tailwind CSS utility-first CSS framework. Use when styling web applications with utility classes, building responsive designs, or customizing design systems with theme variables.

Use this Skill: https://skilld.dev/gh/hairyf/skills/tailwindcss

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesfeatures-functions-directives.md

≈919 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Functions and Directives

Tailwind provides custom CSS directives and functions for working with your design system.

Directives

Directives are custom Tailwind-specific at-rules that offer special functionality.

@import

Import CSS files, including Tailwind:

@import "tailwindcss";

@theme

Define your project's design tokens:

@theme {
  --font-display: "Satoshi", "sans-serif";
  --breakpoint-3xl: 120rem;
  --color-brand-500: oklch(0.65 0.2 250);
  --ease-fluid: cubic-bezier(0.3, 0, 0, 1);
}

@source

Explicitly specify source files for class detection:

@import "tailwindcss";
@source "../node_modules/@my-company/ui-lib";

@utility

Add custom utilities:

@utility tab-4 {
  tab-size: 4;
}

Custom utilities work with variants:

<div class="tab-4 hover:tab-8">Content</div>

@variant

Apply Tailwind variants to styles in your CSS:

.my-element {
  background: white;
  
  @variant dark {
    background: black;
  }
}

@custom-variant

Add custom variants:

@custom-variant theme-midnight (&:where([data-theme="midnight"] *));
<div class="theme-midnight:bg-black">Content</div>

@apply

Inline existing utility classes into custom CSS:

.select2-dropdown {
  @apply rounded-b-lg shadow-md;
}

.select2-search {
  @apply rounded border border-gray-300;
}

@reference

Import stylesheet for reference without including styles (useful for Vue/Svelte components):

<style>
  @reference "../../app.css";
  
  h1 {
    @apply text-2xl font-bold text-red-500;
  }
</style>

Or reference Tailwind directly:

<style>
  @reference "tailwindcss";
  
  h1 {
    @apply text-2xl font-bold;
  }
</style>

Subpath Imports

Directives support subpath imports (like TypeScript path aliases):

{
  "imports": {
    "#app.css": "./src/css/app.css"
  }
}
<style>
  @reference "#app.css";
  
  h1 {
    @apply text-2xl font-bold;
  }
</style>

Functions

Tailwind provides build-time functions for working with colors and spacing.

--alpha()

Adjust the opacity of a color:

.my-element {
  color: --alpha(var(--color-lime-300) / 50%);
}

Compiles to:

.my-element {
  color: color-mix(in oklab, var(--color-lime-300) 50%, transparent);
}

--spacing()

Generate spacing values based on your theme:

.my-element {
  margin: --spacing(4);
}

Compiles to:

.my-element {
  margin: calc(var(--spacing) * 4);
}

Useful in arbitrary values with calc():

<div class="py-[calc(--spacing(4)-1px)]">
  Content
</div>

Compatibility Directives

For compatibility with Tailwind CSS v3.x:

@config

Load a legacy JavaScript-based configuration:

@config "../../tailwind.config.js";

@plugin

Load a legacy JavaScript-based plugin:

@plugin "@tailwindcss/typography";

theme()

Access theme values using dot notation (deprecated):

.my-element {
  margin: theme(spacing.12);
}

Note: Prefer using CSS theme variables instead.

Key Points

  • Directives are Tailwind-specific at-rules
  • @theme defines design tokens
  • @utility creates custom utilities
  • @custom-variant creates custom variants
  • @apply inlines utilities into CSS
  • --alpha() and --spacing() are build-time functions
  • Compatibility directives support v3.x configs
<!-- Source references: - https://tailwindcss.com/docs/functions-and-directives -->

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    A comprehensive reference skill for Tailwind CSS v4, containing only documentation and no executable scripts. It provides standard installation guides using official packages and well-known CDN services.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

  • Runlayer9mo

    45/45 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at ffa1f90. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 10 months ago
Other metadata
metadata
{
  "author": "Hairyf",
  "version": "2026.2.2",
  "source": "Generated from https://github.com/tailwindlabs/tailwindcss.com, scripts located at https://github.com/hairyf/skills"
}
  • tailwindcss
  • css
  • utility-first
  • responsive-design
  • styling
  • theme-variables
  • dark-mode
  • web-development

README badge

README badge for hairyf/skills

Tailwind CSS v4 is a utility-first framework for styling web applications by composing design directly in markup using utility classes. Use this skill when building responsive designs, customizing theme variables with CSS-first configuration, or styling components with flexbox, grid, transforms, and effects utilities.

Generated from the current SKILL.md.

Does this skill cover Tailwind CSS v4?
Yes. The skill is based on Tailwind CSS v4.1.18, including v4's CSS-first configuration with theme variables and the @theme directive.
What setup methods does this skill document?
The skill covers Vite, PostCSS, CLI, and CDN installation paths. See the core-installation reference.
Does this skill include dark mode guidance?
Yes. The skill documents dark mode implementation using the dark variant and custom strategies.
Does this skill help migrate from Tailwind v3 to v4?
Yes. The features-upgrade reference covers breaking changes and rename mappings for upgrading from v3 to v4.
What topics does this skill not cover?
The skill focuses on core Tailwind utilities and configuration. It does not cover third-party plugins or integration with specific JavaScript frameworks beyond general markup styling.

Generated from the current SKILL.md. These answers refresh after source changes.