Token导航 LogoToken导航

Agent Skill · 前端设计

design-to-component-translator(设计到组件转换器)

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

design-to-component-translator 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 9,864。

总安装 192周安装 8GitHub Stars 2下载 64核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:design-to-component-translator(设计到组件转换器)
来源仓库:https://github.com/monkey1sai/openai-cli
仓库路径:skills/design-to-component-translator
安装命令:
npx skills add https://github.com/monkey1sai/openai-cli --skill design-to-component-translator
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/monkey1sai/openai-cli --skill design-to-component-translator

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

用于辅助界面设计、视觉规范和交互体验优化。design-to-component-translator 属于前端设计类 Skill,可作为该场景下的辅助能力补充。适合整理页面结构、生成 UI 方案或检查组件层级一致性。使用时需结合品牌规范与用户任务,避免堆砌装饰元素。

涉及页面改动时应通过截图或预览检查文本溢出与响应式表现。安装前建议确认权限范围及是否会触发文件读写操作。

来源仓库内路径:skills/design-to-component-translator

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/monkey1sai/openai-cli --skill design-to-compon…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

design-to-component-translator 怎么安装?

在终端执行 npx skills add https://github.com/monkey1sai/openai-cli --skill design-to-component-transl…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

design-to-component-translator 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

design-to-component-translator 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

design-to-component-translator 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

design-to-component-translator 用的人多吗?

公开数据是累计安装 192 次,近一周安装 8 次,下载 64 次,GitHub 2 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

design-to-component-translator 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
design-to-component-translator

设计到组件转换器 · 本页

1922只读未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Design-to-Component Translator

Convert design specifications into pixel-perfect, production-ready React components.

Core Workflow

  1. Analyze design specs: Extract spacing, colors, typography, dimensions
  2. Map to tokens: Convert design values to design system tokens
  3. Generate structure: Create semantic HTML structure
  4. Apply styles: Implement Tailwind/CSS with exact measurements
  5. Add states: Include hover, focus, active, disabled states
  6. Handle responsive: Implement breakpoint-specific rules
  7. Ensure accessibility: Add ARIA labels, keyboard navigation
  8. Document variants: List all visual states and props

Design Spec Analysis

Extract from Figma/Design

Spacing & Layout:

  • Padding: p-4 (16px), px-6 (24px horizontal)
  • Margin: m-2 (8px), mt-4 (16px top)
  • Gap: gap-3 (12px between flex items)
  • Width/Height: w-64 (256px), h-10 (40px)

Typography:

  • Font family: font-sans, font-mono
  • Font size: text-sm (14px), text-base (16px), text-lg (18px)
  • Font weight: font-normal (400), font-medium (500), font-semibold (600)
  • Line height: leading-tight, leading-normal, leading-relaxed
  • Letter spacing: tracking-tight, tracking-normal, tracking-wide

Colors:

  • Background: bg-blue-500, bg-gray-100
  • Text: text-gray-900, text-white
  • Border: border-gray-300, border-blue-600
  • Opacity: bg-opacity-50, text-opacity-75

Borders & Radius:

  • Border width: border, border-2, border-t-4
  • Border radius: rounded (4px), rounded-md (6px), rounded-lg (8px), rounded-full

Shadows:

  • shadow-sm, shadow, shadow-md, shadow-lg, shadow-xl

Design Token Mapping

Create Token System

// tokens.ts
export const tokens = {
  colors: {
    primary: {
      50: "#eff6ff",
      100: "#dbeafe",
      500: "#3b82f6",
      600: "#2563eb",
      700: "#1d4ed8",
    },
    gray: {
      100: "#f3f4f6",
      300: "#d1d5db",
      500: "#6b7280",
      700: "#374151",
      900: "#111827",
    },
  },
  spacing: {
    xs: "0.25rem", // 4px
    sm: "0.5rem", // 8px
    md: "1rem", // 16px
    lg: "1.5rem", // 24px
    xl: "2rem", // 32px
  },
  fontSize: {
    xs: ["0.75rem", { lineHeight: "1rem" }],
    sm: ["0.875rem", { lineHeight: "1.25rem" }],
    base: ["1rem", { lineHeight: "1.5rem" }],
    lg: ["1.125rem", { lineHeight: "1.75rem" }],
    xl: ["1.25rem", { lineHeight: "1.75rem" }],
  },
  borderRadius: {
    sm: "0.25rem", // 4px
    md: "0.375rem", // 6px
    lg: "0.5rem", // 8px
    full: "9999px",
  },
  shadows: {
    sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
    md: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
    lg: "0 10px 15px -3px rgb(0 0 0 / 0.1)",
  },
};

