--- name: design-system-modern-oklch description: Use when setting up modern UI design systems with OKLCH colors, Shadcn components, and Tailwind v4 - provides production-ready design tokens, component patterns, and complete setup for cutting-edge color science --- # Modern OKLCH Design System ## Overview Complete production-ready design system featuring OKLCH color space (perceptually uniform, superior to HSL/RGB), Shadcn UI components, CVA variants, custom shadows, and modern design patterns. **Core principle:** Use OKLCH for color accuracy, CVA for type-safe variants, data-slots for semantic components, and soft shadows for elevated design. ## When to Use Use this skill when users want to: - Set up a **modern design system** with **OKLCH colors** - Replicate **TLDW-style aesthetics** (soft, rounded, elevated) - Upgrade from **HSL/RGB to OKLCH** colors - Create **Shadcn components** with advanced design tokens - Implement **dark mode** with perceptually uniform colors - Build **Next.js/React projects** with production-ready UI ## When NOT to Use **NEVER use this skill for:** - Basic Tailwind setup without specific design system needs - Educational questions about OKLCH ("What is OKLCH?") - Generic styling questions ("How do I center a div?") - Non-React frameworks (Vue, Angular, Svelte) - Projects not using Tailwind CSS ## Quick Reference | Task | Command/Pattern | |------|----------------| | Install dependencies | `npm install @radix-ui/react-slot class-variance-authority clsx tailwind-merge lucide-react` | | Install Tailwind v4 | `npm install -D tailwindcss@4 @tailwindcss/postcss@4 tw-animate-css` | | Check word count | `wc -w app/globals.css` | | Verify OKLCH support | Check browser supports OKLCH (Chrome 111+, Safari 15.4+) | ## Essential Patterns ### 1. Complete globals.css Setup **Create or update `app/globals.css`:** ```css @import "tailwindcss"; @import "tw-animate-css"; @custom-variant dark (&:is(.dark *)); @theme inline { --color-background: var(--background); --color-foreground: var(--foreground); --color-primary: var(--primary); --color-primary-foreground: var(--primary-foreground); /* ... all color tokens ... */ --radius-sm: calc(var(--radius) - 4px); --radius-lg: var(--radius); --radius-xl: calc(var(--radius) + 4px); } :root { --radius: 1.25rem; --background: oklch(1 0 0); --foreground: oklch(0.145 0 0); --primary: oklch(0.205 0 0); --primary-foreground: oklch(0.985 0 0); /* ... complete light mode colors ... */ } .dark { --background: oklch(0.145 0 0); --foreground: oklch(0.985 0 0); --primary: oklch(0.922 0 0); /* ... complete dark mode colors ... */ } @layer base { html { font-size: 14.4px; /* 10% compact */ } body { @apply bg-background text-foreground; } } ``` **See [reference.md](reference.md) for complete globals.css template.** ### 2. Utility Functions **Create `lib/utils.ts`:** ```typescript import { clsx, type ClassValue } from "clsx" import { twMerge } from "tailwind-merge" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } ``` ### 3. Button Component with CVA **Create `components/ui/button.tsx`:** ```typescript import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/lib/utils" const buttonVariants = cva( "inline-flex items-center justify-center gap-2 rounded-2xl text-sm font-medium transition-all disabled:opacity-50", { variants: { variant: { default: "bg-primary text-primary-foreground shadow-[0px_0px_12px_0px_rgba(0,0,0,0.1)] hover:bg-primary/90", outline: "border bg-background hover:bg-accent" }, size: { default: "h-9 px-4 py-2", sm: "h-8 px-3", lg: "h-10 px-6" } }, defaultVariants: { variant: "default", size: "default" } } ) export function Button({ className, variant, size, ...props }) { return