design-system-components
Patterns for building design system components using Surface primitives, CVA variants, and consistent styling. Use when building reusable UI components that follow design token architecture. Triggers on Surface component, CVA, class-variance-authority, component variants, design tokens.
Best use case
design-system-components is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Patterns for building design system components using Surface primitives, CVA variants, and consistent styling. Use when building reusable UI components that follow design token architecture. Triggers on Surface component, CVA, class-variance-authority, component variants, design tokens.
Teams using design-system-components should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/design-system-components/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How design-system-components Compares
| Feature / Agent | design-system-components | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Patterns for building design system components using Surface primitives, CVA variants, and consistent styling. Use when building reusable UI components that follow design token architecture. Triggers on Surface component, CVA, class-variance-authority, component variants, design tokens.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Design System Components
Build reusable components that leverage design tokens with Surface primitives and CVA (class-variance-authority).
## Installation
### OpenClaw / Moltbot / Clawbot
```bash
npx clawhub@latest install design-system-components
```
---
## When to Use
- Building component libraries with design tokens
- Need variant-based styling (size, color, state)
- Creating layered UI with consistent surfaces
- Want type-safe component APIs
---
## Pattern 1: Surface Primitive
Single component for all layered surfaces:
```tsx
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '@/lib/utils';
const surfaceVariants = cva(
'rounded-lg backdrop-blur-sm transition-colors',
{
variants: {
layer: {
panel: 'bg-tone-cadet/40 border border-tone-jordy/10 shadow-card',
tile: 'bg-tone-midnight/60 border border-tone-jordy/5',
chip: 'bg-tone-cyan/10 border border-tone-cyan/20 rounded-full',
deep: 'bg-tone-void/80',
metric: 'bg-tone-cadet/20 border border-tone-jordy/8',
glass: 'bg-glass-bg backdrop-blur-lg border border-glass-border',
},
interactive: {
true: 'cursor-pointer hover:bg-tone-cadet/50 active:scale-[0.98]',
false: '',
},
glow: {
true: 'shadow-glow',
false: '',
},
},
defaultVariants: {
layer: 'tile',
interactive: false,
glow: false,
},
}
);
interface SurfaceProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof surfaceVariants> {}
export function Surface({
layer,
interactive,
glow,
className,
...props
}: SurfaceProps) {
return (
<div
className={cn(surfaceVariants({ layer, interactive, glow }), className)}
{...props}
/>
);
}
```
### Usage
```tsx
<Surface layer="panel" className="p-4">
<h2>Dashboard</h2>
</Surface>
<Surface layer="chip" interactive>
<span>Active</span>
</Surface>
<Surface layer="metric" glow>
<span className="text-2xl">$1,234.56</span>
</Surface>
```
---
## Pattern 2: CVA Button Variants
```tsx
const buttonVariants = cva(
'inline-flex items-center justify-center rounded-md font-medium transition-all focus-visible:outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50',
{
variants: {
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
ghost: 'hover:bg-accent hover:text-accent-foreground',
link: 'text-primary underline-offset-4 hover:underline',
cyber: 'bg-gradient-to-r from-tone-cadet to-tone-azure text-white border border-tone-cyan/30 shadow-glow hover:shadow-glow-lg',
},
size: {
default: 'h-10 px-4 py-2',
sm: 'h-9 rounded-md px-3',
lg: 'h-11 rounded-md px-8',
icon: 'h-10 w-10',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
},
}
);
```
---
## Pattern 3: Metric Display Component
```tsx
const metricVariants = cva(
'font-mono tabular-nums',
{
variants: {
size: {
lg: 'text-3xl font-bold tracking-tight',
md: 'text-xl font-semibold',
sm: 'text-base font-medium',
},
trend: {
positive: 'text-success',
negative: 'text-destructive',
neutral: 'text-foreground',
},
},
defaultVariants: {
size: 'md',
trend: 'neutral',
},
}
);
interface MetricProps extends VariantProps<typeof metricVariants> {
value: string | number;
label?: string;
prefix?: string;
suffix?: string;
}
export function Metric({
value,
label,
prefix = '',
suffix = '',
size,
trend,
}: MetricProps) {
return (
<div className="flex flex-col">
{label && (
<span className="text-xs uppercase tracking-wider text-muted-foreground mb-1">
{label}
</span>
)}
<span className={cn(metricVariants({ size, trend }))}>
{prefix}{value}{suffix}
</span>
</div>
);
}
```
---
## Pattern 4: Card with Header
```tsx
interface CardProps {
title?: string;
description?: string;
action?: React.ReactNode;
children: React.ReactNode;
}
export function Card({ title, description, action, children }: CardProps) {
return (
<Surface layer="panel" className="flex flex-col">
{(title || action) && (
<div className="flex items-center justify-between px-4 py-3 border-b border-tone-jordy/10">
<div>
{title && (
<h3 className="font-display text-sm font-medium">{title}</h3>
)}
{description && (
<p className="text-xs text-muted-foreground">{description}</p>
)}
</div>
{action}
</div>
)}
<div className="p-4">{children}</div>
</Surface>
);
}
```
---
## Pattern 5: Badge/Chip Variants
```tsx
const badgeVariants = cva(
'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors',
{
variants: {
variant: {
default: 'bg-primary/10 text-primary border border-primary/20',
success: 'bg-success/10 text-success border border-success/20',
warning: 'bg-warning/10 text-warning border border-warning/20',
destructive: 'bg-destructive/10 text-destructive border border-destructive/20',
outline: 'border border-input text-foreground',
},
},
defaultVariants: {
variant: 'default',
},
}
);
```
---
## Pattern 6: Composing Variants
Combine CVA with conditional classes:
```tsx
function StatusIndicator({
status,
size = 'md'
}: {
status: 'online' | 'offline' | 'away';
size?: 'sm' | 'md' | 'lg';
}) {
const sizeClasses = {
sm: 'size-2',
md: 'size-3',
lg: 'size-4',
};
const statusClasses = {
online: 'bg-success animate-pulse',
offline: 'bg-muted-foreground',
away: 'bg-warning',
};
return (
<span
className={cn(
'rounded-full',
sizeClasses[size],
statusClasses[status]
)}
/>
);
}
```
---
## Related Skills
- **Meta-skill:** [ai/skills/meta/design-system-creation/](../../meta/design-system-creation/) — Complete design system workflow
- [distinctive-design-systems](../distinctive-design-systems/) — Token architecture and aesthetic foundations
- [loading-state-patterns](../loading-state-patterns/) — Skeleton components for loading states
---
## NEVER Do
- **Build custom card containers** — Use Surface primitive
- **Hardcode colors in components** — Use design tokens
- **Skip variant types** — CVA provides type safety
- **Mix styling approaches** — Pick CVA or cn(), not random inline styles
- **Forget default variants** — Components should work without props
---
## Quick Reference
```tsx
// 1. Define variants with CVA
const variants = cva('base-classes', {
variants: {
size: { sm: '...', md: '...', lg: '...' },
color: { primary: '...', secondary: '...' },
},
defaultVariants: { size: 'md', color: 'primary' },
});
// 2. Type props from variants
interface Props extends VariantProps<typeof variants> {}
// 3. Apply in component
<div className={cn(variants({ size, color }), className)} />
```Related Skills
design-system-creation
Complete workflow for creating distinctive design systems from scratch. Orchestrates aesthetic documentation, token architecture, components, and motion. Use when starting a new design system or refactoring an existing one. Triggers on create design system, design tokens, design system setup, visual identity, theming.
tailwind-design-system
No description provided.
responsive-design
No description provided.
frontend-design
Create distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Focuses on creative direction and memorable design choices.
web-design
CSS implementation patterns for layout, typography, color, spacing, and responsive design. Complements ui-design (fundamentals) with code-focused examples.
ui-design
Comprehensive UI design skill covering fundamentals, patterns, and anti-patterns. Layout, typography, color, spacing, accessibility, motion, and component design. Use when building any web interface, reviewing design quality, or creating distinctive UIs.
distinctive-design-systems
Patterns for creating design systems with personality and distinctive aesthetics. Covers aesthetic documentation, color token architecture, typography systems, layered surfaces, and motion. Use when building design systems that go beyond generic templates. Triggers on design system, design tokens, aesthetic, color palette, typography, CSS variables, tailwind config.
design-system-patterns
Foundational design system architecture — token hierarchies, theming infrastructure, token pipelines, and governance. Use when creating design tokens, implementing theme switching, setting up Style Dictionary, or establishing multi-brand theming. Triggers on design tokens, theme provider, Style Dictionary, token pipeline, multi-brand theming, CSS custom properties architecture.
api-design-principles
No description provided.
api-design
REST and GraphQL API design principles — resource modeling, HTTP semantics, pagination, error handling, HATEOAS, schema design, and DataLoader patterns. Use when designing new APIs, reviewing specs, or establishing team API standards.
schema-markup
Add, fix, or optimize schema markup and structured data. Use when the user mentions schema markup, structured data, JSON-LD, rich snippets, schema.org, FAQ schema, product schema, review schema, or breadcrumb schema.
prompt-engineering
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production. Use when optimizing prompts, improving LLM outputs, designing production prompt templates, or building AI-powered features.