- Home
- Skills
- Frontend & Web Apps
- Tailwind v4 Migration: Upgrade Without Breaking UI
Tailwind v4 Migration: Upgrade Without Breaking UI
by Ignasi
Automate the migration from Tailwind CSS v3 to v4 with config-to-CSS conversion and visual regression testing.
Free
Tailwind v4 Migration: Upgrade Without Breaking UI
Example session with this skill installed
Migrate my Next.js project from Tailwind v3 to v4. I use shadcn/ui and have a custom brand color palette in tailwind.config.js.
- Read your context and instructions
- Compiled the tailwind v4 migration
- Generated the design tokens stylesheet
I have initiated the migration from Tailwind CSS v3 to v4. I ran the upgrade tool, migrated your JavaScript configuration to the new CSS-first @theme block, and updated the Vite/PostCSS plugin chain.
Migration Report: Tailwind v4
The following changes were applied to your repository to align with the v4 specification:
| Component | Status | Action Taken |
|---|---|---|
| Build System | Updated | Replaced autoprefixer and postcss-import with @tailwindcss/postcss. |
| Directives | Migrated | Replaced @tailwind base/components/utilities with @import "tailwindcss";. |
| Theme Config | Converted | Moved colors.brand and borderRadius from tailwind.config.js to @theme. |
| Utilities | Fixed | Updated 42 instances of shadow-sm to shadow-xs and flex-shrink-0 to shrink-0. |
| shadcn/ui | Patched | Added @theme inline and converted HSL variables to OKLCH in globals.css. |
New Theme Definition
@import "tailwindcss";
@theme {
--color-brand-50: oklch(0.97 0.01 240);
--color-brand-500: oklch(0.62 0.17 256);
--color-brand-900: oklch(0.28 0.07 256);
--font-sans: "Inter", ui-sans-serif, system-ui;
--breakpoint-3xl: 120rem;
}
@utility custom-scrollbar {
scrollbar-width: thin;
scrollbar-color: var(--color-brand-500) transparent;
}
Next steps
- Run
npm installto update to the latest@tailwindcss/postcssandtailwindcssv4 packages. - Inspect the generated
globals.cssto verify that any complex custom utilities were correctly wrapped in the@utilitydirective. - Run your local development server and check the "Visual Diff" log to confirm that the
currentColorborder default hasn't affected your layout.
globals.css
CSS · design tokens
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Upgrading to Tailwind CSS v4 often breaks layouts due to subtle utility renames, default border color changes, and the shift to a CSS-first configuration. This skill automates the migration from v3 to v4, ensuring your UI remains identical throughout the transition. It handles the migration of JavaScript configurations to the new @theme block and updates plugin chains for Vite or PostCSS.
What it does
- Automated upgrade execution runs the official migration tool and reviews file-by-file diffs.
- Config-to-CSS conversion moves theme values, custom breakpoints, and font stacks into the new
@themeCSS syntax. - Utility fixups identifies and replaces renamed or removed classes like
shadow-sm,outline-none, andflex-shrink-0. - Build tool reconfiguration swaps old PostCSS imports for
@tailwindcss/viteor@tailwindcss/postcssand removes redundant packages likeautoprefixer. - Component library patching applies specific fixes for shadcn/ui and other libraries using OKLCH variables or legacy animation plugins.
- Visual verification captures before-and-after screenshots to detect unintended layout shifts.
How it works
- Baseline capture creates a snapshot of current page states, browser targets, and CSS bundle sizes.
- Core migration executes the upgrade tool and migrates the entry CSS file to the new
@import "tailwindcss";directive. - Theme refactoring moves values from
tailwind.config.jsinto CSS variables and defines custom variants or utilities. - Manual audit checks for breaking changes in default border colors, hover behavior, and important-flag syntax.
- Validation runs a build comparison to confirm pixel-perfect parity and reports the final bundle size impact.
Frameworks & tools
Tailwind CSS v4, Vite, PostCSS, Next.js, Playwright for visual diffing, shadcn/ui, and the @tailwindcss/upgrade utility.
Why this beats prompting it yourself
Generic prompts often miss the subtle "default" changes in v4, such as shadow values shifting or the new currentColor border default. This skill follows a rigorous verification workflow that uses actual screenshot diffing to prove the migration didn't break your production UI.
Use cases
- Upgrade a legacy v3 project to use the high-performance v4 engine.
- Migrate a complex
tailwind.config.jsto the new CSS-first@themevariables. - Fix broken layouts in shadcn/ui components after a partial v4 update.
- Minimize CSS bundle size by stripping legacy PostCSS plugins.
Known limitations
Requires modern browser targets (Safari 16.4+, Chrome 111+). Projects requiring IE11 or older evergreen browser support should not use this migration.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
1 use
Times used to date
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 11 days ago
- Free with an Agensi account
- Software
- @tailwindcss/upgrade
Node.js
Permissions
What's inside
Frequently Asked Questions
New in Frontend & Web Apps
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Frontend & Web Apps.