Claude Skills Guide

Claude Code Figma to Tailwind Component Conversion

Converting Figma designs to Tailwind CSS components is a common but time-consuming task in modern web development. With Claude Code and the right MCP (Model Context Protocol) tools, you can automate much of this workflow and generate production-ready components from your design files.

Scope: This guide focuses on generating components that use Tailwind CSS utility classes — inline class names composed directly in JSX, with design tokens defined in tailwind.config.js. If your project uses CSS Modules or vanilla CSS for scoped styling instead, see the companion guide: Claude Code Figma to Code Component Workflow.

Prerequisites

Before starting, ensure you have:

Setting Up the Workflow

Claude Code can interact with Figma through various approaches. The most reliable method involves using the Figma MCP server or reading Figma export files directly.

Step 1: Connect Claude to Figma

First, install the Figma MCP server to enable Claude to read your design files:

npm install -g @anthropic-ai/figma-mcp-server

Configure your MCP settings to include Figma access:

{
  "mcpServers": {
    "figma": {
      "command": "npx",
      "args": ["-y", "@anthropic-ai/figma-mcp-server"],
      "env": {
        "FIGMA_ACCESS_TOKEN": "your-figma-personal-access-token"
      }
    }
  }
}

Step 2: Analyze Your Figma Design

Once connected, ask Claude to analyze your Figma file:

Can you read the Figma file "https://www.figma.com/file/xxx" and identify the main components, their properties, and styling details?

Claude will parse the design and provide a structured breakdown of:

Converting to Tailwind Components

Now that you have the design analysis, here’s how Claude converts each element to Tailwind:

Colors and Theme

Convert Figma color tokens to Tailwind’s configuration:

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: '#3B82F6',
        secondary: '#8B5CF6',
        success: '#10B981',
        surface: '#FFFFFF',
        background: '#F9FAFB',
        'text-primary': '#111827',
        'text-secondary': '#6B7280',
      },
      fontFamily: {
        sans: ['Inter', 'system-ui', 'sans-serif'],
      },
      borderRadius: {
        'card': '12px',
        'button': '8px',
      },
      spacing: {
        'card-padding': '24px',
        'section-gap': '32px',
      }
    }
  }
}

Component Example: Button

Let’s convert a Figma button design to Tailwind:

// Input: Figma button with primary-blue fill, 12px padding, 8px radius, white text
// Output: Tailwind component

export function PrimaryButton({ children, onClick, disabled = false }) {
  return (
    <button
      onClick={onClick}
      disabled={disabled}
      className={`
        px-4 py-3 
        bg-blue-600 
        text-white 
        font-medium 
        rounded-lg 
        hover:bg-blue-700 
        focus:outline-none 
        focus:ring-2 
        focus:ring-blue-500 
        focus:ring-offset-2 
        disabled:opacity-50 
        disabled:cursor-not-allowed 
        transition-colors 
        duration-200
      `}
    >
      {children}
    </button>
  );
}

Component Example: Card

A more complex card component with Figma-style properties:

export function FeatureCard({ title, description, icon, ctaText }) {
  return (
    <div className="
      p-6 
      bg-white 
      rounded-xl 
      shadow-sm 
      border border-gray-100 
      hover:shadow-md 
      transition-shadow 
      duration-200
    ">
      <div className="w-12 h-12 mb-4 bg-blue-50 rounded-lg flex items-center justify-center">
        <span className="text-blue-600">{icon}</span>
      </div>
      
      <h3 className="text-lg font-semibold text-gray-900 mb-2">
        {title}
      </h3>
      
      <p className="text-gray-600 mb-4 leading-relaxed">
        {description}
      </p>
      
      <a 
        href="#" 
        className="
          text-blue-600 
          font-medium 
          hover:text-blue-700 
          inline-flex 
          items-center 
          gap-1
        "
      >
        {ctaText}
        <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
          <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
        </svg>
      </a>
    </div>
  );
}

Advanced Conversion Techniques

Responsive Design Conversion

Claude can analyze Figma’s responsive variants and generate appropriate Tailwind classes:

Convert this Figma frame's responsive layout: desktop (grid 3-col), tablet (grid 2-col), mobile (stack)

Generates:

<div className="
  grid 
  grid-cols-1 
  md:grid-cols-2 
  lg:grid-cols-3 
  gap-6
">
  {/* Cards here */}
</div>

Using clsx for Variants

For complex component variants, Claude generates utility composition patterns:

import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';

function cn(...inputs) {
  return twMerge(clsx(inputs));
}

export function Button({ 
  variant = 'primary', 
  size = 'md', 
  children,
  className 
}) {
  const variants = {
    primary: 'bg-blue-600 text-white hover:bg-blue-700',
    secondary: 'bg-gray-100 text-gray-900 hover:bg-gray-200',
    ghost: 'bg-transparent text-gray-600 hover:bg-gray-100',
  };
  
  const sizes = {
    sm: 'px-3 py-1.5 text-sm',
    md: 'px-4 py-2',
    lg: 'px-6 py-3 text-lg',
  };
  
  return (
    <button className={cn(
      'rounded-lg font-medium transition-colors',
      variants[variant],
      sizes[size],
      className
    )}>
      {children}
    </button>
  );
}

Best Practices

  1. Extract to Design Tokens: Always convert repeated values to Tailwind config tokens
  2. Preserve Figma Hierarchy: Match Figma’s component structure in your code
  3. Add Interaction States: Include hover, focus, and disabled states from Figma
  4. Test Responsive Behavior: Verify the generated code matches Figma’s responsive variants

Conclusion

Claude Code dramatically accelerates Figma to Tailwind conversion by analyzing designs, generating component code, and creating proper configuration tokens. The key is setting up the MCP connection and providing Claude with structured design analysis. With this workflow, you can convert complex designs into clean, maintainable Tailwind components in minutes instead of hours.

The combination of Claude’s understanding of both design principles and Tailwind’s utility classes makes this workflow particularly powerful for development teams working with design-driven development processes.

Built by theluckystrike — More at zovo.one