--- name: "Tailwind CSS Design System" description: "Build consistent, accessible UI components with Tailwind CSS, shadcn/ui, and custom design tokens. Apply when styling components, creating design systems, implementing responsive layouts, or optimizing CSS performance." allowed-tools: Read, Write, Edit version: 1.1.0 compatibility: Claude Opus 4.5, Claude Code v2.x updated: 2026-01-24 --- # Tailwind CSS Design System Systematic Tailwind CSS usage with component patterns, design tokens, and shadcn/ui integration. ## Overview This Skill enforces: - Utility-first CSS with Tailwind - Design tokens and custom configuration - Component composition patterns - shadcn/ui integration - Responsive design (mobile-first) - Dark mode support - Performance optimization Apply when styling components, building design systems, or implementing responsive layouts. ## Tailwind Configuration ### Custom Design Tokens ```ts // tailwind.config.ts import type { Config } from 'tailwindcss'; const config: Config = { content: [ './app/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}' ], theme: { extend: { colors: { primary: { 50: '#eff6ff', 100: '#dbeafe', 500: '#3b82f6', 600: '#2563eb', 900: '#1e3a8a' }, secondary: { 500: '#8b5cf6', 600: '#7c3aed' } }, spacing: { '18': '4.5rem', '22': '5.5rem' }, fontSize: { 'xs': '0.75rem', 'sm': '0.875rem', 'base': '1rem', 'lg': '1.125rem', 'xl': '1.25rem', '2xl': '1.5rem' }, fontFamily: { sans: ['Inter', 'system-ui', 'sans-serif'], mono: ['JetBrains Mono', 'monospace'] }, borderRadius: { 'none': '0', 'sm': '0.125rem', DEFAULT: '0.25rem', 'md': '0.375rem', 'lg': '0.5rem', 'xl': '0.75rem', 'full': '9999px' }, boxShadow: { 'sm': '0 1px 2px 0 rgba(0, 0, 0, 0.05)', DEFAULT: '0 1px 3px 0 rgba(0, 0, 0, 0.1)', 'md': '0 4px 6px -1px rgba(0, 0, 0, 0.1)', 'lg': '0 10px 15px -3px rgba(0, 0, 0, 0.1)', 'xl': '0 20px 25px -5px rgba(0, 0, 0, 0.1)', 'glass': '0 8px 32px 0 rgba(31, 38, 135, 0.37)' } } }, plugins: [ require('@tailwindcss/forms'), require('@tailwindcss/typography') ] }; export default config; ``` ## Component Patterns ### Button Component ```tsx // components/ui/Button.tsx import { cva, type VariantProps } from 'class-variance-authority'; import { cn } from '@/lib/utils'; const buttonVariants = cva( 'inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50', { variants: { variant: { default: 'bg-primary-600 text-white hover:bg-primary-700', secondary: 'bg-secondary-500 text-white hover:bg-secondary-600', outline: 'border border-gray-300 bg-transparent hover:bg-gray-100', ghost: 'hover:bg-gray-100', danger: 'bg-red-600 text-white hover:bg-red-700' }, size: { sm: 'h-9 px-3 text-sm', md: 'h-10 px-4 text-base', lg: 'h-11 px-8 text-lg', icon: 'h-10 w-10' } }, defaultVariants: { variant: 'default', size: 'md' } } ); interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { loading?: boolean; } export function Button({ className, variant, size, loading, disabled, children, ...props }: ButtonProps) { return ( ); } // Usage ``` ### Card Component ```tsx // components/ui/Card.tsx import { cn } from '@/lib/utils'; interface CardProps extends React.HTMLAttributes {} export function Card({ className, children, ...props }: CardProps) { return (
{children}
); } export function CardHeader({ className, children, ...props }: CardProps) { return (
{children}
); } export function CardTitle({ className, children, ...props }: CardProps) { return (

{children}

); } export function CardContent({ className, children, ...props }: CardProps) { return (
{children}
); } // Usage Title

Content goes here

``` ## Responsive Design (Mobile-First) ```tsx // ✅ GOOD: Mobile-first responsive design
Content
// ✅ GOOD: Responsive typography

Heading

// ✅ GOOD: Responsive padding
Content
``` ## Dark Mode Support ```tsx // tailwind.config.ts module.exports = { darkMode: 'class', // Use class-based dark mode // ... }; // Usage
Content
// Toggle dark mode 'use client'; import { useEffect, useState } from 'react'; export function ThemeToggle() { const [theme, setTheme] = useState('light'); useEffect(() => { const root = document.documentElement; root.classList.remove('light', 'dark'); root.classList.add(theme); localStorage.setItem('theme', theme); }, [theme]); return ( ); } ``` ## Glassmorphism Pattern ```tsx
Glass card content
// tailwind.config.ts boxShadow: { 'glass': '0 8px 32px 0 rgba(31, 38, 135, 0.37)' } ``` ## Form Components ```tsx // components/ui/Input.tsx import { cn } from '@/lib/utils'; interface InputProps extends React.InputHTMLAttributes { error?: string; } export function Input({ className, error, ...props }: InputProps) { return (
{error &&

{error}

}
); } // Usage ``` ## Layout Patterns ### Container ```tsx
Content
``` ### Grid ```tsx
Item 1
Item 2
Item 3
``` ### Flexbox ```tsx
Left Right
``` ## Performance Optimization ### Purge Unused Classes ```ts // tailwind.config.ts module.exports = { content: [ './app/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}' ], // Tailwind automatically purges unused classes in production }; ``` ### Use @layer for Custom CSS ```css /* app/globals.css */ @layer components { .btn-primary { @apply bg-primary-600 text-white px-4 py-2 rounded-md hover:bg-primary-700; } } ``` ## Anti-Patterns ```tsx // ❌ BAD: Inline styles instead of Tailwind
Content
// ✅ GOOD: Use Tailwind classes
Content
// ❌ BAD: Magic numbers
Content
// ✅ GOOD: Use spacing scale
Content
// ❌ BAD: Non-responsive
Content
// ✅ GOOD: Responsive
Content
// ❌ BAD: Desktop-first
Content
// ✅ GOOD: Mobile-first
Content
``` ## Utility Function ```ts // lib/utils.ts import { clsx, type ClassValue } from 'clsx'; import { twMerge } from 'tailwind-merge'; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } // Usage: Merge classes safely
Content
``` ## Verification Before Production - [ ] Tailwind configured with custom tokens - [ ] Mobile-first responsive design - [ ] Component variants defined with CVA - [ ] Dark mode support implemented - [ ] Forms accessible with labels - [ ] Performance optimized (purge enabled) - [ ] No inline styles (use Tailwind) - [ ] Consistent spacing scale used - [ ] Color contrast meets WCAG AA - [ ] Custom utilities documented ## Integration with Project Standards Enforces design consistency: - U-1: WCAG 2.1 AA compliant (color contrast) - Responsive design patterns - Component reusability - Performance optimization ## Resources - Tailwind CSS Docs: https://tailwindcss.com/docs - shadcn/ui: https://ui.shadcn.com - CVA (Class Variance Authority): https://cva.style --- **Last Updated:** January 24, 2026 **Compatibility:** Claude Opus 4.5, Claude Code v2.x **Status:** Production Ready > **January 2026 Update:** This skill is compatible with Claude Opus 4.5 and Claude Code v2.x. For complex tasks, use the `effort: high` parameter for thorough analysis.