Tailwind Config

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: {
          50: "#eff6ff",
          100: "#dbeafe",
          500: "#3b82f6",
          600: "#2563eb",
          700: "#1d4ed8",
        },
      },
      spacing: {
        18: "4.5rem",
        88: "22rem",
      },
      fontSize: {
        "2xs": "0.625rem",
      },
    },
  },
};

Component Translation Examples

Button from Figma Spec

Figma Specs:

  • Height: 40px
  • Padding: 12px 24px
  • Border radius: 6px
  • Font: Inter Medium 14px
  • Background: #3B82F6
  • Text: #FFFFFF
  • Hover: #2563EB
  • Shadow: 0 1px 3px rgba(0,0,0,0.1)

Translated Component:

import { cn } from "@/lib/utils";

interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
  variant?: "primary" | "secondary";
  size?: "sm" | "md" | "lg";
}

export const Button = ({
  variant = "primary",
  size = "md",
  className,
  children,
  ...props
}: ButtonProps) => {
  return (
    <button
      className={cn(
        // Base styles
        "inline-flex items-center justify-center rounded-md font-medium",
        "transition-colors duration-200",
        "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2",
        "disabled:pointer-events-none disabled:opacity-50",
        // Variant: Primary (matches Figma)
        variant === "primary" && [
          "bg-primary-500 text-white shadow-sm",
          "hover:bg-primary-600",
          "active:bg-primary-700",
        ],
        // Size: Medium (40px height, 12px 24px padding)
        size === "md" && "h-10 px-6 text-sm",
        className
      )}
      {...props}
    >
      {children}
    </button>
  );
};

Card from Design Spec

Figma Specs:

  • Padding: 24px
  • Border radius: 12px
  • Background: #FFFFFF
  • Border: 1px solid #E5E7EB
  • Shadow: 0 1px 3px rgba(0,0,0,0.1)
  • Max width: 400px

Translated Component:

interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
  elevated?: boolean;
}

export const Card = ({
  elevated = false,
  className,
  children,
  ...props
}: CardProps) => {
  return (
    <div
      className={cn(
        // Base from Figma
        "max-w-sm rounded-xl bg-white p-6",
        "border border-gray-200",
        // Conditional shadow
        elevated ? "shadow-lg" : "shadow-sm",
        // Hover state (not in Figma, but good UX)
        "transition-shadow duration-200 hover:shadow-md",
        className
      )}
      {...props}
    >
      {children}
    </div>
  );
};

Interaction States

Hover States

// Figma: Background changes from #3B82F6 to #2563EB on hover
className={cn(
  'bg-primary-500',
  'hover:bg-primary-600',
  'transition-colors duration-200'
)}

Focus States

// Accessible focus ring
className={cn(
  'focus:outline-none',
  'focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2'
)}

Active/Pressed States

// Figma: Slightly darker on click
className={cn(
  'active:bg-primary-700',
  'active:scale-[0.98]', // Slight scale down
  'transition-all duration-100'
)}

Disabled States

// Figma: 50% opacity, no interactions
className={cn(
  'disabled:opacity-50',
  'disabled:cursor-not-allowed',
  'disabled:pointer-events-none'
)}

Responsive Design Translation

Breakpoint Mapping

// Figma artboards → Tailwind breakpoints
// Mobile (375px): default (no prefix)
// Tablet (768px): md:
// Desktop (1024px): lg:
// Wide (1280px): xl:

<div
  className={cn(
    // Mobile: Stack vertically, full width
    "flex flex-col gap-4 w-full",
    // Tablet: Side by side, 50% each
    "md:flex-row md:gap-6",
    // Desktop: Max width container
    "lg:max-w-6xl lg:mx-auto"
  )}
/>

Responsive Typography

// Figma mobile: 14px, desktop: 16px
<h1 className="text-sm md:text-base lg:text-lg font-semibold">
  Responsive Heading
</h1>

Responsive Spacing

// Figma mobile: 16px padding, desktop: 24px
<div className="p-4 md:p-6 lg:p-8">Content</div>

Design System Integration

Using shadcn/ui Patterns

// Leveraging shadcn's composable approach
import { cn } from "@/lib/utils";

const buttonVariants = cva(
  "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",
  {
    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 hover:bg-accent hover:text-accent-foreground",
        secondary:
          "bg-secondary text-secondary-foreground hover:bg-secondary/80",
        ghost: "hover:bg-accent hover:text-accent-foreground",
        link: "underline-offset-4 hover:underline text-primary",
      },
      size: {
        default: "h-10 py-2 px-4",
        sm: "h-9 px-3 rounded-md",
        lg: "h-11 px-8 rounded-md",
        icon: "h-10 w-10",
      },
    },
    defaultVariants: {
      variant: "default",
      size: "default",
    },
  }
);

