Skill / UI / Tailwind
Generated utilities before arbitrary values
Prefer Tailwind v4's generated utility scales and shorthand forms before arbitrary bracket values.
Goal
Keep class strings readable, mergeable, and statically detectable while still allowing precise one-off values when they are genuinely needed.
Styling rules for Tailwind v4, token discipline, component reuse, and className boundaries.
Checks
1Use generated spacing and sizing utilities such as `min-w-100`, `w-150`, `size-6`, `mt-17`, `grid-cols-15`, `h-dvh`, `w-dvw`, `h-lh`, and container max-width utilities when they fit.
2Use boolean data variants such as `data-current:opacity-100`; keep bracketed values for real values like `data-[state=open]:opacity-100`.
3Keep class strings complete and statically detectable by mapping props to full class names, for example `{ success: "bg-positive1" }[tone]`.
4Use square brackets for true one-offs such as `max-h-[calc(100dvh-3rem)]`, `grid-cols-[200px_minmax(0,1fr)]`, and arbitrary properties like `[mask-type:luminance]`.
Avoid
1Reaching for bracket values when a generated v4 utility exists.
2Building Tailwind class fragments dynamically, such as concatenating `bg-`, a tone, and `-500`, because the compiler cannot reliably detect them.
Source
Imported as local Refined UI skill guidance, with this repo owning the final wording.
Mastra tailwind-v4
../mastra/.claude/skills/tailwind-v4