tailwind-v4
What it does
This skill is a guide to writing Tailwind CSS version 4 code correctly. It points out older version 3 patterns that should not appear in new code.
When to use it
- ✓When you are writing or changing Tailwind styles in a project.
- ✓When you want to move old Tailwind version 3 code to version 4.
- ✓When you want to set up custom theme colors in the new configuration style.
Skill link
https://github.com/mastra-ai/mastra/blob/main/.claude/skills/tailwind-v4/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Update the styles in this component to use Tailwind version 4 syntax and remove the old version 3 patterns.”
5 new skills a week. 1 minute to read.
How it works
The agent uses the CSS-based configuration of Tailwind version 4 instead of a JavaScript config file, and checks that utilities exist in the version the project uses before using them.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Tailwind CSS v4
How to write idiomatic Tailwind v4 and spot v3-era syntax that still compiles but should not appear in new code.
Version and sources
Check the pinned version before using recent utilities: the playground packages pin tailwindcss in their package.json (4.3.3 at the time of writing, including v4.3 utilities like scrollbar-*, zoom-*, and tab-*). When unsure whether a utility, variant, or directive exists in the pinned version, verify against the docs instead of guessing:
- Utility/variant reference: https://tailwindcss.com/docs
- v3 → v4 migration: https://tailwindcss.com/docs/upgrade-guide
- What each minor added: https://tailwindcss.com/blog/tailwindcss-v4 (and
/tailwindcss-v4-1,/tailwindcss-v4-3, ...)
CSS-first configuration
Tailwind v4 is configured in CSS, not JavaScript.
| Use | Never use (v3-era) |
|---|---|
@import 'tailwindcss' |
@tailwind base/components/utilities |
@theme { --color-x: ...; } for tokens that should generate utilities |
tailwind.config.ts for new work |
@utility name { ... } for custom utilities (works with variants) |
@layer utilities { .name { ... } } |
@custom-variant dark (&:is(.dark *)) |
JS plugins / addVariant |
@source "path" / @source inline("...") for extra sources / safelisting |
content array / safelist config |
@variant dark { ... } to apply a Tailwind variant inside custom CSS |
duplicating media queries / selectors |
@reference "app.css" for @apply in scoped styles (Vue, CSS Modules) |
duplicating stylesheet imports |
var(--color-x) in CSS, getComputedStyle in JS |
theme() function, resolveConfig |
@config "…" / @plugin "…" only for existing JS-config integrations |
adding new JS configs or plugins |
@theme variables are API: each one emits a native CSS variable AND generates utilities (--color-* → bg-*/text-*/border-*/..., --text-* → text-*, --shadow-* → shadow-*, --animate-* → animate-*, --breakpoint-* → responsive variants). A plain :root { --x: ...; } variable generates nothing — use it for runtime-only values. When a token's value references another variable (--color-x: var(--y)), declare it in @theme inline so the utility resolves the reference at the declaration site. In custom CSS, --alpha(var(--color-x) / 50%) and --spacing(4) replace v3 theme() math.
v3 → v4 renames
Bare names shifted one step down the scale, so the v3 spelling silently renders smaller or lighter:
| v3 | v4 |
|---|---|
shadow-sm / shadow |
shadow-xs / shadow-sm |
drop-shadow-sm / drop-shadow |
drop-shadow-xs / drop-shadow-sm |
blur-sm / blur |
blur-xs / blur-sm |
rounded-sm / rounded |
rounded-xs / rounded-sm |
outline-none |
outline-hidden (a11y-safe); outline-none now truly removes it |
ring (3px) |
ring-3; the default ring is now 1px currentColor |
bg-opacity-50, text-opacity-* |
opacity modifier: bg-black/50, text-white/50 |
bg-gradient-to-r |
bg-linear-to-r (plus new bg-conic-*, bg-radial-*) |
!bg-red-500 (prefix) |
bg-red-500! (suffix) |
flex-shrink-* / flex-grow-* |
shrink-* / grow-* |
bg-[--var] |
bg-(--var); brackets now require bg-[var(--var)] |
grid-cols-[a,b] (commas) |
underscores: grid-cols-[max-content_auto] |
Prefer generated utilities over arbitrary values
The spacing scale is infinite — every number compiles via calc(var(--spacing) * n) — so mo
FAQ
Does the project still need a tailwind config file?
For new work, the configuration is written in CSS instead of a JavaScript config file.
How does it know which features are available?
It checks the Tailwind version the project pins and consults the official documentation when unsure.
Is the old syntax broken?
Much of it still compiles, but the skill steers new code away from it.
Details
Original description by the author
Tailwind CSS v4 usage guide and v3-to-v4 differences. This skill should be used when writing, reviewing, or refactoring any Tailwind CSS code in this repo. Triggers on tasks involving Tailwind classes, @theme blocks, CSS-first configuration, or cleanup of v3-era syntax.
repo: mastra-ai/mastra
Popularity
- GitHub stars
- 29k
- Ranking position
- #9366
- License
- —
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
debugging-difficult-bugs
29kHelps your agent debug a hard bug by logging what the real program does at runtime, instead of guessing from tests alone.
mastra-frontend
29kHelps your agent build app screens with the Mastra playground design system by combining its ready-made components, rather than styling from scratch.
pr-explainer
29kHelps your agent turn a pull request into a clear, self-contained HTML page that explains the change to reviewers.
pr-splitter
29kHelps your agent break a large, messy pull request into smaller, reviewable pull requests while keeping the original work safe.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.