Tailwind v4 Migration: Upgrade Without Breaking UI

    by Ignasi

    1

    Automate the migration from Tailwind CSS v3 to v4 with config-to-CSS conversion and visual regression testing.

    Free

    1 useSecurity scanned

    Works with the AI Agents you already use

    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:

    ComponentStatusAction Taken
    Build SystemUpdatedReplaced autoprefixer and postcss-import with @tailwindcss/postcss.
    DirectivesMigratedReplaced @tailwind base/components/utilities with @import "tailwindcss";.
    Theme ConfigConvertedMoved colors.brand and borderRadius from tailwind.config.js to @theme.
    UtilitiesFixedUpdated 42 instances of shadow-sm to shadow-xs and flex-shrink-0 to shrink-0.
    shadcn/uiPatchedAdded @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

    1. Run npm install to update to the latest @tailwindcss/postcss and tailwindcss v4 packages.
    2. Inspect the generated globals.css to verify that any complex custom utilities were correctly wrapped in the @utility directive.
    3. Run your local development server and check the "Visual Diff" log to confirm that the currentColor border default hasn't affected your layout.

    globals.css

    CSS · design tokens

    Generated

    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 @theme CSS syntax.
    • Utility fixups identifies and replaces renamed or removed classes like shadow-sm, outline-none, and flex-shrink-0.
    • Build tool reconfiguration swaps old PostCSS imports for @tailwindcss/vite or @tailwindcss/postcss and removes redundant packages like autoprefixer.
    • 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

    1. Baseline capture creates a snapshot of current page states, browser targets, and CSS bundle sizes.
    2. Core migration executes the upgrade tool and migrates the entry CSS file to the new @import "tailwindcss"; directive.
    3. Theme refactoring moves values from tailwind.config.js into CSS variables and defines custom variants or utilities.
    4. Manual audit checks for breaking changes in default border colors, hover behavior, and important-flag syntax.
    5. 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.js to the new CSS-first @theme variables.
    • 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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/upgradeNode.js

    Permissions

    Terminal / Shell
    Browser
    Read Files
    Listed11 days ago

    What's inside

    Frequently Asked Questions

    The skill automates the transition from JavaScript-based configurations to the new CSS-first `@theme` block, while also performing visual regression testing via Playwright to ensure your UI remains pixel-perfect after the update.

    It is optimized for modern web stacks using Vite, PostCSS, and Next.js, and includes specific patches for component libraries like shadcn/ui that might break during the v4 transition.

    Yes, a key feature of this skill is its ability to identify and replace renamed or deprecated utility classes, such as `flex-shrink-0` and legacy shadow values, to match v4 standards.

    This skill requires modern browser support (Safari 16.4+, Chrome 111+) due to v4's reliance on modern CSS features, and it is not suitable for projects that must support IE11 or older legacy browsers.

    The skill performs a 'Baseline Capture' of your current UI and bundle sizes, then runs a 'Validation' step after the migration to detect any unintended layout shifts or regressions.

    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.

    Free