tailwind-setup
Skill4 starsChanged 4 months agoMITView on GitHub
Set up Tailwind CSS v4.3 in a Next.js 16 project (App Router) — PostCSS plugin, CSS-first @theme tokens, dark mode, plus the v4.2 webpack plugin path for non-Vite/Turbopack stacks and v4.3 utilities (scrollbars, @container-size, new palettes).
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- otoshek/Claude-Code-Toolkittheir own version, first seen Nov 19, 2025
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- otoshek/Claude-Code-Toolkit★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository162 other files it gives its agents.
- agents/AGENTS.mdAGENTS.md
- skills/compound-engineering/AGENTS.mdAGENTS.md
- skills/trailofbits-security/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- examples/CLAUDE.mdCLAUDE.md
- skills/compound-engineering/CLAUDE.mdCLAUDE.md
- skills/trailofbits-security/CLAUDE.mdCLAUDE.md
- app-store-reviewSkill
- advanced-javascriptSkill
- ai-native-uiSkill
- anime-jsSkill
- app-l100Skill
- barba-jsSkill
- brand-guidelinesSkill
- cinematic-web-engineSkill
- codebase-knowledge-graphSkill
- crossplatform-monorepoSkill
- css-first-uiSkill
- design-auditSkill
- design-critiqueSkill
- dev-cycleSkill
- device-hardware-bridgeSkill
- discovery-docSkill
- docxSkill
- edge-intelligenceSkill
- graph-aware-reviewSkill
- linkedin-posterSkill
- local-first-architectureSkill
- modern-build-pipelineSkill
- motion-nativeSkill
- nano-bananaSkill
- playwrightSkill
- pptxSkill
- project-initSkill
- remotionSkill
- sensory-nativeSkill
- spline-3dSkill
- streaming-cacheSkill
- tanstack-ecosystemSkill
- design-taste-frontendSkill
- tauri-desktopSkill
- threejsSkill
- transition-nativeSkill
- ui-design-stackSkill
- visual-nativeSkill
- web-l100Skill
- web-platform-apisSkill
- xlsxSkill
- better-authSkill
- claude-real-videoSkill
- clone-websiteSkill
- css-keyframe-animationsSkill
- design-checkSkill
- design-dnaSkill
- design-polishSkill
- drizzle-neonSkill
- fastlaneSkill
- angular-architectSkill
- api-designerSkill
- architecture-designerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Use this when adding Tailwind v4 to an existing Next.js 16 codebase or migrating from v3.
- Very specific: line 101
Use bg-bg text-fg and the system handles the toggle.
- Distinctive: line 140
Use this when a component should adapt to its parent's measured size, not the viewport.
- Very specific: line 197
Run on a clean git tree, review the diff.
- Very specific: line 205
Custom colors don't work with
dark:variant: use light-dark() in the @theme value, or define separate --color-foo and --color-foo-dark …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tailwind CSS v4.3 Setup for Next.js 16 (Web)
The default and recommended setup for the user's primary stack: Next.js 16 App Router + Tailwind CSS v4.3. For React Native / Expo, use the expo-tailwind-setup skill instead.
Quickest path (new project)
create-next-app already wires Tailwind v4 with the --tailwind flag — accept the defaults:
npx create-next-app@latest my-app --typescript --tailwind --eslint --app --src-dir --import-alias "@/*"That gives you @tailwindcss/postcss, a working app/globals.css, and a postcss.config.mjs. Skip to "Add design tokens" below.
Manual install (existing project)
Use this when adding Tailwind v4 to an existing Next.js 16 codebase or migrating from v3.
npm install tailwindcss@^4.3 @tailwindcss/postcss@^4.3
# optional companions
npm install tailwind-merge clsxpostcss.config.mjs
export default {
plugins: {
"@tailwindcss/postcss": {},
},
};No autoprefixer line — @tailwindcss/postcss handles vendor prefixing internally via Lightning CSS.
app/globals.css
@import "tailwindcss";
@theme {
--font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--font-mono: ui-monospace, "SF Mono", Menlo, monospace;
/* Brand tokens — register custom utilities like text-brand, bg-brand */
--color-brand: oklch(0.65 0.2 250);
--color-brand-foreground: oklch(0.98 0 0);
/* Custom radius scale */
--radius-pill: 9999px;
}app/layout.tsx
import "./globals.css";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}That's it — no tailwind.config.js, no @tailwind directives. Tailwind v4 reads tokens from CSS via @theme and discovers utilities via the @import "tailwindcss" line.
Token-hierarchy architecture (brand → semantic → component tiers): see skills/impeccable/reference/color-and-contrast.md § @theme token hierarchy.
Dark mode (v4 idiom)
Two patterns. Pick one — don't mix.
Pattern A — prefers-color-scheme (zero JS)
@import "tailwindcss";
@theme {
--color-bg: light-dark(white, oklch(0.18 0 0));
--color-fg: light-dark(oklch(0.18 0 0), white);
}
html { color-scheme: light dark; }Use bg-bg text-fg and the system handles the toggle. No dark: variants needed.
Pattern B — class-based toggle (next-themes / manual)
@import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *));
@theme {
--color-bg: white;
--color-fg: oklch(0.18 0 0);
}Then write bg-bg dark:bg-zinc-950 text-fg dark:text-zinc-100. Pair with next-themes to drive the .dark class on <html>.
v4.3 utilities worth knowing
Scrollbar utilities (v4.3)
<div class="overflow-y-auto scrollbar-thin scrollbar-thumb-zinc-400 scrollbar-track-zinc-100 dark:scrollbar-thumb-zinc-700 dark:scrollbar-track-zinc-900">Variants: scrollbar-thin, scrollbar-none, scrollbar-thumb-*, scrollbar-track-*. Replaces the tailwind-scrollbar plugin for most use cases.
@container-size (v4.3)
Container queries that reference the container's own size as a token:
<article class="@container">
<div class="@container-size:h-40 @container-size:flex"> … </div>
</article>Use this when a component should adapt to its parent's measured size, not the viewport.
New neutral palettes (v4.3)
mauve, olive, mist, taupe — slightly warmer / cooler than zinc/gray/slate/neutral/stone. Available as bg-mauve-50 … bg-mauve-950, etc. Useful when the existing five neutrals all look wrong against your brand color.
Faster builds (v4.2)
v4.2 ships ~3.8× faster incremental recompilation in Next.js dev. No code change required — just run npm install tailwindcss@^4.3 to pick up the perf delta.
When to use the webpack plugin (v4.2+)
Skip this section if you're on Turbopack (default in create-next-app@latest) — PostCSS works.
For a custom Next.js setup that uses webpack and bypasses PostCSS:
npm install @tailwindcss/webpack@^4.3// next.config.js — only if you have a custom webpack(config) function and need direct integration
module.exports = {
webpack: (config) => {
config.module.rules.push({
test: /\.css$/,
use: ["@tailwindcss/webpack"],
});
return config;
},
};This is rare in Next.js (PostCSS path covers ~99% of projects). Real use case: monorepos where one app has webpack-only constraints and you can't stand up PostCSS.
Migration from v3 → v4
| v3 | v4 |
tailwind.config.js (theme.extend.colors etc.) | @theme { --color-*: ... } in CSS |
@tailwind base; @tailwind components; @tailwind utilities; | @import "tailwindcss"; |
darkMode: 'class' config | @custom-variant dark (&:where(.dark, .dark *)); |
content: [...] glob config | Auto-detected from file imports — usually delete |
plugins: [require('@tailwindcss/forms')] | @plugin "@tailwindcss/forms"; in CSS |
PostCSS tailwindcss plugin | PostCSS @tailwindcss/postcss plugin |
autoprefixer plugin | Built into Lightning CSS — remove |
Migration codemod:
npx @tailwindcss/upgrade@latestRun on a clean git tree, review the diff. The codemod handles ~90% of the transform; manual fixes usually involve custom plugins or @apply chains in component CSS.
Common pitfalls
- Empty utility output: usually a missing
@import "tailwindcss";or the wrong PostCSS plugin name (tailwindcssinstead of@tailwindcss/postcss). @themetokens not generating utilities: tokens must be inside the@themeblock at the top level — not nested inside@layer.- Custom colors don't work with
dark:variant: uselight-dark()in the@themevalue, or define separate--color-fooand--color-foo-darkand switch with@custom-variant. @applyin CSS Modules fails: v4 dropped support inside scoped modules; either move utilities to global CSS or use thetwclassName directly.- Stale Tailwind output after upgrade: kill
next dev,mv .next /c/tmp/trash/.next-$(date +%s), restart. Cache between v3 and v4 is incompatible.
Sources
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

