Communitygithub.com

デザイントークン

ウェブサイトのビジュアルシステムをCSSカスタムプロパティとして作成します。カラーパレット、タイポグラフィスケール、スペーシング、角丸、シャドウをカバーし、コントラストチェックも行います。誰かが配色、1つのブランドカラーからのパレット、フォントペアリング、タイプスケール、「一貫性を持たせたい」、ダークモード、既存サイトのリブランド、またはスタイルが未定義の状態での構築開始を依頼したときに使用します。

デザイントークン とは?

このスキルは、デザイントークンシステムを通じてウェブサイトに一貫性のあるビジュアルアイデンティティを生成・管理します。1つのブランドカラーとムード(例:企業向け、遊び心、エディトリアル)から、カラーパレット、タイポグラフィスケール、スペーシング、角丸、シャドウを含む完全なCSSカスタムプロパティセットを導き出します。カラーは役割ベース(`--bg`、`--surface`、`--text`など)で定義されるため、リブランドは値の変更のみで済み、カスタムプロパティ名を変更する必要はありません。すべてのテキストと背景のペアはWCAG 4.5:1(または7:1)のコントラスト比を満たし、`webcraft` CLIツールを使用して自動チェックできます。スキルはダークモードの生成もサポートし、反転ではなく異なる色相と彩度の調整を適用します。また、`webcraft tokens`コマンドを使用して初期トークンセットの生成を自動化し、既存サイトのリブランドのための段階的なワークフローも提供します。主なターゲットプラットフォームはCSSおよびWordPress theme.jsonの出力で、`generate_tokens`ツールを介したMCPクライアント統合もサポートしています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/imperfec-t/webcraft/tree/HEAD/skills/design-tokens

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

デザイントークン は何をしますか?

名前付きの値の小さなセットをあらゆる場所で使用することで、サイトが「組み立てただけ」ではなく「デザインされた」ように見えます。コンポーネントの前にトークンを定義してください。後でブランドを変更する場合は、1つのブロックを編集するだけですみます。

依頼すべきこと

1つのブランドカラー(またはムードを表す言葉)、ライト/ダークベース、そしてトーン(企業向け、遊び心、エディトリアル、テクニカル)。これ以外はすべて導出可能です。

カラー

色名ではなく「役割」で作業します。これにより、リブランド時に名前の変更が不要になります。

トークン役割目安
--bgページ背景オフホワイトまたはほぼ黒。純粋な #fff や #000 は避ける
--surfaceカード、入力フィールド明度で --bg から2~4%離す
--text本文テキスト--bg に対して少なくとも7:1
--muted二次テキスト--bg に対して少なくとも4.5:1
--borderヘアラインテキストカラーを背景に10~15%混ぜる
--accentボタン、ハイライトブランドカラー
--accent-ink--bg 上のリンクとアクセントテキストブランドカラーを、4.5:1を満たすまで暗く(またはダークモードでは明るく)する
--on-accentアクセント上のテキスト白または黒のうち、4.5:1を満たす方

ガイドライン:

  • ニュートラルカラーには、アクセントの色相をわずかに(彩度2~6%)加えてトーンを調整します。暖色系のアクセントの隣に純粋なグレーがあると、関連性が感じられません。
  • アクセントカラーは表面積の約10%に使用します。すべてがアクセント色になると、何もアクセントになりません。
  • 2つ目のアクセントはほとんど必要ありません。成功やセールなど、明確な意味がある場合にのみ追加してください。
  • ダークモードでは、反転させないでください。表面の明度を「高さ」に応じて上げ、アクセントの彩度を少し下げて、光りすぎないようにします。

webcraft CLIが利用可能な場合は、手作業で値を導出する代わりに、初期セットを生成してください。上記のすべてのルールを適用し、各ペアが基準を満たすまで明度を調整し、ダークテーマを個別に構築します:

webcraft tokens "#e4572e" --tone editorial -o tokens.css      # オプション: --base dark, --radius pill
webcraft tokens "#e4572e" --format theme-json                 # 同じ値を持つWordPress theme.json

MCPクライアント内では、同じ処理は generate_tokens ツールです。出力は最初のドラフトとして扱ってください。目視で調整し、再チェックします。

テキストと背景のすべてのペアを、最終決定前にチェックしてください:

webcraft contrast "#1b1b1f" "#f6f4ef"
webcraft contrast --tokens tokens.css
python scripts/contrast.py --tokens tokens.css   # インストール不要のフォールバック、16進数値のみ

最初の形式は、1つのペアの比率とWCAGレベルを出力します。2番目の形式はCSSファイルを読み取り、すべてのテーマブロック(:root、[data-theme]、prefers-color-scheme)内の標準的な役割ペアをチェックし、var() を解決して16進数、rgb()、hsl()、oklch()、color-mix() を読み取ります。不合格のペアは、新しいサイトで最もよく見られるアクセシビリティ上の欠陥であり、良好なモニタを使用している視力の良い人には見えないため、これはスクリプトであり、判断に委ねるものではありません。

