What this thread does
The problem
Your project is on Tailwind CSS v4, but Claude Code, Cursor or Gemini keeps producing v3: a tailwind.config.js, the @tailwind base; @tailwind components; @tailwind utilities; trio, bg-opacity-50, bg-gradient-to-r, PostCSS plus autoprefixer. Nothing errors loudly; classes just do not apply, or borders and shadows look wrong.
What people report
The same complaint shows up across 2025-2026 posts, each small on its own: r/cursor (post: "simply just linking the v4 Upgrade guide doc page resolves it"; rules post; another), and r/tailwindcss (post, a maker post for a small MIT rules plugin). All land on the same fix: tell the agent the version and the v4 facts in a short always-loaded rules file, and point it at the official upgrade guide.
The v4 facts to put in CLAUDE.md / AGENTS.md / .cursor/rules
From the official upgrade guide:
# Tailwind v4 (check package.json before writing CSS)
- Entry CSS: @import "tailwindcss"; never the @tailwind directives.
- Theme lives in CSS: @theme { --color-brand-500: ...; }. No tailwind.config.js
(only if loaded explicitly with @config).
- PostCSS plugin is @tailwindcss/postcss; with Vite use @tailwindcss/vite.
No autoprefixer or postcss-import.
- No *-opacity-* utilities: use bg-black/50.
- Renamed: shadow-sm -> shadow-xs, shadow -> shadow-sm, outline-none -> outline-hidden,
ring -> ring-3, bg-gradient-to-r -> bg-linear-to-r, flex-shrink -> shrink.
- Borders default to currentColor; always give border-* a color.
One poster found a single line, "check the version in package.json first and never use deprecated APIs", fixed a large share of bad output on its own.
Upgrading an old v3 project with an agent
Create a branch. Run npx @tailwindcss/upgrade (Node 20+), then show me the diff grouped by: config moved to CSS, renamed utilities, removed plugins. Do not hand-edit utilities the tool already changed. Then run the build and list any classes that no longer exist.
The upgrade guide says the tool handles dependencies, config-to-CSS and template changes, and asks you to review the diff.
Common mistakes
- Keeping a v3
tailwind.config.jsaround in a v4 project; v4 ignores it unless you add@config. - Telling the agent "use Tailwind" without the major version.
- Missing the border color change: v3 borders were gray-200 by default, v4 uses currentColor; add the base style from the guide if you want the old look.
- Expecting
safelistorcorePluginsto work; v4 dropped them (@source inline()safelists).
Limits
Not run by me. Demand comes from repeated low-score posts, several by people selling rule packs; the fix itself is the official guide.
Primary source
Primary source: the Tailwind CSS v3 to v4 upgrade guide (Tailwind Labs, read 18 October 2026). Checked: npx @tailwindcss/upgrade needs Node.js 20+ and should run on a new branch with the diff reviewed; @import "tailwindcss" replaces the @tailwind directives; theme configuration moves to CSS with @theme and JavaScript configs load only through @config; @tailwindcss/postcss and @tailwindcss/vite, with postcss-import and autoprefixer no longer needed; the *-opacity-* utilities are removed in favor of modifiers like bg-black/50; the renames shadow-sm to shadow-xs, shadow to shadow-sm, outline-none to outline-hidden, ring to ring-3, bg-gradient-to-r to bg-linear-to-r, flex-shrink to shrink; border color defaults to currentColor (v3 used gray-200); corePlugins unsupported and safelist not supported in v4.0 (use @source inline()). Not verified: every Reddit post and vote count, the claim that models still default to v3, the "one line in package.json" anecdote, and the rules plugin makers' claims.
Started from a post by @Tailwind Labs, packaged by the editor. Original post