本文へ移動
cccskills
無料GitHub で公開

extract-design-system

Reverse-engineer a design system from a live website (public URL or localhost). Extracts colors, typography, spacing, shadows, radii, breakpoints, and component patterns using a headed Playwright browser. Captures screenshots of pages, components, and interactive states at real device resolutions. Produces structured design tokens and optionally seeds a Penpot project. **Triggers — use this skill when:** - User says "extract design system from [url]" - User asks to "reverse-engineer the styles from [site]" - User says "build a design system based on [website]" - User asks to "pull the design tokens from [url]" - User says "analyze the design of [site]" - User asks to "import styles from [website] into Penpot" - User points at a URL and asks about its colors, fonts, spacing, or components

インストール方法を見る

含まれるファイル(2)

  • SKILL.md8.0 KB
  • scripts/extract.mjs21.3 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Extract Design System from Website

Reverse-engineer a complete design system from a live website using two passes:

  1. CSS source analysis — fetch and parse stylesheets for declared values
  2. Headed Playwright extraction — visually browse the site, interact with elements, extract computed styles, and capture screenshots at real device resolutions

Prerequisites

  • Playwright installed (npx playwright install chromium if not set up)
  • web_fetch tool for fetching raw HTML/CSS source

Quick Start

Run the extraction script against the target URL:

node scripts/extract.mjs <url> [outDir] [subpage1,subpage2,...]

Examples:

node scripts/extract.mjs https://example.com
node scripts/extract.mjs https://example.com ./my-tokens "/about,/pricing,/docs"
node scripts/extract.mjs http://localhost:3000 extracted "/dashboard,/settings"

The script opens a visible browser (headless: false) so you can watch the extraction. It uses real device profiles for accurate screenshots:

BreakpointDeviceViewportDPRReal image size
MobileiPhone 15393×6593x1179×1977
TabletiPad Pro 11834×11942x1668×2388
Desktop—1440×9002x2880×1800
Wide—1920×10802x3840×2160

Mobile and tablet use Playwright's built-in device descriptors (correct UA, isMobile, hasTouch) so sites serving different layouts render correctly.

Output Structure

{outDir}/
├── screenshots/
│   ├── pages/               — full-page at 4 breakpoints × each page
│   │   ├── home-mobile.png
│   │   ├── home-desktop.png
│   │   ├── home-dark-mode.png
│   │   └── ...
│   └── components/          — isolated component + hover/focus states
│       ├── nav.png
│       ├── button-primary.png
│       ├── button-primary-hover.png
│       ├── button-primary-focus.png
│       ├── nav-mobile-open.png
│       └── ...
└── raw/
    ├── colors.json          — CSS custom properties + computed colors
    ├── colors-dark.json     — dark mode variables (if detected)
    ├── typography.json      — font families, type styles, @font-face
    ├── spacing.json         — spacing, radii, shadows, borders, max-widths
    └── components.json      — component manifest + responsive layout data

Workflow

Step 1: Run the Extraction Script

node scripts/extract.mjs "TARGET_URL" "extracted-design-system" "/about,/pricing"

The script automatically:

  • Extracts CSS custom properties and computed colors from 800 sampled elements
  • Captures typography from all semantic elements (h1-h6, p, a, button, etc.)
  • Measures spacing, radii, shadows, and borders
  • Screenshots every page at 4 breakpoints with real device contexts
  • Isolates and screenshots 17 common component types
  • Captures hover and focus states on interactive elements
  • Tests mobile nav by clicking hamburger-like buttons at iPhone viewport
  • Detects dark mode via prefers-color-scheme emulation and toggle sniffing

Step 2: CSS Source Analysis (supplementary)

The script captures computed values. This step catches declared values from CSS source that may not be active on the current page:

# Fetch stylesheets identified in the HTML
web_fetch <stylesheet-url>

# Look for things the computed pass might miss:
# - Media query breakpoints
# - Keyframe animations
# - CSS custom property definitions with fallbacks
# - Commented-out or unused styles that reveal design intent

Step 3: Organize Raw Data into Tokens

Review raw/colors.json, raw/typography.json, raw/spacing.json and the screenshots. Then organize into a structured token file.

Colors → Palette

Group extracted colors into categories:

CategoryWhat to look for
PrimaryBrand color, CTA buttons, most prominent accent
SecondarySupporting accent, secondary buttons
NeutralBackgrounds, text, borders — the gray scale
SuccessGreen tones (confirmations, checkmarks)
WarningYellow/amber tones (alerts)
ErrorRed tones (errors, delete actions)
InfoBlue tones (informational messages)

Deduplicate near-identical colors (ΔE < 3 in OKLCH space). A site with 47 slightly different grays probably intended 5-8.

Typography → Scale

Map extracted font sizes to a named scale:

NameSize range
caption≤12px
small13-14px
body (base)15-16px
large17-18px
h6-h118-48px
display48px+

Spacing → Grid

Snap raw pixel values to the nearest standard grid:

4px grid: 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 96
8px grid: 8, 16, 24, 32, 40, 48, 56, 64, 80, 96

