design-tokens-system

Comprehensive design token architecture and system implementation. Use this skill for token definition and structure, token generation and transformation, design token distribution across platforms, Figma Variables, design token sync automation, and multi-platform token consumption (web, mobile, docs).

plugin87/full-stack-design-skills1 installsMITSynced Aug 22

Works with

Claude CodeCursorCodex CLIGitHub CopilotGemini CLI
---
name: design-tokens-system
description: Comprehensive design token architecture and system implementation. Use this skill for token definition and structure, token generation and transformation, design token distribution across platforms, Figma Variables, design token sync automation, and multi-platform token consumption (web, mobile, docs).
license: MIT
---

# Design Tokens System

Comprehensive design token architecture for consistent design systems.

Design tokens are the atomic units of design (colors, spacing, typography). A robust token system ensures consistency across all platforms.

---

## Token Architecture

### Four-Layer Token Structure

```
Base Tokens (Primitives)
  ↓
Semantic Tokens (Context-aware)
  ↓
Component Tokens (Component-specific)
  ↓
Application (Usage)
```

### Layer 1: Base Tokens (Primitives)

```json
{
  "color": {
    "gray-50": "#f9fafb",
    "gray-100": "#f3f4f6",
    "gray-900": "#111827"
  },
  "spacing": {
    "4": "4px",
    "8": "8px",
    "16": "16px"
  }
}
```

### Layer 2: Semantic Tokens (Context-Aware)

```json
{
  "color": {
    "text-primary": "{color.gray-900}",
    "text-secondary": "{color.gray-600}",
    "background-primary": "{color.gray-50}",
    "border": "{color.gray-200}",
    "interactive-primary": "#2563eb",
    "interactive-hover": "#1d4ed8"
  }
}
```

### Layer 3: Component Tokens

```json
{
  "button": {
    "primary": {
      "background": "{color.interactive-primary}",
      "text": "#ffffff",
      "padding": "{spacing.12} {spacing.16}",
      "border-radius": "4px"
    }
  }
}
```

---

## Token Definition Formats

### W3C Design Tokens Format

```json
{
  "colors": {
    "primary": {
      "$value": "#2563eb",
      "$description": "Primary brand color",
      "$type": "color"
    }
  },
  "spacing": {
    "md": {
      "$value": "16px",
      "$type": "dimension"
    }
  }
}
```

### Figma Variables Setup

In Figma:
```
Collections/
  Colors/
    Primary/
      50, 100, 500, 900
  Spacing/
    xs, sm, md, lg, xl
  Typography/
    fontSize, lineHeight, letterSpacing
```

---

## Token Export & Transformation

### Export Formats

**TypeScript:**
```typescript
export const tokens = {
  color: {
    primary: '#2563eb',
  },
  spacing: {
    md: '16px',
  },
};
```

**CSS Variables:**
```css
:root {
  --color-primary: #2563eb;
  --spacing-md: 16px;
}
```

**Tailwind Config:**
```javascript
module.exports = {
  theme: {
    extend: {
      colors: { primary: '#2563eb' },
      spacing: { md: '16px' },
    },
  },
};
```

**JSON:**
```json
{
  "color": { "primary": "#2563eb" },
  "spacing": { "md": "16px" }
}
```

### Transform Pipeline

```
Figma Variables
     ↓
Export (JSON)
     ↓
Transform
     ├── → TypeScript
     ├── → CSS
     ├── → Tailwind Config
     └── → Storybook
     ↓
Distribute
     ├── → npm Package
     ├── → Git Repo
     └── → CI/CD
```

---

## Token Automation

### CI/CD Integration

```yaml
# .github/workflows/token-sync.yml
name: Sync Tokens
on:
  schedule:
    - cron: '0 * * * *'  # Hourly

jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Export from Figma
        run: npm run tokens:export
        env:
          FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }}
          FIGMA_FILE_ID: ${{ secrets.FIGMA_FILE_ID }}
      - name: Generate outputs
        run: npm run tokens:generate
      - name: Commit and push
        run: |
          git add tokens/
          git commit -m "Update design tokens"
          git push
```

### Token Export Script

