frontend-design について
frontend-designは、Webインターフェースの構築と監査に使うスキルで、スタイル分析やデザインシステム素材の生成にDenoスクリプトを提供します。開発者がコンポーネントやページを作成し、トークンを抽出し、複数のフレームワークでアクセシビリティを確認できます。
主な機能
- 01CSSのパターンと不整合を監査
- 02トークンを標準形式に抽出
- 03コントラスト、フォーカス、タッチ領域、動きを確認
- 04配色、タイポグラフィ、デザイントークンを生成
- 05React、Vue、Svelte、HTML向けコンポーネントを生成
活用シーン
- 01既存のスタイルシートを監査して更新
- 02既存コードから再利用可能なトークンを抽出
- 03基準色からデザインシステムを生成
- 04コンポーネントのアクセシビリティを確認
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ jwynia/ agent-skills --skill frontend-designインストール後、Claude Code で/frontend-designを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
assets/component-spec-schema.jsonpalette-schema.jsontoken-schema.jsonreferences/design-philosophy.mdframework-templates.mdtoken-formats.mdscripts/analyze-accessibility.tsanalyze-styles.tsextract-tokens.tsgenerate-component.tsgenerate-palette.tsgenerate-tokens.tsgenerate-typography.ts詳細
フロントエンドデザイン
ありきたりな「AI スロップ」の美学を避け、独自性のある本番品質のフロントエンドインターフェースを作成します。このスキルでは、デザイン哲学に関するガイダンスと、既存のデザインを分析してデザインシステムの成果物を生成する実用的な TypeScript ツールを組み合わせています。
基本原則:明確な美的方向性を選び、精密に仕上げます。大胆なマキシマリズムも洗練されたミニマリズムも有効です。重要なのは強度ではなく、意図を持ってデザインすることです。
このスキルを使用するタイミング
使用する場合:
- Web コンポーネント、ページ、アプリケーションを構築するとき
- 既存の CSS にあるデザインの不整合を監査するとき
- レガシーなコードベースからデザイントークンを抽出するとき
- カラーパレットやタイポグラフィシステムを生成するとき
- フレームワークをまたいでコンポーネントテンプレートを作成するとき
- デザイン要素のアクセシビリティ準拠を確認するとき
使用しない場合:
- テキストコンテンツの簡単な変更
- バックエンドのみの作業
- 視覚的要素を伴わない機能
前提条件
- Deno ランタイム(スクリプトの実行用)
- 任意:分析対象の既存 CSS/デザインファイル
- 任意:参照用のデザイントークンファイル
クイックスタート
このスキルには 3 つのモードがあります。
1. 分析モード
既存のスタイルを監査し、トークンを抽出して、アクセシビリティを確認します。
# Audit CSS for design patterns and inconsistencies
deno run --allow-read scripts/analyze-styles.ts styles.css
# Extract design tokens from existing CSS
deno run --allow-read scripts/extract-tokens.ts ./src --format css
# Check accessibility (contrast, focus states)
deno run --allow-read scripts/analyze-accessibility.ts component.tsx
2. 仕様モード
生成する内容を定義する JSON 仕様を作成します。スキーマの例については assets/ を参照してください。
3. 生成モード
パレット、タイポグラフィシステム、トークン、コンポーネントを作成します。
# Generate a color palette
deno run --allow-read --allow-write scripts/generate-palette.ts --seed "#2563eb" --theme warm
# Generate typography system
deno run --allow-read --allow-write scripts/generate-typography.ts --display "Playfair Display" --body "Source Sans Pro"
# Generate design tokens file
deno run --allow-read --allow-write scripts/generate-tokens.ts tokens-spec.json ./output/
# Generate a component
deno run --allow-read --allow-write scripts/generate-component.ts --name Button --framework react --styling tailwind
手順
フェーズ 1:分析(任意ですが推奨)
新しいデザインを作成する前に、既存のコードを監査し、現在のパターンを把握します。
1a. スタイル分析
CSS ファイルを分析して、色、タイポグラフィ、間隔、不整合を特定します。
deno run --allow-read scripts/analyze-styles.ts <input> [options]
Options:
--tokens <file> Compare against existing design tokens
--pretty Pretty-print JSON output
--format <type> Output format: json (default), summary
出力内容:
- 16 進数表記を正規化したカラー使用状況の一覧
- タイポグラフィのパターン(フォント、サイズ、ウェイト)
- 間隔値の分布
- 不整合と推奨事項
1b. トークン抽出
CSS ファイルからデザイントークンを抽出し、標準化された形式に変換します。
deno run --allow-read scripts/extract-tokens.ts <input> [options]
Options:
--format <type> Output: css, scss, tailwind, style-dictionary, tokens-studio
--output-css Also output CSS variables file
1c. アクセシビリティ監査
デザイン関連のアクセシビリティ上の問題を確認します。
deno run --allow-read scripts/analyze-accessibility.ts <input> [options]
Options:
--format <type> Output: json, summary
--level <AA|AAA> WCAG conformance level (default: AA)
確認項目:
- 色のコントラスト比
- フォーカスインジケーターの有無
- タッチターゲットのサイズ
- 動きに関する設定の尊重
フェーズ 2:生成
2a. カラーパレットの生成
シードカラーやテーマを基に、調和の取れたカラーパレットを生成します。
deno run --allow-read --allow-write scripts/generate-palette.ts [options] <output>
Options:
--seed <color> Primary seed color (hex)
--theme <type> warm, cool, neutral, vibrant, muted, dark, light
--style <type> minimalist, bold, organic, corporate, playful
--shades Generate 50-950 shade scale
--semantic Generate success/warning/error colors
--contrast <lvl> Target contrast: AA (default), AAA
--format <type> css, scss, tailwind, tokens, json
仕様の例(palette-spec.json):
{
"seedColors": {
"primary": "#2563eb",
"accent": "#f59e0b"
},
"theme": "cool",
"generateShades": true,
"generateSemantics": true,
"contrastTarget": "AA",
"outputFormat": "css"
}
2b. タイポグラフィシステムの生成
フォントスタックとスケールを含むタイポグラフィシステムを生成します。
deno run --allow-read --allow-write scripts/generate-typography.ts [options] <output>
Options:
--display <font> Display/heading font family
--body <font> Body text font family
--mono <font> Monospace font family
--scale <type> minor-second, major-second, minor-third, major-third, perfect-fourth, golden-ratio
--base <px> Base font size (default: 16)
--line-height tight, normal, relaxed
--responsive Generate responsive breakpoints
--format <type> css, scss, tailwind, tokens
タイプスケール:
| スケール | 比率 | 特徴 |
|---|---|---|
| minor-second | 1.067 | 控えめで保守的 |
| major-second | 1.125 | バランスが取れたプロフェッショナルな印象 |
| minor-third | 1.200 | 明確な階層 |
| major-third | 1.250 | 存在感が強い |
| perfect-fourth | 1.333 | 大胆でインパクトがある |
| golden-ratio | 1.618 | ドラマチックで芸術的 |
2c. デザイントークンの生成
複数の形式で包括的なデザイントークンファイルを生成します。
deno run --allow-read --allow-write scripts/generate-tokens.ts <spec> <output-dir>
仕様の構造:
{
"name": "my-design-system",
"tokens": {
"color": { "primary": "#2563eb", "secondary": "#64748b" },
"spacing": { "xs": "0.25rem", "sm": "0.5rem", "md": "1rem" },
"typography": {
"fontFamilies": { "display": "Playfair Display", "body": "Inter" },
"fontSizes": { "sm": "0.875rem", "base": "1rem", "lg": "1.125rem" }
},
"shadow": { "sm": "0 1px 2px rgba(0,0,0,0.05)" },
"border": { "radius": { "sm": "0.25rem", "md": "0.5rem" } },
"animation": { "duration": { "fast": "150ms", "normal": "300ms" } }
},
"outputFormats": ["css", "scss", "tailwind", "ts"]
}
2d. コンポーネントの生成
デザインを重視したスタイルのコンポーネントテンプレートを生成します。
deno run --allow-read --allow-write scripts/generate-component.ts [options] <output-dir>
Options:
--name <name> Component name (required)
--type <type> button, card, input, modal, navigation, hero, custom
--framework <fw> react, vue, svelte, html
--styling <type> css, tailwind, css-modules, styled-components, emotion
--aesthetic <type> minimal, bold, organic, brutalist, glassmorphism, neumorphism
--animation <lvl> none, subtle, expressive
--dark-mode Include dark mode support
--tokens <file> Use design tokens file
フレームワークごとの出力例:
React with Tailwind:
export function Button({ variant = 'primary', children }: ButtonProps) {
return (
<button className="px-4 py-2 rounded-lg font-medium transition-all">
{children}
</button>
);
}
Vue with scoped CSS:
<template>
<button :class="['btn', `btn--${variant}`]"><slot /></button>
</template>
<script setup lang="ts">
defineProps<{ variant?: 'primary' | 'secondary' }>();
</script>
<style scoped>.btn { /* styles */ }</style>
Svelte:
<script lang="ts">
export let variant: 'primary' | 'secondary' = 'primary';
</script>
<button class="btn btn--{variant}"><slot /></button>
<style>.btn { /* styles */ }</style>
例
例 1:レガシー CSS の監査と刷新
# 1. Analyze existing styles
deno run --allow-read scripts/analyze-styles.ts ./legacy/styles.css --pretty > audit.json
# 2. Extract tokens from the analysis
deno run --allow-read scripts/extract-tokens.ts ./legacy/styles.css --format css > tokens.css
# 3. Generate improved palette from dominant color
deno run --allow-read --allow-write scripts/generate-palette.ts --seed "#336699" --shades --format css palette.css
例 2:デザインシステムをゼロから作成
# 1. Generate color palette
deno run --allow-read --allow-write scripts/generate-palette.ts \
--seed "#8b5cf6" --theme vibrant --shades --semantic --format css colors.css
# 2. Generate typography system
deno run --allow-read --allow-write scripts/generate-typography.ts \
--display "Space Grotesk" --body "Inter" --scale major-third --responsive --format css typography.css
# 3. Generate comprehensive tokens
deno run --allow-read --allow-write scripts/generate-tokens.ts design-spec.json ./tokens/
例 3:コンポーネントライブラリの生成
# Generate button component for React with Tailwind
deno run --allow-read --allow-write scripts/generate-component.ts \
--name Button --framework react --styling tailwind --aesthetic bold ./components/
# Generate card component for Vue with CSS modules
deno run --allow-read --allow-write scripts/generate-component.ts \
--name Card --framework vue --styling css-modules --aesthetic glassmorphism ./components/
# Generate input for Svelte
deno run --allow-read --allow-write scripts/generate-component.ts \
--name Input --framework svelte --styling css --aesthetic minimal ./components/
例 4:リリース前のアクセシビリティチェック
# Audit all components
deno run --allow-read scripts/analyze-accessibility.ts ./src/components --level AAA --format summary
スクリプトリファレンス
| スクリプト | 目的 | 権限 |
|---|---|---|
analyze-styles.ts | CSS のパターンと不整合を監査する | --allow-read |
extract-tokens.ts | CSS からデザイントークンを抽出する | --allow-read |
analyze-accessibility.ts | デザインのアクセシビリティをチェックする | --allow-read |
generate-palette.ts | カラーパレットを生成する | --allow-read --allow-write |
generate-typography.ts | タイポグラフィシステムを生成する | --allow-read --allow-write |
generate-tokens.ts | マルチフォーマットのトークンを生成する | --allow-read --allow-write |
generate-component.ts | フレームワークのコンポーネントを生成する | --allow-read --allow-write |
デザイン哲学
ありきたりな「AI っぽい」見た目は避けてください。詳しいガイダンスについては、references/design-philosophy.md を参照してください。
主な原則:
- タイポグラフィ:デフォルトのフォントではなく、個性のあるフォントを選びます(Arial、Inter、Roboto は避けてください)
- 色:控えめなパレットではなく、鮮やかなアクセントを加えた主役となる色を使います
- モーション:散発的なマイクロインタラクションではなく、演出された段階的な表示を使います
- 構成:非対称、重なり、グリッドを崩す要素を取り入れます
- 質感:単色のベタ塗りではなく、グラデーション、ノイズ、パターンを使います
次のようなデザインにはしないでください:
- 白い背景に紫のグラデーション
- システムフォントや使い古されたフォントファミリー
- 予測可能なカードベースのレイアウト
- 画一的な Bootstrap 風のデザイン
よくある問題
「CSS parsing failed」
- CSS の構文が正しいことを確認してください
- SCSS/PostCSS は、事前のプリプロセスが必要な場合があります
「Color contrast check failed」
- 解決できなかった CSS 変数がないか確認してください
- 実際の色の値、またはトークンファイルを指定してください
「Unknown framework」
- サポート対象:react、vue、svelte、html
- スペルと小文字表記を確認してください
「Token format not supported」
- サポート対象:css、scss、tailwind、style-dictionary、tokens-studio、json、ts
その他のリソース
references/design-philosophy.md- AI らしい画一的なデザインを避けるための詳細ガイドreferences/token-formats.md- デザイントークンのフォーマット仕様references/framework-templates.md- フレームワーク固有のパターンassets/*.json- 仕様用の JSON スキーマファイル
関連スキル
web-search- デザインのインスピレーションやトレンドを調査しますresearch-workflow- デザインシステムを詳しく調査します