tailwind-4

Enforce Tailwind CSS best practices in React components with cn() helper.

Updated Nov 19, 2024
One-click install
npx skills add https://github.com/Strocs/.dotfiles --skill tailwind-4-strocs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tailwind-4
Source: https://github.com/Strocs/.dotfiles/tree/main/.config/opencode/skills/tailwind-4
Command: npx skills add https://github.com/Strocs/.dotfiles --skill tailwind-4-strocs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tailwind-4 provides a structured set of patterns and rules to ensure consistent, maintainable styling across a codebase, preventing inconsistent class usage and hard-to-change styles.

Core Features & Use Cases

  • Enforces no var() usage in className and discourages hex colors, promoting semantic Tailwind classes.
  • Provides a cn() utility pattern for clean conditional styling.
  • Offers guidance for dynamic values, theming, and common layout patterns to streamline UI development.

Quick Start

Start applying the Tailwind-4 guidelines by adopting the cn() helper and replacing problematic patterns in your components.

Frequently Asked Questions about tailwind-4

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

FAQPage Schema
How do I enforce consistent Tailwind CSS styling across my React components?

To enforce consistent Tailwind CSS styling across React components, adopt structured patterns like the cn() helper for conditional classes, avoid hex colors, and replace var() usage in className with semantic utility classes to ensure maintainable UI code.

What is the best way to handle conditional classes in Tailwind 4?

The best way to handle conditional classes in Tailwind 4 is implementing a cn() utility helper pattern. This approach cleanly merges class names based on dynamic conditions, preventing style conflicts and ensuring maintainable component logic.

Why should I avoid using var() and hex colors in Tailwind className strings?

Avoiding var() and hex colors in Tailwind className strings enforces semantic utility usage. This promotes consistent theming across web projects, making UI layouts easier to update and preventing hard-to-change style dependencies.

Does Tailwind 4 work with responsive layout patterns for web projects?

Yes, Tailwind 4 works with responsive layout patterns for web projects by offering guidance for dynamic values and theming. It streamlines UI development with consistent rules for responsive design across your codebase.

When do I need structured Tailwind CSS patterns for theming?

You need structured Tailwind CSS patterns for theming when a codebase suffers from inconsistent class usage or hard-to-change styles. Implementing these rules prevents style fragmentation and maintains semantic consistency across UI components.