Agent skill

Tailwind 4 Skill from Gentleman Skills

A short Tailwind CSS 4 skill that stops an AI coding agent from writing var() or hex values inside className, and shows when cn() is worth using.

Install
cp -r Gentleman-Skills/curated/tailwind-4 ~/.claude/skills/
View on GitHub

Stars, license and last push from GitHub. Install count as reported by the open skills directory.

What the tailwind-4 skill is

The tailwind-4 skill is a curated entry in Gentleman-Programming's Gentleman-Skills repository. Its SKILL.md gives an AI coding agent a styling decision tree, two hard bans on var() and hex colors inside className, a cn() helper built on clsx and tailwind-merge, and short reference patterns for layout, states and dark mode.

Gentleman-Skills describes itself as a community collection of agent skills, split into curated ones by Gentleman-Programming and community ones accepted by vote. The tailwind-4 skill sits under curated/ and carries version 1.1 in its frontmatter.

Its trigger is narrow: styling with Tailwind, using cn(), working with theme variables, or being tempted to put var() in a className. It is a rulebook for how classes are written, not a design taste guide.

The decision tree at the top

SKILL.md opens with five questions the agent answers before touching a class. Each maps to one move, so the choice between a utility class, a style prop and a cn() call stops being improvised.

  • If a Tailwind class exists, write it in className.
  • If the value is dynamic, use the style prop, for example a width computed from a percentage.
  • If styles are conditional, reach for cn() with a base string and a condition.
  • If everything is static, skip cn() entirely.
  • If a library cannot take a class, pass a style prop with var() constants.

Two bans and one helper

The Critical Rules section forbids var() inside className, such as a bracketed color variable, and forbids hex colors in className. The agent should write semantic or palette classes like bg-primary or bg-slate-800 instead.

The cn() helper is two lines: it passes inputs through clsx, then twMerge. The skill lists when it earns its place, such as conditional classes and merging a className prop, and when it is just wrapper noise.

Where var() is still allowed

Some chart libraries cannot take a class. For those, the skill keeps a constants object whose values are var() strings, used only in library props such as a Recharts axis tick fill or a grid stroke.

Truly dynamic numbers go in the style prop, and a custom property can be set from a style object. This keeps className free of runtime values while still allowing theming. Pair it with design token practice for the variables themselves.

Use it with UiChemy

Tailwind-4 shapes the code your agent writes in a React project. UiChemy works at the page level: AI to WordPress imports an AI build, and Composer writes real HTML, CSS and JS in Elementor or Gutenberg. Get Started at uichemy.com.

For the surrounding workflow, see Tailwind design system for token structure, shadcn for the component side and dark mode design for theme work in the same project.