Color System Translation

From Figma to CSS Variables

/* Figma colors → CSS variables */
:root {
  /* Primary from Figma #3B82F6 */
  --primary: 221 83% 60%;
  --primary-foreground: 0 0% 100%;

  /* Secondary from Figma #6B7280 */
  --secondary: 220 9% 46%;
  --secondary-foreground: 0 0% 100%;

  /* Backgrounds */
  --background: 0 0% 100%;
  --foreground: 222 47% 11%;

  /* Borders */
  --border: 220 13% 91%;
  --input: 220 13% 91%;
  --ring: 221 83% 60%;

  /* Radius from Figma */
  --radius: 0.5rem;
}

Using in Components

<div className="bg-background text-foreground border-border">
  <button className="bg-primary text-primary-foreground">Button</button>
</div>

Animation & Transitions

Micro-interactions from Figma

// Figma: Button scales slightly on hover
<button className={cn(
  'transition-all duration-200',
  'hover:scale-105',
  'active:scale-95'
)}>
  Hover me
</button>

// Figma: Card lifts on hover
<div className={cn(
  'transition-all duration-300',
  'hover:-translate-y-1 hover:shadow-lg'
)}>
  Card content
</div>

// Figma: Fade in on mount
<div className="animate-in fade-in duration-500">
  Fading content
</div>

Measurement Conversion

Figma Pixels → Tailwind Classes

FigmaTailwindValue
2px0.50.125rem
4px10.25rem
8px20.5rem
12px30.75rem
16px41rem
20px51.25rem
24px61.5rem
32px82rem
40px102.5rem
48px123rem

Custom Values

// Figma: 18px (not in default Tailwind)
<div className="w-[18px] h-[18px]">{/* or add to config */}</div>

Accessibility Mapping

From Visual Design to A11y

// Figma shows disabled state
<button
  disabled={isDisabled}
  aria-disabled={isDisabled}
  className={cn(
    isDisabled && 'opacity-50 cursor-not-allowed'
  )}
>
  Submit
</button>

// Figma shows error state
<input
  aria-invalid={hasError}
  aria-describedby={hasError ? 'error-message' : undefined}
  className={cn(
    hasError && 'border-red-500 focus:ring-red-500'
  )}
/>

Common Patterns

Form Input Translation

Figma Specs:

  • Height: 44px
  • Padding: 12px 16px
  • Border: 1px #D1D5DB
  • Border radius: 8px
  • Focus border: 2px #3B82F6
<input
  className={cn(
    "h-11 w-full rounded-lg border border-gray-300 px-4",
    "text-base text-gray-900 placeholder:text-gray-500",
    "focus:border-primary-500 focus:ring-2 focus:ring-primary-500 focus:ring-offset-0",
    "disabled:cursor-not-allowed disabled:opacity-50"
  )}
/>

Icon Button Translation

Figma Specs:

  • Size: 40x40px
  • Icon: 20x20px centered
  • Border radius: 8px
  • Background hover: #F3F4F6
<button
  className={cn(
    "flex h-10 w-10 items-center justify-center rounded-lg",
    "text-gray-700 transition-colors",
    "hover:bg-gray-100",
    "focus-visible:ring-2 focus-visible:ring-primary-500"
  )}
>
  <Icon className="h-5 w-5" />
</button>

Best Practices

  1. Measure twice: Verify all measurements match Figma exactly
  2. Use design tokens: Map to tokens, not hardcoded values
  3. All states: Include hover, focus, active, disabled, error
  4. Responsive: Implement all breakpoints from design
  5. Accessibility: Add ARIA where Figma shows states
  6. Animations: Match transition timings to design
  7. Dark mode: If designs exist, implement with class variants
  8. Component variants: Create reusable variant props
  9. Documentation: Note any deviations from design
  10. Review: Get designer approval on implementation

Output Checklist

Every design-to-component translation should include:

  • Exact spacing matching Figma measurements
  • Typography scales and weights
  • All color values from design system
  • Border radius and shadows
  • Hover state styling
  • Focus state styling (accessible)
  • Active/pressed state styling
  • Disabled state styling
  • Responsive breakpoint rules
  • Design token mapping documented
  • Accessibility attributes
  • Component variants for states

平台分布

Codex

36.21%
按下载量换算23

Claude

28.72%
按下载量换算18

Cursor

16.19%
按下载量换算10

Gemini CLI

9.12%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills