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-content-detection.md

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

Detecting Classes in Source Files

Tailwind scans your project for utility classes and generates CSS based on what you've actually used.

How Classes Are Detected

Tailwind treats all source files as plain text and looks for tokens that could be class names:

export function Button({ color, children }) {
  const colors = {
    black: "bg-black text-white",
    blue: "bg-blue-500 text-white",
  };

  return (
    <button className={`${colors[color]} rounded-full px-2 py-1.5`}>
      {children}
    </button>
  );
}

Tailwind detects bg-black, text-white, bg-blue-500, rounded-full, px-2, and py-1.5 from this file.

Dynamic Class Names

Tailwind scans files as plain text, so it can't understand string concatenation or interpolation.

❌ Don't Construct Classes Dynamically

<div class="text-{{ error ? 'red' : 'green' }}-600"></div>

The strings text-red-600 and text-green-600 don't exist in the file, so Tailwind won't generate them.

✅ Use Complete Class Names

<div class="{{ error ? 'text-red-600' : 'text-green-600' }}">
  Content
</div>

❌ Don't Build Classes from Props

function Button({ color, children }) {
  return <button className={`bg-${color}-600 hover:bg-${color}-500`}>{children}</button>;
}

✅ Map Props to Static Classes

function Button({ color, children }) {
  const colorVariants = {
    blue: "bg-blue-600 hover:bg-blue-500",
    red: "bg-red-600 hover:bg-red-500",
  };

  return <button className={`${colorVariants[color]} ...`}>{children}</button>;
}

Which Files Are Scanned

Tailwind scans every file in your project except:

  • Files in .gitignore
  • Files in node_modules
  • Binary files (images, videos, zip files)
  • CSS files
  • Common package manager lock files

Explicitly Registering Sources

Use @source to explicitly register source paths:

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

This is useful for external libraries built with Tailwind that are in .gitignore.

Setting Base Path

Set the base path for source detection:

@import "tailwindcss" source("../src");

Useful in monorepos where build commands run from the root.

Ignoring Specific Paths

Use @source not to ignore paths:

@import "tailwindcss";
@source not "../src/components/legacy";

Disabling Automatic Detection

Use source(none) to disable automatic detection:

@import "tailwindcss" source(none);

@source "../admin";
@source "../shared";

Useful for projects with multiple Tailwind stylesheets.

Safelisting Utilities

Force Tailwind to generate specific classes with @source inline():

@import "tailwindcss";
@source inline("underline");

Safelisting with Variants

Generate classes with variants:

@import "tailwindcss";
@source inline("{hover:,focus:,}underline");

Safelisting with Ranges

Use brace expansion to generate multiple classes:

@import "tailwindcss";
@source inline("{hover:,}bg-red-{50,{100..900..100},950}");

This generates bg-red-50 through bg-red-950 with hover variants.

Explicitly Excluding Classes

Use @source not inline() to prevent specific classes from being generated:

@import "tailwindcss";
@source not inline("{hover:,focus:,}bg-red-{50,{100..900..100},950}");

Key Points

  • Tailwind scans files as plain text
  • Always use complete class names, never construct them dynamically
  • Map props/state to static class names
  • Use @source to explicitly register or ignore paths
  • Use @source inline() to safelist utilities
  • Brace expansion works in inline sources for ranges
<!-- Source references: - https://tailwindcss.com/docs/detecting-classes-in-source-files -->

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.