tailwind-v4-shadcn

secondsky/claude-skills · updated May 20, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/secondsky/claude-skills --skill tailwind-v4-shadcn
0 commentsdiscussion
summary

Production-ready setup for Tailwind CSS v4 with shadcn/ui, dark mode, and CSS variable architecture.

  • Four-step architecture: define CSS variables at root level with hsl() wrapper, map to Tailwind utilities via @theme inline , apply base styles, and enable automatic dark mode switching
  • Vite plugin-based configuration (no PostCSS or tailwind.config.ts needed); requires @tailwindcss/vite and empty \"config\" in components.json
  • Semantic color tokens for destructive, success, warning, and
skill.md

Tailwind v4 + shadcn/ui Production Stack

Production-tested: WordPress Auditor (https://wordpress-auditor.webfonts.workers.dev) Last Updated: 2025-12-04 Status: Production Ready ✅

Table of Contents

  1. Before You Start
  2. Quick Start
  3. Four-Step Architecture
  4. Dark Mode Setup
  5. Critical Rules
  6. Semantic Color Tokens
  7. Common Issues & Fixes
  8. File Templates
  9. Setup Checklist
  10. Advanced Topics
  11. Dependencies
  12. Tailwind v4 Plugins
  13. Reference Documentation
  14. When to Load References

⚠️ BEFORE YOU START (READ THIS!)

CRITICAL FOR AI AGENTS: If you're Claude Code helping a user set up Tailwind v4:

  1. Explicitly state you're using this skill at the start of the conversation
  2. Reference patterns from the skill rather than general knowledge
  3. Prevent known issues listed in reference/common-gotchas.md
  4. Don't guess - if unsure, check the skill documentation

USER 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"

Why This Matters (Real-World Results)

Without skill activation:

  • ❌ Setup time: ~5 minutes
  • ❌ Errors encountered: 2-3 (tw-animate-css, duplicate @layer base)
  • ❌ Manual fixes needed: 2+ commits
  • ❌ Token usage: ~65k
  • ❌ User confidence: Required debugging

With skill activation:

  • ✅ Setup time: ~1 minute
  • ✅ Errors encountered: 0
  • ✅ Manual fixes needed: 0
  • ✅ Token usage: ~20k (70% reduction)
  • ✅ User confidence: Instant success

Known Issues This Skill Prevents

  1. tw-animate-css import error (deprecated in v4)
  2. Duplicate @layer base blocks (shadcn init adds its own)
  3. Wrong template selection (vanilla TS vs React)
  4. Missing post-init cleanup (incompatible CSS rules)
  5. Wrong plugin syntax (using @import or require() instead of @plugin directive)

All of these are handled automatically when the skill is active.


Quick Start (5 Minutes - Follow This Exact Order)

1. Install Dependencies

bun add tailwindcss @tailwindcss/vite
# or: npm install tailwindcss @tailwindcss/vite

bun add -d @types/node

# Note: Using pnpm for shadcn init due to known Bun compatibility issues
# (bunx has "Script not found" and postinstall/msw problems)
pnpm dlx shadcn@latest init

2. Configure Vite

// 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')
    }
  }
})

3. Update components.json

{
  "tailwind": {
    "config": "",              // ← CRITICAL: Empty for v4
    "css": "src/index.css",
    "cssVariables": true
  }
}

4. Delete tailwind.config.ts

rm tailwind.config.ts  # v4 doesn't use this file

The Four-Step Architecture (CRITICAL)

This pattern is mandatory - skipping steps will break your theme.

Step 1: Define CSS Variables at Root Level

/* 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:

  • ✅ Define at root level (NOT inside @layer base)
  • ✅ Use hsl() wrapper on all color values
  • ✅ Use .dark for dark mode (NOT .dark { @theme { } })

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 This Is Required:

  • Generates utility classes (bg-background, text-primary)
  • Without this, bg-primary etc. won't exist

Step 3: Apply Base Styles

@layer base {
  body {
    background-color: var(--background);  /* NO hsl() here */
    color: var(--foreground);
  }
}

Critical Rules:

  • ✅ Reference variables directly: var(--background)
  • ❌ 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 reference/dark-mode.md for full implementation or use template:

// Copy from: templates/theme-provider.tsx

2. Wrap Your App

// 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>,
)

3. Add Theme Toggle

pnpm dlx shadcn@latest add dropdown-menu

See reference/dark-mode.md for ModeToggle component code.


Critical Rules (MUST FOLLOW)

✅ Always Do:

  1. Wrap color values with hsl() in :root and .dark

    --background: hsl(0 0% 100%);  /* ✅ Correct */
    
  2. Use @theme inline to map all CSS variables

    @theme inline {
      --color-background: var(--background);
    }
    
  3. Set "tailwind.config": "" in components.json

    { "tailwind": { "config": "" } }
    
  4. Delete tailwind.config.ts if it exists

  5. Use @tailwindcss/vite plugin (NOT PostCSS)

  6. Use cn() for conditional classes

    import { cn } from "@/lib/utils"
    <div className={cn("base", isActive && "active")} />
    

❌ Never Do:

  1. Put :root or .dark inside @layer base

    /* WRONG */
    @layer base {
      
how to use tailwind-v4-shadcn

How to use tailwind-v4-shadcn on Cursor

AI-first code editor with Composer

1

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
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/secondsky/claude-skills --skill tailwind-v4-shadcn

The skills CLI fetches tailwind-v4-shadcn from GitHub repository secondsky/claude-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/tailwind-v4-shadcn

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

GET_STARTED →

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. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 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

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.762 reviews
  • Chaitanya Patil· Dec 28, 2024

    Useful defaults in tailwind-v4-shadcn — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Sakura Jackson· Dec 24, 2024

    tailwind-v4-shadcn is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Hana Dixit· Dec 16, 2024

    tailwind-v4-shadcn fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Piyush G· Nov 19, 2024

    tailwind-v4-shadcn is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Anika Srinivasan· Nov 19, 2024

    Solid pick for teams standardizing on skills: tailwind-v4-shadcn is focused, and the summary matches what you get after install.

  • Noah Lopez· Nov 15, 2024

    Useful defaults in tailwind-v4-shadcn — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Hana Yang· Nov 7, 2024

    Registry listing for tailwind-v4-shadcn matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Anaya Taylor· Nov 3, 2024

    tailwind-v4-shadcn is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Soo Gill· Oct 26, 2024

    tailwind-v4-shadcn reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Anika Iyer· Oct 22, 2024

    Keeps context tight: tailwind-v4-shadcn is the kind of skill you can hand to a new teammate without a long onboarding doc.

showing 1-10 of 62

1 / 7