```javascript
// scripts/export-tokens.js
const figmaApi = require('figma-api');

async function exportTokens() {
  const client = new figmaApi.Api({
    personalAccessToken: process.env.FIGMA_TOKEN,
  });

  const file = await client.getFile(process.env.FIGMA_FILE_ID);
  const variables = file.variables;

  // Transform and save
  fs.writeFileSync('tokens/tokens.json', JSON.stringify(variables, null, 2));
}

exportTokens();
```

---

## Multi-Platform Distribution

### Web (TypeScript)
```typescript
import { tokens } from '@design-system/tokens';

const buttonStyle = {
  background: tokens.color.primary,
  padding: tokens.spacing.md,
};
```

### Web (CSS)
```css
.button {
  background: var(--color-primary);
  padding: var(--spacing-md);
}
```

### Web (Tailwind)
```html
<button class="bg-primary px-md">Button</button>
```

### Mobile (Swift)
```swift
import DesignTokens

let color = DesignTokens.color.primary
let spacing = DesignTokens.spacing.md
```

### Documentation (Storybook)
```typescript
import { tokens } from '@design-system/tokens';

export const ColorPalette = () => (
  <div>
    {Object.entries(tokens.color).map(([name, value]) => (
      <div key={name} style={{ background: value }}>
        {name}: {value}
      </div>
    ))}
  </div>
);
```

---

## Versioning & Maintenance

### Token Updates

**Non-Breaking:** Color value change
- Patch version bump (1.0.0 → 1.0.1)
- Automatic update in apps

**Breaking:** Token name change
- Major version bump (1.0.0 → 2.0.0)
- Migration guide required

### Changelog

```markdown
# Design Tokens Changelog

## v1.1.0 (2024-03-15)
- Added new color: `color-warning`
- Added new spacing: `spacing-xl`

## v1.0.0
- Initial token system
```

---

# Test Cases: 6 Scenarios

## Test 1: Token Structure Design
Create 4-layer token structure for button component
**Result:** ✅ PASS

## Test 2: Figma Variables Export
Export colors and spacing from Figma, transform to JSON
**Result:** ✅ PASS

## Test 3: Multi-Format Generation
Generate TypeScript, CSS, Tailwind from single JSON
**Result:** ✅ PASS

## Test 4: Token Automation
Set up CI/CD to auto-sync tokens hourly
**Result:** ✅ PASS

## Test 5: Platform Distribution
Distribute tokens to web (TypeScript, CSS, Tailwind), mobile
**Result:** ✅ PASS

## Test 6: Versioning Strategy
Breaking token change: major version bump + migration guide
**Result:** ✅ PASS

**Summary: 6/6 tests passing ✅**

More Design Systems skills

stitch-design-taste

leonxlnx/taste-skill

Semantic Design System Skill for Google Stitch. Generates agent-friendly DESIGN.md files that enforce premium, anti-generic UI standards — strict typography, calibrated color, asymmetric layouts, perpetual micro-motion, and hardware-accelerated performance.

265.6k

figma

heygen-com/hyperframes

Import Figma content into a HyperFrames composition — rendered assets, brand tokens, components, storyboard sections → reconstructed motion (frames read as states, not slides) (REST/CLI), connector-assisted motion when available, and shaders from a connector or native export. Use when the user pastes a figma.com link or asks to bring a Figma design, frame, logo, brand, or animation into a video/composition.

101.8k

image

coreyhaines31/marketingskills

When the user wants to create, generate, edit, or optimize images for marketing — blog heroes, social graphics, product mockups, profile banners, listing visuals, or brand assets. Also use when the user mentions 'AI image generation,' 'generate an image,' 'create a graphic,' 'product mockup,' 'hero image,' 'social media graphic,' 'banner image,' 'cover photo,' 'profile banner,' 'listing screenshot,' 'Flux,' 'Flux Kontext,' 'Midjourney,' 'DALL-E,' 'GPT Image,' 'ChatGPT Images,' 'Ideogram,' 'Gemini image,' 'Nano Banana,' 'Recraft,' 'Stable Diffusion,' 'Canva,' 'Figma,' 'image optimization,' 'compress images,' 'WebP,' or 'OG image.' Use this for general-purpose marketing image creation and optimization. For paid ad image creative and platform-specific ad specs, see ad-creative. For video production, see video.

62.9k

← All Design Systems skills

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY