tailwind-4

Standardize Tailwind CSS 4 className patterns with semantic tokens and the cn() utility.

Updated Aug 8, 2025
One-click install
npx skills add https://github.com/Albarracin-sg/MIS-DOTFILES --skill tailwind-4-albarracin-sg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tailwind-4
Source: https://github.com/Albarracin-sg/MIS-DOTFILES/tree/main/tools/opencode/skill/tailwind-4
Command: npx skills add https://github.com/Albarracin-sg/MIS-DOTFILES --skill tailwind-4-albarracin-sg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tailwind CSS usage is often inconsistent, forcing teams to reinvent patterns or fight with fragile className logic. This guide consolidates Tailwind 4 patterns and best practices to standardize styling decisions and reduce cognitive load.

Core Features & Use Cases

  • Styling Decision Tree: Thumb rules for when to use Tailwind classes, dynamic values, and conditional styling to keep code readable and maintainable.
  • Critical Rules: Enforces no var() in className and no hex colors, advocating semantic Tailwind tokens instead.
  • The cn() Utility: Promotes using a small helper to safely compose conditional classes.
  • Dynamic Values: Guidance on when to use style props or CSS variables for truly dynamic styling.
  • Common Patterns: Layout, typography, spacing, borders/shadows, and responsive design patterns with Tailwind utilities.
  • Arbitrary Values (Escape Hatch): How to opt into one-off values while avoiding design-system deviations.

Quick Start

Start by adopting the cn() utility for conditional styling and replace direct hex colors with semantic Tailwind tokens, then progressively apply responsive and dark mode patterns across components.

Frequently Asked Questions about tailwind-4

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

FAQPage Schema
What is the best way to handle conditional classes in Tailwind CSS?

The best way to handle conditional classes in Tailwind CSS is using a small helper utility like cn() to safely compose class names. This prevents fragile string interpolation and keeps className logic readable.

How do I use dynamic values in Tailwind CSS without breaking maintainability?

For dynamic values in Tailwind CSS, use style props or CSS variables instead of arbitrary class constructions. This ensures maintainability while allowing truly dynamic styling outputs beyond static utility classes.

Why should I avoid hex colors and var() in Tailwind CSS classNames?

You should avoid hex colors and var() in Tailwind CSS classNames to maintain a consistent design system. Replacing them with semantic Tailwind tokens enforces standardization and reduces visual fragmentation across components.

Can I use arbitrary values in Tailwind CSS for one-off styling?

Yes, you can use arbitrary values in Tailwind CSS as an escape hatch for one-off styling needs. However, use them cautiously to avoid deviations from your established design system and maintain consistency.

How do I standardize responsive design patterns across multiple components?

Standardize responsive design patterns by applying consistent Tailwind CSS utility rules for layout, typography, and states across components. This guide provides common patterns to reduce cognitive load and ensure maintainability.