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.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install design-system-components或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install design-system-components⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/design-system-components/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: design-system-components model: standard description: 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. ---
Build reusable components that leverage design tokens with Surface primitives and CVA (class-variance-authority).
---
---
Single component for all layered surfaces:
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}
/>
);
}
<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>
---
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',
},
}
);
---
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>
);
}
---
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>
);
}
---
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',
},
}
);
---
Combine CVA with conditional classes:
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]
)}
/>
);
}
---
---
---
// 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)} />安装 Design System Components 后,可以对 AI 说这些话来触发它
Help me get started with Design System Components
Explains what Design System Components does, walks through the setup, and runs a quick demo based on your current project
Use Design System Components to patterns for building design system components using Surface primit...
Invokes Design System Components with the right parameters and returns the result directly in the conversation
What can I do with Design System Components in my design & creative workflow?
Lists the top use cases for Design System Components, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/design-system-components/ 目录(个人级,所有项目可用),或 .claude/skills/design-system-components/(项目级)。重启 AI 客户端后,用 /design-system-components 主动调用,或让 AI 根据上下文自动发现并使用。
Design System Components 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
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.
Automate my design & creative tasks using Design System Components
Identifies repetitive steps in your workflow and sets up Design System Components to handle them automatically
Design System Components 属于「Design & Creative」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。