Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Define component variants with CVA. Use when creating variant-based components with Tailwind, building design system tokens, or managing complex conditional class names in React.
.claude/skills/terminalskills-class-variance-authority/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | 9% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 17% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 54% | 0% |
| case-19 | ✗→✓ | ▲ Improved | -11% | 0% |
CVA creates type-safe component variants with Tailwind. Define base styles, variants (size, color, state), compound variants, and defaults. Works with any framework. Powers the variant system in shadcn/ui.
typescript// components/button.tsx — Button with CVA variants import { cva, type VariantProps } from 'class-variance-authority' import { cn } from '@/lib/utils' const buttonVariants = cva( // Base styles — always applied '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-blue-600 text-white hover:bg-blue-700', secondary: 'bg-gray-100 text-gray-900 hover:bg-gray-200', destructive: 'bg-red-600 text-white hover:bg-red-700', outline: 'border border-gray-300 bg-transparent hover:bg-gray-50', ghost: 'hover:bg-gray-100', link: 'text-blue-600 underline-offset-4 hover:underline', }, size: { sm: 'h-8 px-3 text-xs', md: 'h-10 px-4 text-sm', lg: 'h-12 px-6 text-base', icon: 'h-10 w-10', }, }, compoundVariants: [ // Destructive + outline = red border { variant: 'outline', className: 'border-2' }, { variant: 'destructive', size: 'lg', className: 'text-lg font-bold' }, ], defaultVariants: { variant: 'default', size: 'md', }, } ) interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {} function Button({ className, variant, size, ...props }: ButtonProps) { return <button className={cn(buttonVariants({ variant, size }), className)} {...props} /> }
typescriptconst badgeVariants = cva( 'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold', { variants: { status: { active: 'bg-green-100 text-green-800', inactive: 'bg-gray-100 text-gray-600', warning: 'bg-yellow-100 text-yellow-800', error: 'bg-red-100 text-red-800', }, size: { sm: 'text-[10px] px-1.5 py-0', md: 'text-xs px-2.5 py-0.5', lg: 'text-sm px-3 py-1', }, }, defaultVariants: { status: 'active', size: 'md' }, } ) // Usage <Badge status="active">Online</Badge> <Badge status="error" size="sm">Failed</Badge>
cn() (clsx + tailwind-merge) for conditional classes.compoundVariants for combinations that need special treatment (e.g., destructive + outline).VariantProps<typeof variants> gives you TypeScript types for free.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 15,470 | 9,842 | -36% | 1 | 1 | 0% | 3,180 | 3,121 | -2% | 0 | 0 | — |
case-02 | pass→pass | 6,738 | 4,255 | -37% | 1 | 1 | 0% | 1,380 | 1,838 | +33% | 0 | 0 | — |
case-03 | pass→pass | 7,746 | 7,119 | -8% | 1 | 1 | 0% | 1,648 | 2,499 | +52% | 0 | 0 | — |
case-04 | pass→pass | 9,780 | 5,582 | -43% | 1 | 1 | 0% | 1,868 | 2,072 | +11% | 0 | 0 | — |
case-05 | pass→pass | 9,388 | 9,014 | -4% | 1 | 1 | 0% | 1,731 | 2,724 | +57% | 0 | 0 | — |
case-06 | pass→pass | 11,382 | 5,854 | -49% | 1 | 1 | 0% | 2,559 | 2,097 | -18% | 0 | 0 | — |
case-07 | pass→pass | 9,155 | 6,834 | -25% | 1 | 1 | 0% | 1,662 | 2,214 | +33% | 0 | 0 | — |
case-12 | pass→pass | 6,536 | 5,075 | -22% | 1 | 1 | 0% | 1,352 | 1,910 | +41% | 0 | 0 | — |
case-08 | fail→pass | 10,205 | 6,515 | -36% | 1 | 1 | 0% | 1,944 | 2,111 | +9% | 0 | 0 | — |
case-09 | pass→pass | 6,998 | 3,593 | -49% | 1 | 1 | 0% | 1,367 | 1,614 | +18% | 0 | 0 | — |
case-10 | pass→pass | 5,143 | 5,378 | +5% | 1 | 1 | 0% | 1,023 | 1,864 | +82% | 0 | 0 | — |
case-11 | pass→pass | 3,500 | 1,706 | -51% | 1 | 1 | 0% | 629 | 1,163 | +85% | 0 | 0 | — |
case-13 | pass→pass | 5,056 | 3,782 | -25% | 1 | 1 | 0% | 1,079 | 1,650 | +53% | 0 | 0 | — |
case-14 | fail→pass | 6,337 | 5,194 | -18% | 1 | 1 | 0% | 1,352 | 2,025 | +50% | 0 | 0 | — |
case-15 | pass→fail | 12,090 | 6,974 | -42% | 1 | 1 | 0% | 2,315 | 2,037 | -12% | 0 | 0 | — |
case-16 | fail→pass | 6,946 | 4,050 | -42% | 1 | 1 | 0% | 1,469 | 1,715 | +17% | 0 | 0 | — |
case-17 | pass→pass | 10,721 | 5,809 | -46% | 1 | 1 | 0% | 1,937 | 1,837 | -5% | 0 | 0 | — |
case-18 | fail→pass | 6,167 | 5,506 | -11% | 1 | 1 | 0% | 1,272 | 1,954 | +54% | 0 | 0 | — |
case-19 | fail→pass | 9,336 | 4,440 | -52% | 1 | 1 | 0% | 2,005 | 1,781 | -11% | 0 | 0 | — |
case-20 | pass→pass | 9,483 | 4,601 | -51% | 1 | 1 | 0% | 1,823 | 1,810 | -1% | 0 | 0 | — |
case-21 | pass→pass | 5,045 | 3,836 | -24% | 1 | 1 | 0% | 996 | 1,656 | +66% | 0 | 0 | — |
case-22 | pass→fail | 18,259 | 16,359 | -10% | 1 | 1 | 0% | 4,028 | 4,861 | +21% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.