tailwind-v4-shadcn▌
jezweb/claude-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Tailwind v4 with shadcn/ui using CSS variables and @theme inline pattern.
- ›Four-step architecture: define CSS variables at root, map to Tailwind utilities with @theme inline , apply base styles, automatic dark mode switching
- ›Prevents 8 documented errors including color mapping failures, dark mode conflicts, @apply breaking changes, and v3 migration gotchas
- ›Requires @tailwindcss/vite plugin (not PostCSS), empty Tailwind config in components.json, and ThemeProvider wrapper for theme tog
Tailwind v4 + shadcn/ui Production Stack
Production-tested: WordPress Auditor (https://wordpress-auditor.webfonts.workers.dev) Last Updated: 2026-01-20 Versions: [email protected], @tailwindcss/[email protected] Status: Production Ready ✅
Quick Start (Follow This Exact Order)
# 1. Install dependencies
pnpm add tailwindcss @tailwindcss/vite
pnpm add -D @types/node tw-animate-css
pnpm dlx shadcn@latest init
# 2. Delete v3 config if exists
rm tailwind.config.ts # v4 doesn't use this file
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') } }
})
components.json (CRITICAL):
{
"tailwind": {
"config": "", // ← Empty for v4
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true
}
}
The Four-Step Architecture (MANDATORY)
Skipping steps will break your theme. Follow exactly:
Step 1: Define CSS Variables at Root
/* src/index.css */
@import "tailwindcss";
@import "tw-animate-css"; /* Required for shadcn/ui animations */
: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: Define at root level (NOT inside @layer base). Use hsl() wrapper.
Step 2: Map Variables to Tailwind Utilities
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-primary: var(--primary);
/* ... map ALL CSS variables */
}
Why: Generates utility classes (bg-background, text-primary). Without this, utilities won't exist.
Step 3: Apply Base Styles
@layer base {
body {
background-color: var(--background); /* NO hsl() wrapper here */
color: var(--foreground);
}
}
Critical: Reference variables directly. Never double-wrap: hsl(var(--background)).
Step 4: Result - Automatic Dark Mode
<div className="bg-background text-foreground">
{/* No dark: variants needed - theme switches automatically */}
</div>
Dark Mode Setup
1. Create ThemeProvider (see templates/theme-provider.tsx)
2. Wrap App:
// src/main.tsx
import { ThemeProvider } from '@/components/theme-provider'
ReactDOM.createRoot(document.getElementById('root')!).render(
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
<App />
</ThemeProvider>
)
3. Add Theme Toggle:
pnpm dlx shadcn@latest add dropdown-menu
See reference/dark-mode.md for ModeToggle component.
Critical Rules
✅ Always Do:
- Wrap colors with
hsl()in:root/.dark:--bg: hsl(0 0% 100%); - Use
@theme inlineto map all CSS variables - Set
"tailwind.config": ""in components.json - Delete
tailwind.config.tsif exists - Use
@tailwindcss/viteplugin (NOT PostCSS)
❌ Never Do:
- Put
:root/.darkinside@layer base(causes cascade issues) - Use
.dark { @theme { } }pattern (v4 doesn't support nested @theme) - Double-wrap colors:
hsl(var(--background)) - Use
tailwind.config.tsfor theme (v4 ignores it) - Use
@applydirective (deprecated in v4, see error #7) - Use
dark:variants for semantic colors (auto-handled) - Use
@applywith@layer baseor@layer componentsclasses (v4 breaking change - use@utilityinstead) | Source - Wrap ANY styles in
@layer basewithout understanding CSS layer ordering (see error #8) | Source
Common Errors & Solutions
This skill prevents 8 documented errors.
1. ❌ tw-animate-css Import Error
Error: "Cannot find module 'tailwindcss-animate'"
Cause: shadcn/ui deprecated tailwindcss-animate for v4.
Solution:
# ✅ DO
pnpm add -D tw-animate-css
# Add to src/index.css:
@import "tailwindcss";
@import "tw-animate-css";
# ❌ DON'T
npm install tailwindcss-animate # v3 only
2. ❌ Colors Not Working
Error: bg-primary doesn't apply styles
Cause: Missing @theme inline mapping
Solution:
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-primary: var(--primary);
/* ... map ALL CSS variables */
}
3. ❌ Dark Mode Not Switching
Error: Theme stays light/dark
Cause: Missing ThemeProvider
Solution:
- Create ThemeProvider (see
templates/theme-provider.tsx) - Wrap app in
main.tsx - Verify
.darkclass toggles on<html>element
4. ❌ Duplicate @layer base
Error: "Duplicate @layer base" in console
Cause: shadcn init adds @layer base - don't add another
Solution:
/* ✅ Correct - single @layer base */
@import "tailwindcss";
:root { --background: hsl(0 0% 100%); }
@theme inline { --color-background: var(--background); }
@layer base { body { background-color: var(--background); } }
5. ❌ Build Fails with tailwind.config.ts
Error: "Unexpected config file"
Cause: v4 doesn't use tailwind.config.ts (v3 legacy)
Solution:
rm tailwind.config.ts
v4 configuration happens in src/index.css using @theme directive.
6. ❌ @theme inline Breaks Dark Mode in Multi-Theme Setups
Error: Dark mode doesn't switch when using @theme inline with custom variants (e.g., data-mode="dark")
Source:
How to use tailwind-v4-shadcn on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add tailwind-v4-shadcn
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches tailwind-v4-shadcn from GitHub repository jezweb/claude-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate tailwind-v4-shadcn. Access the skill through slash commands (e.g., /tailwind-v4-shadcn) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.8★★★★★42 reviews- ★★★★★Ganesh Mohane· Dec 16, 2024
I recommend tailwind-v4-shadcn for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Meera Sharma· Dec 8, 2024
Useful defaults in tailwind-v4-shadcn — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Amina Reddy· Dec 8, 2024
We added tailwind-v4-shadcn from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Jin Singh· Dec 8, 2024
Solid pick for teams standardizing on skills: tailwind-v4-shadcn is focused, and the summary matches what you get after install.
- ★★★★★Amina Harris· Nov 27, 2024
tailwind-v4-shadcn has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Naina White· Nov 23, 2024
tailwind-v4-shadcn is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Rahul Santra· Nov 7, 2024
tailwind-v4-shadcn fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Pratham Ware· Oct 26, 2024
tailwind-v4-shadcn has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Amina Singh· Oct 18, 2024
tailwind-v4-shadcn fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Amina Sharma· Oct 14, 2024
tailwind-v4-shadcn reduced setup friction for our internal harness; good balance of opinion and flexibility.
showing 1-10 of 42