npx skills add ...
npx skills add secondsky/claude-skills --skill tailwind-v4-shadcn
npx skills add secondsky/claude-skills --skill tailwind-v4-shadcn
Production-tested: WordPress Auditor (https://wordpress-auditor.webfonts.workers.dev) Last Updated: 2025-12-04 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.
This pattern is mandatory - skipping steps will break your theme.
Critical Rules:
@layer base)hsl() wrapper on all color values.dark for dark mode (NOT .dark { @theme { } })Why This Is Required:
bg-background, text-primary)bg-primary etc. won't existCritical Rules:
var(--background)hsl(var(--background))See reference/dark-mode.md for full implementation or use template:
See reference/dark-mode.md for ModeToggle component code.
Wrap color values with hsl() in :root and .dark
Use @theme inline to map all CSS variables
Set "tailwind.config": "" in components.json
Delete tailwind.config.ts if it exists
Use @tailwindcss/vite plugin (NOT PostCSS)
Use cn() for conditional classes
Put :root or .dark inside @layer base
Use .dark { @theme { } } pattern
Double-wrap colors
Use tailwind.config.ts for theme colors
Use @apply directive (deprecated in v4)
Use dark: variants for semantic colors
Always use semantic names for colors:
Usage:
| 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 variablesLoad references/advanced-usage.md for advanced patterns including:
references/migration-guide.md for complete guideQuick Example:
Usage: <div className="bg-brand">Branded</div>
For detailed patterns and component composition examples, load references/advanced-usage.md.
If 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.
Quick Example:
Common Error:
❌ WRONG: @import "@tailwindcss/typography" (doesn't work)
✅ CORRECT: @plugin "@tailwindcss/typography" (use @plugin directive)
Built-in Features: Container queries are now core (no @tailwindcss/container-queries plugin needed).
Load references/plugins-reference.md for complete documentation including Typography plugin (prose classes), Forms plugin, installation steps, and common plugin errors.
For deeper understanding, see:
Load reference files based on user's specific needs:
references/common-gotchas.md when:references/dark-mode.md when:references/migration-guide.md when:references/plugins-reference.md when:references/advanced-usage.md when:When installing Tailwind and shadcn/ui packages, follow supply chain security best practices:
npm config set ignore-scripts true (or Bun: disabled by default)socket package score npm <pkg> or use socket npm install <pkg> to check packagesLoad the dependency-upgrade skill for full security configuration including Socket CLI integration, cooldown setup, lockfile validation, and CI enforcement.
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