tailwind

Writes and audits Tailwind CSS v4 utility classes against a design-token system.

Updated Nov 20, 2025
One-click install
npx skills add https://github.com/apuya/react-basics-ui --skill tailwind-apuya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tailwind
Source: https://github.com/apuya/react-basics-ui/tree/main/.claude/skills/tailwind
Command: npx skills add https://github.com/apuya/react-basics-ui --skill tailwind-apuya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Tailwind CSS v4's CSS-first config model silently breaks named utilities when no @config directive loads a JS config, and raw values in class strings bypass the design-token funnel. This Skill enforces the react-basics-ui conventions so every class resolves to a semantic token and no dead utilities ship. ## Core Features & Use Cases - Token-bound class authoring: Write arbitrary values with type hints like bg-[color:var(--semantic-*)] and h-[length:var(--semantic-*)] so classes reach the --primitive-*--semantic-* token funnel without any JS config. - Class composition conventions: Compose conditional classes through cn() (clsx + tailwind-merge) and extract variant maps into co-located .styles.ts files as Record<Variant, string> objects. - Drift audits: Run grep-based audits that detect raw hex/px values, dead named utilities, missing type hints, dark: variants, @apply usage, and over-long inline class strings. - Use Case: When adding a new Button variant, define its classes in Button.styles.ts using shared fragments like FOCUS_RING, compose with cn(), and let dark mode follow automatically through token overrides instead of dark: utilities. ## Quick Start Ask the AI to style a component's hover state using the semantic token convention and audit the file for dead Tailwind utilities.

Frequently Asked Questions about tailwind

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reference CSS variables in Tailwind arbitrary values?

Use the bracket syntax with a type hint, such as bg-[color:var(--semantic-brand-primary-default)] for colors or h-[length:var(--semantic-height-default)] for dimensions. The color: or length: hint is required so Tailwind v4 parses the value correctly.

Why are my Tailwind named utilities like text-error not working in v4?

Tailwind v4 does not auto-detect tailwind.config.js; it only loads when a stylesheet declares @config. Without that, named utilities from a JS config emit nothing. Convert them to arbitrary values like text-[color:var(--semantic-status-error-default)] or add entries to @theme.

How do I merge Tailwind classes with conditional logic?

Use a cn() helper combining clsx and tailwind-merge: clsx flattens conditionals and arrays, while twMerge resolves conflicts so the last class wins. Pass any incoming className prop last so consumer overrides take precedence.

Should I use dark: variants or CSS variables for dark mode in Tailwind?

In a token-driven system, redefine the semantic CSS variables under a [data-theme="dark"] selector instead of writing dark: variants in components. A single bg-[color:var(--semantic-surface-base)] then follows the theme automatically with one source of truth.

When should I extract Tailwind classes into a separate styles file?

Extract classes into a co-located .styles.ts file when a component has a variant or size axis, or when a class string is reused. Define variant maps as Record<Variant, string> objects with as const and compose shared fragments like focus rings and disabled states.