Pick whichever grid the extracted values align to with the least rounding.

Components → Inventory

For each component in the screenshots, document:

  • Visual appearance (size, colors, spacing)
  • Variants observed (different sizes, states)
  • Interactive behavior (from hover/focus screenshots)
  • Closest shadcn-svelte equivalent

Step 4: Compile Token File

Write the organized data to tokens.json:

{
  "$schema": "extracted-design-tokens",
  "source": "https://example.com",
  "extracted": "2026-03-09",
  "framework_detected": "tailwind|bootstrap|custom|none",
  "dark_mode": true,
  "colors": {
    "light": {
      "primary": { "50": "#...", "500": "#...", "900": "#..." },
      "neutral": { "50": "#...", "950": "#..." }
    },
    "dark": { }
  },
  "typography": {
    "fontFamilies": { "sans": "...", "mono": "..." },
    "scale": { "h1": { "size": "36px", "weight": 700, "lineHeight": 1.2 } }
  },
  "spacing": { "grid": "4px", "scale": [0, 4, 8, 12, 16, 24, 32, 48, 64, 96] },
  "radii": { "sm": "4px", "md": "8px", "lg": "12px" },
  "shadows": { "sm": "...", "md": "...", "lg": "..." },
  "components": { "buttons": { "variants": ["primary", "secondary"] } }
}

Step 5: Seed Penpot (optional)

If requested, create a Penpot project from the tokens using pi-penpot:

  1. Create project named after the source site
  2. Create a "Design System" page with color swatches, type samples, spacing ruler
  3. Create pages for each major screen, importing screenshots as references
  4. Build components matching the extracted inventory

Step 6: Generate Tailwind Config (optional)

Map tokens to a Tailwind config with CSS custom properties for runtime theming.

Tips

  • Pass 3-5 subpages for broader component coverage
  • CSS custom properties are gold — sites using them have self-documented tokens
  • Watch the browser — headed mode reveals cookie banners, auth walls, and popups that block extraction
  • Interactive states matter — hover/focus screenshots catch design intent static captures miss
  • Don't over-extract — focus on intentional design decisions, not every computed value
  • Remove slowMo in the script for faster extraction once verified
  • Check for dark mode — the script detects it automatically via both prefers-color-scheme and toggle buttons

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Audit, generate, update, and lint AGENTS.md files across all projects. Use when asked to check project context files, scaffold AGENTS.md for new projects, update stale ones, or run a cross-project audit.

日本語の概要は準備中です。原文の説明を表示しています。

espennilsen/pi1222026年9月22日 更新

blog-post

無料

Draft, edit, and publish blog posts for e9n.dev. Use when creating new posts, editing drafts, or refining existing content. Handles Eleventy frontmatter, Tailwind formatting, and Espen's authentic voice.

日本語の概要は準備中です。原文の説明を表示しています。

espennilsen/pi1222026年9月22日 更新

Generate a full operational status report for the Aivena bot. Checks all subsystems: extensions, webserver, Telegram, chat bridge, heartbeat, cron, database, memory, CRM, calendar, task management, jobs/telemetry, and storage. **Triggers — use this skill when:** - User asks for "status", "bot status", "system status", "operational status" - User asks "is everything running?", "how's Aivena doing?" - User says "health check", "diagnostics", "systems check" - User asks "what's the state of the bot?"

日本語の概要は準備中です。原文の説明を表示しています。

espennilsen/pi1222026年9月22日 更新

Parse git history and produce or update a CHANGELOG.md following the Keep a Changelog convention. Supports Conventional Commits, basic prefix conventions, and unstructured commit messages. Intelligently categorizes changes, detects breaking changes, links to PRs/issues, and handles both initial generation and incremental updates. **Triggers — use this skill when:** - User asks to "generate", "create", "update", or "write" a changelog - User mentions "CHANGELOG", "changelog", "release notes" - User says "document changes", "what changed since last release" - User wants to "prepare a release" and needs a changelog entry - User asks to "clean up" or "reformat" an existing changelog **Covers:** Any git-based project. Handles Conventional Commits (feat/fix/chore), Angular convention, basic prefixes (Add/Fix/Remove), and freeform commit messages. Outputs Keep a Changelog format with optional Common Changelog enhancements.

日本語の概要は準備中です。原文の説明を表示しています。

espennilsen/pi1222026年9月22日 更新

cmux

無料

Orchestrate cmux terminal panes — split terminals, run parallel processes, read output from other panes, and use the built-in browser. Use when working inside cmux and you need to run a dev server, watch tests, spawn sub-agents, or preview web pages.

日本語の概要は準備中です。原文の説明を表示しています。

espennilsen/pi1222026年9月22日 更新

Review code for quality, security, performance, and maintainability. Use when reviewing PRs, auditing a codebase, or refactoring. Covers TypeScript, Node.js, infrastructure-as-code, and full-stack web apps.

日本語の概要は準備中です。原文の説明を表示しています。

espennilsen/pi1222026年9月22日 更新

espennilsen のスキルをすべて見る

このスキルの問題を報告する