tailwind-v4-shadcn — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited tailwind-v4-shadcn (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Production-tested: WordPress Auditor (https://wordpress-auditor.webfonts.workers.dev) Last Updated: 2025-10-29 Status: Production Ready ✅
CRITICAL FOR AI AGENTS: If you're Claude Code helping a user set up Tailwind v4:
reference/common-gotchas.mdUSER ACTION REQUIRED: Tell Claude to check this skill first!
Say: "I'm setting up Tailwind v4 + shadcn/ui - check the tailwind-v4-shadcn skill first"
Without skill activation:
With skill activation:
All of these are handled automatically when the skill is active.
pnpm add tailwindcss @tailwindcss/vite
pnpm add -D @types/node
pnpm dlx shadcn@latest init// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import path from 'path'
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
}
}){
"tailwind": {
"config": "", // ← CRITICAL: Empty for v4
"css": "src/index.css",
"cssVariables": true
}
}rm tailwind.config.ts # v4 doesn't use this fileThis pattern is mandatory - skipping steps will break your theme.
/* src/index.css */
@import "tailwindcss";
:root {
--background: hsl(0 0% 100%); /* ← hsl() wrapper required */
--foreground: hsl(222.2 84% 4.9%);
--primary: hsl(221.2 83.2% 53.3%);
/* ... all light mode colors */
}
.dark {
--background: hsl(222.2 84% 4.9%);
--foreground: hsl(210 40% 98%);
--primary: hsl(217.2 91.2% 59.8%);
/* ... all dark mode colors */
}Critical Rules:
@layer base)hsl() wrapper on all color values.dark for dark mode (NOT .dark { @theme { } })@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-primary: var(--primary);
/* ... map ALL CSS variables */
}Why This Is Required:
bg-background, text-primary)bg-primary etc. won't exist@layer base {
body {
background-color: var(--background); /* NO hsl() here */
color: var(--foreground);
}
}Critical Rules:
var(--background)hsl(var(--background))<div className="bg-background text-foreground">
{/* No dark: variants needed - theme switches automatically */}
</div>See reference/dark-mode.md for full implementation or use template:
// Copy from: templates/theme-provider.tsx// src/main.tsx
import { ThemeProvider } from '@/components/theme-provider'
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
<App />
</ThemeProvider>
</React.StrictMode>,
)pnpm dlx shadcn@latest add dropdown-menuSee reference/dark-mode.md for ModeToggle component code.
--background: hsl(0 0% 100%); /* ✅ Correct */ @theme inline {
--color-background: var(--background);
} { "tailwind": { "config": "" } } import { cn } from "@/lib/utils"
<div className={cn("base", isActive && "active")} /> /* WRONG */
@layer base {
:root { --background: hsl(...); }
} /* WRONG - v4 doesn't support nested @theme */
.dark {
@theme {
--color-primary: hsl(...);
}
} /* WRONG */
body {
background-color: hsl(var(--background));
} /* WRONG - v4 ignores this */
export default {
theme: {
extend: {
colors: { primary: 'hsl(var(--primary))' }
}
}
} /* WRONG */
<div className="bg-primary dark:bg-primary-dark" />
/* CORRECT */
<div className="bg-primary" />Always use semantic names for colors:
:root {
--destructive: hsl(0 84.2% 60.2%); /* Red - errors, critical */
--success: hsl(142.1 76.2% 36.3%); /* Green - success states */
--warning: hsl(38 92% 50%); /* Yellow - warnings */
--info: hsl(221.2 83.2% 53.3%); /* Blue - info, primary */
}Usage:
<div className="bg-destructive text-destructive-foreground">Critical</div>
<div className="bg-success text-success-foreground">Success</div>
<div className="bg-warning text-warning-foreground">Warning</div>
<div className="bg-info text-info-foreground">Info</div>| Symptom | Cause | Fix |
|---|---|---|
bg-primary doesn't work | Missing @theme inline mapping | Add @theme inline block |
| Colors all black/white | Double hsl() wrapping | Use var(--color) not hsl(var(--color)) |
| Dark mode not switching | Missing ThemeProvider | Wrap app in <ThemeProvider> |
| Build fails | tailwind.config.ts exists | Delete the file |
| Text invisible | Wrong contrast colors | Check color definitions in :root/.dark |
See reference/common-gotchas.md for complete troubleshooting guide.
All templates are available in the templates/ directory:
cn() utility for class mergingCopy these files to your project and customize as needed.
@tailwindcss/vite installed (NOT postcss)vite.config.ts uses tailwindcss() plugintsconfig.json has path aliases configuredcomponents.json exists with "config": ""tailwind.config.ts file existssrc/index.css follows v4 pattern::root and .dark at root level (not in @layer)hsl()@theme inline maps all variables@layer base uses unwrapped variablesAdd new semantic colors:
:root {
--brand: hsl(280 65% 60%);
--brand-foreground: hsl(0 0% 100%);
}
.dark {
--brand: hsl(280 75% 70%);
--brand-foreground: hsl(280 20% 10%);
}
@theme inline {
--color-brand: var(--brand);
--color-brand-foreground: var(--brand-foreground);
}Usage: <div className="bg-brand text-brand-foreground">Branded</div>
See reference/migration-guide.md for complete v3 → v4 migration steps.
<Button variant="destructive">Delete</Button> /* ✅ */
<Button className="bg-red-600">Delete</Button> /* ❌ */ import { cn } from "@/lib/utils"
<div className={cn(
"base-class",
isActive && "active-class",
hasError && "error-class"
)} /> <Dialog>
<DialogTrigger asChild>
<Button>Open</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Title</DialogTitle>
</DialogHeader>
</DialogContent>
</Dialog>{
"dependencies": {
"tailwindcss": "^4.1.14",
"@tailwindcss/vite": "^4.1.14",
"clsx": "^2.1.1",
"tailwind-merge": "^3.3.1",
"@radix-ui/react-*": "latest",
"lucide-react": "^0.545.0",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"@types/node": "^24.0.0",
"@vitejs/plugin-react": "^5.0.4",
"vite": "^7.0.0",
"typescript": "~5.9.0"
}
}# These packages will cause build errors:
npm install tailwindcss-animate # ❌ Deprecated
npm install tw-animate-css # ❌ Doesn't existIf you see import errors for these packages, remove them and use native CSS animations or @tailwindcss/motion instead.
Tailwind v4 supports official plugins using the @plugin directive in CSS.
#### Typography Plugin - Style Markdown/CMS Content
When to use: Displaying blog posts, documentation, or any HTML from Markdown/CMS.
Installation:
pnpm add -D @tailwindcss/typographyConfiguration (v4 syntax):
/* src/index.css */
@import "tailwindcss";
@plugin "@tailwindcss/typography";Usage:
<article class="prose lg:prose-xl dark:prose-invert">
{{ markdown_content }}
</article>Available classes:
prose - Base typography stylesprose-sm, prose-base, prose-lg, prose-xl, prose-2xl - Size variantsdark:prose-invert - Dark mode styles#### Forms Plugin - Reset Form Element Styles
When to use: Building custom forms without shadcn/ui components, or need consistent cross-browser form styling.
Installation:
pnpm add -D @tailwindcss/formsConfiguration (v4 syntax):
/* src/index.css */
@import "tailwindcss";
@plugin "@tailwindcss/forms";What it does:
Note: Less critical for shadcn/ui users (they have pre-styled form components), but still useful for basic forms.
These errors happen when using v3 syntax in v4 projects:
❌ WRONG (v3 config file syntax):
// tailwind.config.js
module.exports = {
plugins: [require('@tailwindcss/typography')]
}❌ WRONG (@import instead of @plugin):
@import "@tailwindcss/typography"; /* Doesn't work */✅ CORRECT (v4 @plugin directive):
/* src/index.css */
@import "tailwindcss";
@plugin "@tailwindcss/typography";
@plugin "@tailwindcss/forms";Container queries are built into Tailwind v4 core - no plugin needed:
<div className="@container">
<div className="@md:text-lg">
Responds to container width, not viewport
</div>
</div>❌ Don't install: @tailwindcss/container-queries (deprecated, now core feature)
For deeper understanding, see:
This skill is based on the WordPress Auditor project:
All patterns in this skill have been validated in production.
Questions? Issues?
reference/common-gotchas.md firstcomponents.json has "config": ""tailwind.config.ts if it exists~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.