cds-design-to-code

작성자: coinbase

이 스킬은 Figma 디자인을 높은 시각적 정확도로 CDS 기반 프로덕션 코드로 변환하는 구조화된 워크플로우를 제공합니다. Figma MCP 서버와 Coinbase Design System을 연결하여, 디자인이 원시 Figma HTML 출력이 아닌 실제 CDS 컴포넌트와 규칙을 사용하여 구현되도록 보장합니다.

npx skills add https://github.com/coinbase/cds --skill cds-design-to-code

CDS Design To Code

This skill provides a structured workflow for translating Figma designs into CDS-first production code with high visual fidelity. It bridges the Figma MCP server with the Coinbase Design System, ensuring that designs are implemented using real CDS components and conventions rather than raw Figma HTML output.

The goal is not to copy the Figma output literally. The goal is to use Figma MCP as the design source, then adapt that output into the target project's real CDS component stack.

When to use

  • Use when the user shares a Figma URL like figma.com/design/...?node-id=... and wants it implemented.
  • Use when translating a Figma design into CDS React or React Native code.
  • Use when the user asks to "implement this design" or "build this from Figma."
  • Do not use when there is no Figma design to reference -- use the cds-code skill instead for general CDS UI work.
  • Do not use for design feedback or critique without an implementation request.

Prerequisites

This skill is a thin bridge that leans on cds-code for all CDS component selection, styling, doc lookup, and code quality standards. Verify the following before starting.

  • Figma MCP server (required) -- must be connected and accessible. Verify by checking whether get_design_context is available as an MCP tool.

    Early exit: if the Figma MCP server is missing or get_design_context is not available, stop immediately. Tell the user that this workflow depends on the Figma MCP server and its get_design_context tool, suggest they configure a Figma MCP server in their project (e.g. via .cursor/mcp.json or their agent's MCP settings), then run this workflow again.

  • cds-code skill (strongly recommended) -- provides component selection, styling rules, doc lookup workflow, and code quality standards.

    If the cds-code skill is not available, do not exit. Instead, ask the user whether they want to proceed using only the Figma MCP server, explaining that the cds-code skill significantly improves the quality of the CDS code written (correct component selection, style props over inline styles, valid import paths). It is still possible to produce decent CDS code from Figma without it -- the skill only makes the output better. Proceed only if the user confirms; otherwise wait for them to install/enable cds-code.

  • cds-docs skill (recommended) -- provides CDS component documentation (routes, props, examples) used by the cds-code skill. If it is not available you may continue, but documentation greatly improves accuracy.

  • User must provide a Figma URL in the format: https://figma.com/design/:fileKey/:fileName?node-id=1-2

Required Workflow

Follow these steps in order. Do not skip steps.

Step 1: Optionally enable the cds-code skill

Start by grounding yourself in the current repo by enabling the cds-code skill.

Upon activation, the skill should provde you with information about which CDS NPM packages are installed. Use this to determine if you are working with cds-web or cds-mobile (a React or React Native project respectively).

If the cds-code skill is not available, and the user has opted out of enabling it, try your best to determine which CDS package is used by inspecting the project's source.

Do not infer the platform from the Figma designs alone -- the repo is the source of truth. If both web and mobile exist and the target is genuinely ambiguous, ask one concise clarifying question.

Step 2: Fetch Figma Design Context

Use Figma MCP's get_design_context tool with the extracted file key and node ID parameters. IMPORTANT: Set the clientFrameworks parameter to request the correct CDS code connect mappings. Many components in Figma maintain 2 mappings, one for cds-web and one for cds-mobile.

Always call get_design_context with disableCodeConnect: false so Code Connect context is used whenever it is available. Never set disableCodeConnect to true. Always keep screenshots enabled.

If Figma MCP prompts to create Code Connect mappings for unmapped components:

Designs will commonly contain components without Code Connect mappings -- either custom one-off components in the design file, or CDS components whose mappings have not been published yet. This is the expected common case, not an error.

When get_design_context returns a response indicating components are missing Code Connect mappings (e.g. a prompt like "Would you like to connect code components to the Figma design?"), do not surface this to the user and do not ask them about Code Connect mappings. Authoring .figma.ts Code Connect files is a CDS team responsibility, not something customers using this skill should do.

Instead, silently skip the prompt and immediately call get_design_context again with disableCodeConnect: false to get the best available context, then proceed with implementation. Treat unmapped components like any other fallback HTML/Tailwind output per the confidence matrix in Step 5.

If the response is too large or truncated:

  1. Keep the original user node as the source-of-truth entry point.
  2. Run get_metadata(fileKey=":fileKey", nodeId="1-2") to get the high-level node map and discover child node IDs.
  3. Identify the most relevant child frame or section for the requested implementation scope.
  4. Re-run get_design_context on the narrower child node.
  5. Tell the user briefly that you narrowed to a child section because the original node was too large.

Do not treat get_metadata as a replacement for get_design_context. It is only a way to navigate large trees when the initial node is too broad.

Staying narrow: Figma MCP becomes less helpful when the selected node contains many unrelated frames. Stay on the specific node the user provided, prefer a clearly scoped child frame over a giant parent screen if the tool becomes noisy, and keep Code Connect enabled. If the tool still reports many unmapped frames, check whether the returned screenshot and code are still actionable before bouncing the problem back to the user.

Step 3: Capture Visual Reference

Use Figma MCP's get_screenshot tool with the same file key and node ID.

Save this screenshot to a temporary, accessible location in the project and title it figma-visual-reference with whatever file extension the screenshot's format supports.

This screenshot is the visual source of truth throughout implementation. Keep it accessible for comparison during the visual verification step.

Step 4: Download Required Assets

Download any assets (images, icons, SVGs) returned by the Figma MCP server and save them to a temporary, accessible location in the project.

  • If the Figma MCP server returns a localhost source for an image or SVG, use that source directly.
  • Do not import or add new icon packages -- all assets should come from the Figma payload.
  • Do not create placeholders if a localhost source is provided.

Step 5: Write CDS Code

This is the core code generation step. Your goal is to take all of the information provided by Figma MCP and begin iterating towards a working solution in code that matches the visual design.

Understanding the requirements of the design and potentially even what CDS component should be used (thanks to Figma Code Connect mappings) follow the workflow outlined in cds-code to complete this step.

Interpretting get_design_context response

Note that the get_design_context response is a mixed-confidence input -- treat each part accordingly the matrix below.

Not every element in a design may have a Code Connect mapping. These elements will fall back to raw HTML or Tailwind classes.

SourceConfidenceHow to use
CodeConnectSnippetHighestPreserve the component choice. It maps to a real component chosen by the design system team. Keep the composition close to the snippet after fixing imports, props, and data wiring.
ScreenshotHighUse for layout hierarchy, spacing rhythm, and visual intent verification.
Default HTML / Tailwind classesLowerStructural hints that must be adapted into CDS components. Never ship raw Figma HTML in a CDS app.

Translating fallback HTML and Tailwind classes

When parts of the Figma response fall back to raw HTML or Tailwind-like classes, use them as evidence, not as the final implementation. Look for clues:

  • Layout classes like flex, flex-row, flex-col, items-start, justify-between
  • Spacing classes like gap-[8px], px-[var(--spacing/...)], pb-[16px]
  • Semantic names in data-name attributes like SectionHeader, List, Card, Row, Header
  • Repeated structures that imply a CDS collection or cell pattern

Translate those clues into CDS primitives and components:

  • flex-row -> HStack
  • flex-col -> VStack
  • Padding and gap values -> CDS spacing props or tokens, not raw Tailwind classes
  • data-name hints -> check CDS docs before inventing custom UI

Example: a fallback wrapper like flex flex-col gap-[8px] px-[8px] likely wants a VStack with gap and paddingX. A data-name="SectionHeader" is a strong signal to check whether CDS already has a SectionHeader component.

Do not guess the final component tree from CSS alone when CDS docs can confirm the intended abstraction.

Props before style:

Figma MCP output often includes raw CSS values for font size, weight, color, alignment, and transforms. Do not copy these into a style prop when the CDS component has a dedicated style prop -- map them to the matching CDS prop and token (e.g. font-size: 10px; font-weight: 500 becomes font="caption", color: var(--palette/foregroundmuted) becomes color="fgMuted", text-transform: uppercase becomes textTransform="uppercase"). Follow the cds-code skill's styling rules for the full mapping of CSS values to CDS props and tokens.

Step 6: Validate the Implementation

Validation happens in two phases. First confirm the code compiles and passes the project's own quality gates (Phase 1), then verify visual parity against the Figma design (Phase 2).

Do not skip Phase 1. Type errors almost always produce a blank or broken render, which makes visual verification useless and misleading. Catching an error at compile time is far cheaper than diagnosing a white page through browser tooling. Do not start the dev server or take screenshots until Phase 1 is clean.

Phase 1: Validate code quality and correctness

Before rendering anything, confirm the code compiles and passes the project's quality gates. Discover the project's commands rather than assuming a fixed toolchain -- different projects have different setups (a Vite app uses a different tsconfig than a Next.js monorepo; a project may use Biome instead of ESLint), and hardcoding a single command like tsc --noEmit is fragile.

  1. Detect the project's validation commands. Inspect package.json scripts for typecheck, check, lint, build, and format to learn what the project actually uses. Note which tools are present (eslint, prettier, biome, etc.) to know which linters and formatters apply.
  2. Find the correct tsconfig. Prefer project-specific tsconfig files (e.g. tsconfig.app.json, tsconfig.web.json) over the root. For composite projects -- a root tsconfig.json with only "references" and "files": [] -- always target the app-specific tsconfig directly. A root tsc --noEmit resolves references from cached .tsbuildinfo and can exit 0 while real source errors go undetected.
  3. Run validation in order:
    • Type check: prefer a project script like yarn typecheck or npm run check; fall back to tsc -p tsconfig.app.json --noEmit using the project-specific tsconfig you found.
    • Lint and format: if eslint, biome, prettier, or similar is present, run it on the changed files.
  4. Fix ALL errors before proceeding. Do not move on to Phase 2 with outstanding type, lint, or format errors.
  5. Do not start the dev server or take screenshots until this phase is clean.

Phase 2: Verify visual parity

Strive for high visual fidelity with the Figma design. Automated visual verification is opt-in -- it can require setting up tooling (e.g. a browser driver) and starting a dev server, so confirm with the user before proceeding. Run Phase 2 through the following sequence of operations in order.

1. Detect the environment and choose a verification strategy.

Inspect the project before deciding how to verify. Determine what visual verification tooling is already available rather than assuming a fixed approach:

  • Check package.json (dependencies, devDependencies, and scripts) and lockfiles for an already-installed browser-automation tool (e.g. Playwright, Cypress, Puppeteer).
  • Check whether such a tool is available globally or as a CLI on the system.
  • Consider lighter-weight options that need no install, such as native OS screen capture of the rendered app.

Pick the strategy that requires the least new setup. Examples, roughly in order of preference: an automation tool the project already depends on, a tool already installed globally, native screen capture, or installing a new tool only as a last resort.

2. Ask the user whether to perform automated visual validation.

Before doing any rendering or setup, ask the user if they would like you to perform automated visual validation. State the strategy you intend to use and what it involves (e.g. starting the dev server, capturing screenshots with the detected tool). Proceed with the automated flow only if the user agrees.

3. Ask permission before installing anything.

If the chosen strategy requires installing or setting up a tool that is not already present (for example, installing Playwright and its browsers), you must ask the user for explicit permission first, naming the tool and that it will be added to the project. Do not install tools without confirmation. If the user declines the install, fall back to a no-install strategy (native screen capture) or to the user-shared screenshot path below.

4. Run the verification loop.

Once a strategy is agreed upon:

  1. Render the target UI locally when possible.
  2. Use the Figma screenshot from Step 3 as the visual source of truth.
  3. Inspect the rendered implementation visually with the chosen tooling.
  4. Compare at a matching viewport as closely as possible.
  5. Fix the most obvious visual mismatches before finishing.

Fallback: If the user opts out of automated visual validation, declines a required install, or no inspection tooling is available, ask the user to take a screenshot of the rendered UI and share it with you so you can compare against the Figma design.

Pay special attention to:

  • Section widths and content stretch behavior
  • Spacing between nav, tabs, chips, cards, and footer
  • Corner radius, border, and shadow treatment
  • Typography hierarchy, truncation, and wrapping
  • Scroll containers, clipping, and overflow behavior
  • Active and inactive states for tabs, chips, and nav items
  • Colors matching design tokens exactly
  • Responsive behavior following Figma constraints

Prefer a short corrective loop: implement, visually compare, correct the largest differences, re-check once more.

Do not claim visual fidelity based only on reading code or DOM structure. Use the verification strategy the user agreed to, and fall back to the user-shared screenshot when automated inspection is unavailable or declined.

Final validation checklist

  • Type check passes against the correct project tsconfig
  • Lint and format pass on the changed files
  • (automated visual validation) Layout matches captured Figma screenshot (spacing, alignment, sizing)
  • (automated visual validation) Typography matches captured Figma screenshot (font, size, weight, line height)
  • (automated visual validation) Assets/images render correctly (no browser placeholder images)
  • No magic numbers/raw values - design tokens are used for spacing, color, radius, etc.
  • Majority (preferably most) of JSX written is CDS components
  • No raw HTML or Tailwind classes left in the final output
  • No inline style overrides for values that have a CDS style prop (font, color, textAlign, padding, gap, etc.)
  • Typical accessibility standards met

Common Issues and Solutions

Issue: Figma output is truncated

The design is too complex for a single response. Use get_metadata to get the node structure, then fetch specific child nodes individually with get_design_context.

Issue: Design doesn't match after implementation

Compare side-by-side with the screenshot from Step 3. Check spacing, colors, and typography values in the design context data. Run the corrective loop from Phase 2 of Step 6.

Issue: Assets not loading

Verify the Figma MCP server's assets endpoint is accessible. The server serves assets at localhost URLs -- use them directly without modification.

Issue: Code Connect returns unexpected components

The Code Connect snippet maps to a real component chosen by the design system team. Preserve it unless the target repo clearly documents a different import path. If the snippet already uses CDS components, it is often nearly copy-pasteable after fixing imports, props, and data wiring.

Issue: Mostly fallback HTML with few Code Connect mappings

This is normal for designs with many unmapped elements. Use the fallback HTML as structural evidence, translate layout classes to CDS primitives, and use data-name hints to look up CDS components before inventing custom markup.

Issue: Design token values differ between Figma and CDS

When CDS tokens differ from Figma values, prefer CDS tokens for consistency. Adjust spacing or sizing minimally to maintain visual fidelity.

Communication Style

Be concise and implementation-oriented.

  • Mention when the design source was high confidence versus inferred.
  • Call out when you preserved a Code Connect mapping directly.
  • If you had to infer a CDS replacement from fallback HTML, explain the reasoning briefly.
  • Ask clarifying questions only when the ambiguity would materially change the shipped UI.

Avoid turning the workflow into a long design critique unless the user asked for one.

coinbase의 다른 스킬

authenticate-wallet
coinbase
이메일 OTP 기반 지갑 인증으로 검증 및 상태 확인을 제공합니다. 2단계 로그인 절차: 이메일로 6자리 OTP를 받기 위해 시작한 후, flowId와 코드로 인증을 완료합니다. 명령어 실행 전 셸 인젝션을 방지하기 위해 이메일, flowId, OTP에 대한 입력 검증 규칙이 포함되어 있습니다. 동반 CLI 명령어를 통해 상태 확인, 잔액 조회, 주소 검색 및 지갑 창 접근을 제공합니다. 모든 명령어는 기계 판독 가능한 출력을 위해 --json을 지원합니다...
official
fund
coinbase
Coinbase Onramp 또는 직접 전송을 통해 USDC를 지갑에 입금합니다. 사용자가 사전 설정된 금액($10, $20, $50) 또는 사용자 지정 값을 선택하고 Apple Pay, 직불카드, 은행 송금 또는 Coinbase 계정 자금 조달 중에서 선택할 수 있는 보조 UI를 엽니다. 다양한 결제 수단을 지원하며 정산 시간이 다릅니다: 카드 및 Apple Pay는 즉시, ACH 은행 송금은 1~3일 소요됩니다. Base 네트워크에서 USDC로 자금을 입금하며, 또는 사용자는 npx [email protected]...을 통해 지갑 주소로 직접 USDC를 보낼 수 있습니다.
official
monetize-service
coinbase
x402 프로토콜을 통해 다른 에이전트가 발견하고 결제할 수 있는 유료 API 엔드포인트를 배포합니다. HTTP 402 결제 프로토콜을 사용하여 Base에서 요청당 USDC를 청구하며, 클라이언트는 서명된 트랜잭션으로 결제하고 API 키나 계정이 필요하지 않습니다. 검색 확장을 선언하면 엔드포인트를 x402 Bazaar에 자동으로 등록하여 에이전트가 발견할 수 있도록 합니다. Express 미들웨어를 사용하여 엔드포인트당 여러 가격 계층, 와일드카드 경로 및 여러 결제 옵션을 지원합니다. @x402/express 및 @x402/core 기반으로 구축되었습니다...
official
pay-for-service
coinbase
Base에서 x402 프로토콜을 통해 자동 USDC 결제로 유료 API를 호출합니다. x402 지원 엔드포인트에 HTTP 요청(GET, POST 등)을 실행하며, USDC 결제가 자동으로 처리됩니다. 메서드, JSON 본문, 쿼리 매개변수 및 사용자 정의 헤더를 통해 요청을 사용자 지정할 수 있습니다. 결제 제어 기능이 포함되어 있어 요청당 최대 USDC 금액을 설정하고 상관 ID로 관련 작업을 그룹화할 수 있습니다. 지갑 인증과 충분한 USDC 잔액이 필요하며, 셸을 방지하기 위해 모든 사용자 입력을 검증합니다...
official
query-blockchain-data
coinbase
Base에서 CDP SQL API를 통해 x402로 온체인 블록체인 데이터를 조회합니다. 사용자나 본인이 디코딩된 블록에 대한 온체인 정보를 확인하고자 할 때 사용하세요.
official
query-onchain-data
coinbase
Base에서 SQL을 사용하여 온체인 데이터를 쿼리하고, 쿼리당 x402 결제를 적용합니다. CoinbaseQL을 통해 디코딩된 이벤트, 트랜잭션 및 블록에 접근할 수 있습니다. CoinbaseQL은 조인, CTE, 서브쿼리 및 표준 함수를 지원하는 ClickHouse 기반 SQL 방언입니다. 세 가지 주요 테이블을 사용할 수 있습니다: base.events(디코딩된 스마트 컨트랙트 로그), base.transactions(전체 트랜잭션 데이터), base.blocks(블록 메타데이터). 이벤트 쿼리에서 전체 테이블 스캔을 피하기 위해 인덱싱된 필드(event_signature, address, block_timestamp)에 대한 필터링이 필요합니다.
official
search-for-service
coinbase
x402 바자 마켓플레이스에서 제공되는 유료 API 서비스를 검색하고 발견합니다. BM25 관련성 검색을 사용하여 마켓플레이스를 쿼리하고, 사용 가능한 모든 리소스를 나열하거나, 특정 엔드포인트를 검사하여 결제 없이 가격 및 결제 요구 사항을 확인할 수 있습니다. 네트워크(base, base-sepolia) 및 출력 형식(사람이 읽을 수 있는 형식 또는 JSON)별 필터링을 지원합니다. 결과는 로컬에 캐시되며 12시간마다 자동으로 새로고침됩니다. 검색 또는 발견 작업에 인증이 필요하지 않습니다. 아무것도 없을 때 대체 수단으로 사용하십시오.
official
send-usdc
coinbase
Base에서 USDC를 이더리움 주소나 ENS 이름으로 전송합니다. 수신자로 16진수 주소(0x...)와 ENS 이름(.eth)을 모두 지원하며 자동으로 ENS를 확인합니다. 유연한 금액 형식(달러 표기 $5.00, 소수점 1.50, 원자 단위 1000000)을 지원합니다. 전송 전에 authenticate-wallet 스킬을 통한 지갑 인증과 충분한 USDC 잔액이 필요합니다. 셸 인젝션을 방지하기 위한 입력 검증과 프로그래밍 사용을 위한 선택적 JSON 출력을 포함합니다.
official