タイポグラフィ

  • 最大2つのファミリー: 1つは見出し用、もう1つは本文用です。多くの場合、1つのファミリーを2つのウェイトで使う方が優れています。
  • 構造のコントラストでペアリングします(セリフのディスプレイとサンセリフの本文、またはコンデンスドのディスプレイとレギュラーの本文)。似たようなサンセリフ同士は避けます。
  • 本文サイズは16~18px、行間は1.5~1.7、1行の長さは60~75文字にします。
  • ディスプレイタイプ: 行間0.95~1.1、サイズが大きくなるにつれてトラッキングをマイナスにします。
  • clamp() を使用した流体スケールで、ブレークポイント間のジャンプをなくします:
:root {
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1:  clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem);
  --step-2:  clamp(1.6rem, 1.3rem + 1.3vw, 2.4rem);
  --step-3:  clamp(2rem, 1.5rem + 2.6vw, 3.6rem);
  --step-4:  clamp(2.5rem, 1.6rem + 4.6vw, 5.5rem);
  --step-5:  clamp(3rem, 1.5rem + 7vw, 7.5rem);
}
  • フォントは font-display: swap で読み込み、ファーストビューで使用する1つまたは2つのファイルをプリロードし、セルフホスティングの場合はサブセット化します。

スペーシング、角丸、シャドウ

:root {
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-6: 1.5rem;  --space-8: 2rem;   --space-12: 3rem;   --space-16: 4rem;
  --section: clamp(4rem, 3rem + 6vw, 9rem);   /* セクション間の垂直方向のパディング */
  --gutter:  clamp(1rem, 0.5rem + 3vw, 3rem); /* ページサイドのパディング */
  --container: 76rem;

  --radius-sm: 8px; --radius: 16px; --radius-lg: 28px; --radius-pill: 999px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(0 0 0 / .06);
}
  • 角の性格(シャープ、ソフト、ピル)を1つ選び、それを貫きます。角丸を混在させることは、一貫性がないように見える最も早い方法です。
  • セクション間のスペーシングは、セクション内のスペーシングよりも明らかに大きくします。このギャップが、セクションの終わりを目に伝えるものです。

出力

:root ブロック、オプションの [data-theme="dark"] ブロックを含む1つの tokens.css と、各トークンがどこで使用されているかを示す短いテーブルを納品します。その後、本文テキスト、マutedテキスト、ボタンテキストのコントラスト結果を記載します。

既存サイトのリブランド

まず、ハードコードされた既存の値を役割にマッピングします(CSS内の16進数コードを検索して出現回数を数えます)。それらをトークンに置き換え、視覚的に何も変更されていないことを確認してから、トークンの値を交換します。両方を一度に行うと、回帰の追跡が不可能になります。

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

hero-section

Design and build the hero (first screen) of a website, including headline layout, media treatment, CTA, proof badge, marquee and entrance animation. Use this whenever someone asks for a hero section, a landing page header, "the top of my homepage", a cinematic or animated intro, a video background, a text marquee, or says their first screen looks plain or generic.

homepage-blueprint

Plan the section structure and content slots of a homepage for an agency, freelancer, studio or service business before any design or code. Use this whenever someone asks "what sections should my homepage have", "plan my website", "structure a landing page for my business", wants a wireframe or sitemap for a service site, or starts building a homepage without a clear outline.

launch-qa

Run a pre-launch quality check on a website covering performance, accessibility, SEO basics, forms, cross-device behavior and content, and report findings ranked by severity with fixes. Use this whenever someone says a site is "ready to launch", "going live", asks "can you check my site", wants a QA pass, a website audit, a Lighthouse-style review, or wants to know why a page is slow or scoring badly.

responsive-layout

Build page layouts that work from phones to wide desktops using CSS grid, flexbox, container queries and fluid sizing, including card grids, bento grids, split sections, sticky sidebars and navigation that collapses. Use this whenever someone says their site "breaks on mobile", asks for a responsive grid, a bento layout, a mobile menu, fixing horizontal scroll or overflow, or is laying out any multi-column section.

scroll-motion

Add scroll-driven and entrance animation to a website with GSAP, ScrollTrigger and Lenis, including reveals, parallax, pinned sections, horizontal scroll, line drawing, counters and preloaders. Use this whenever someone wants a site to "feel premium", asks for smooth scrolling, scroll animations, parallax, text reveals, a pinned or sticky scroll section, an animated preloader, or names GSAP, ScrollTrigger, Lenis, Locomotive or AOS.

site-teardown

Analyze a live website and turn it into a section-by-section build brief that another person or AI can rebuild from, with brand name, colors, fonts and images swapped for placeholders. Use this whenever someone shares a URL and says "analyze this site", "make something like this", "give me a prompt to build this", "recreate this effect", "clone the layout with my branding", or asks how a page's animation or structure works, even if they never say "teardown".

website-workflow

Plan and sequence a whole website build, from structure through design, code, WordPress and launch, by routing each stage to the right webcraft skill. Use this when someone asks to "build me a website", "design my site from scratch", "redo our homepage", wants an end-to-end plan for a marketing, agency, studio or service site, or the request spans more than one of structure, look, layout, motion, CMS and QA.

wordpress-theme-build

Turn a static HTML/CSS/JS design into a custom WordPress theme that the client can edit, covering theme structure, theme.json, enqueueing scripts, block patterns, custom post types and editable content. Use this whenever someone wants to convert a design or static site to WordPress, build a custom or block theme, make sections editable in Gutenberg, add GSAP or other scripts to a theme properly, or asks why their theme edits are lost or their content is hard-coded.

関連スキル