Communitygithub.com

coastdigitalgroup/coastai-skills

ビューポートに応じてスムーズに変化するタイポグラフィスケールを、CSS clamp() を使用して設計・実装します。レスポンシブタイポグラフィ、デザインシステム、または流動的レイアウトの作成が求められた場合にこのスキルを起動します。

coastai-skills とは?

このスキルは、CSSの`clamp()`関数を用いて、ビューポートサイズに応じて滑らかに変化する流体タイポグラフィシステムを構築するためのものです。従来の固定ブレークポイントによる段階的なサイズ変更ではなく、最小値と最大値の間で線形にスケーリングすることで、視覚的な調和と可読性を向上させ、多数のメディアクエリを管理するメンテナンス負荷を軽減します。主な入力としてビューポートの範囲、ベースフォントサイズ、スケール比率を必要とし、出力としてCSSカスタムプロパティ、ユーティリティクラス、階層構造のドキュメントを生成します。また、アクセシビリティに配慮し、`rem`単位と`clamp()`の併用を推奨しており、ユーザーのブラウザフォントサイズ設定を尊重しつつ流体動作を実現します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/coastdigitalgroup/coastai-skills/tree/HEAD/website-design/fluid-typography-system

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

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

ドキュメント

流体タイポグラフィシステム

目的

Fluid Typography Systemスキルは、ユーザーのビューポートサイズに応じて滑らかに適応するタイポグラフィスケールの作成を可能にします。特定のブレークポイントで固定サイズに切り替わる代わりに、CSSのclamp()関数を使用して、定義された最小値と最大値の間でタイポグラフィが線形にスケーリングします。これにより、視覚的な調和と可読性が向上し、多数のメディアクエリを管理するメンテナンス負荷が軽減されます。

使用例

  • ゼロからレスポンシブデザインシステムを構築する場合。
  • 既存のウェブサイトのタイポグラフィを最新化し、クロスデバイスの一貫性を高める場合。
  • テキストがあらゆる画面サイズで利用可能なスペースを完全に埋める必要があるレイアウトを作成する場合。
  • 複数の@mediaルールを単一の流体変数セットに置き換えてCSSを簡素化する場合。

使用すべきでない場合

  • レガシーブラウザのサポート: プロジェクトがclamp()を理解しないブラウザ(例:Internet Explorer)をサポートする必要がある場合。
  • 固定幅デザイン: レイアウトが厳密に固定されており、レスポンシブに対応しようとしない場合。
  • 極端な精度: 特定のブランドガイドラインが、線形スケールと一致しないすべての解像度で正確なピクセルサイズを義務付けている場合。

入力

流体タイポグラフィシステムを生成するには、以下が必要です:

  1. ビューポート範囲:
    • min-width: スケーリングが開始する画面幅(例:320px)。
    • max-width: スケーリングが停止する画面幅(例:1200px)。
  2. ベースフォントサイズ:
    • min-size: min-widthにおける本文フォントサイズ(例:16px)。
    • max-size: max-widthにおける本文フォントサイズ(例:20px)。
  3. スケール比率:
    • 見出しのサイズを決定する乗数(例:1.250(メジャーサード)、1.333(パーフェクトフォース))。

出力

  1. CSSカスタムプロパティ: 流体スケールを定義するCSS変数のブロック。
  2. タイポグラフィユーティリティクラス: (オプション)スケールを簡単に適用するためのCSSクラス。
  3. 階層構造ドキュメント: 本文からH1までのサイズの明確なマッピング。

ワークフロー

1. スケールパラメータの定義

最小/最大ビューポートとベースサイズを決定します。 例: 320px~1280px、ベース16px~18px。

2. タイポグラフィスケールの選択

ブランドのトーンに合った比率を選択します。

  • 1.067(マイナーセカンド): 微妙な差、データ密度の高い箇所に適しています。
  • 1.200(マイナーサード): 標準的、バランスが取れています。
  • 1.414(オーグメンテッドフォース): コントラストが高く、大胆な見出しに適しています。

3. 階層レベルの計算

各レベル(H6~H1)のベースサイズに比率を乗算します。 計算式: Size_level = Base * (Ratio ^ Level)

4. 流体計算式の生成

計算された最小/最大ピクセル値をclamp()関数に変換します。 clamp(min, preferred, max)

推奨値の計算: slope = (max_size - min_size) / (max_viewport - min_viewport) y_intercept = min_size - slope * min_viewport preferred = (y_intercept) + (slope * 100vw)

5. 実装

生成されたCSS変数をデザインに適用します。

決定ルール

  • アクセシビリティ優先: 本文テキストのmin-sizeは、1rem(16px)を下回るべきではありません。
  • ユーザー設定の尊重: 最終出力には必ずrem単位を使用し、ユーザーのブラウザフォントサイズ設定が尊重されるようにします。remベースの最小/最大クランプなしでvwのみのサイジングを使用しないでください。純粋なビューポート単位はユーザーのブラウザズームやフォントサイズ設定を無視し、WCAG 1.4.4(テキストのサイズ変更)に失敗する可能性があります。
  • スケールの強度: モバイル中心のサイトでは小さな比率を使用し、小さな画面で見出しが大きくなりすぎないようにします。

制約

  • レスポンシブ性: タイポグラフィはコンテナの境界内に収まり、オーバーフローを引き起こさないようにする必要があります。
  • 可読性: 行の長さ(メジャー)は、理想的には45~75文字の間に保つ必要があります。テキストのスケールに応じて、コンテナの幅を適宜調整します。
  • 階層構造: H1は常にH2よりも視覚的に明確で大きく、H2はH3よりも大きく、というようにする必要があります。

よくある失敗パターン

  • 計算ミス: 画面が大きくなるとテキストが小さくなる結果になる。
  • 単位の不一致: pxとremが混在し、ブラウザのズーム機能を壊す。
  • オーバースケーリング: 4Kモニターで見出しが大きくなりすぎて、ビューポート全体を支配してしまう。
  • アクセシビリティの問題: ユーザーがズームインしたり、OS/ブラウザのベースフォントサイズを大きくしたときの流体スケールの動作をテストし忘れる(WCAG 1.4.4 テキストのサイズ変更、WCAG 1.4.10 リフロー)。

検証基準

  • ブラウザウィンドウのサイズを変更すると、タイポグラフィが滑らかにスケーリングする。
  • 「ジャンプ」や突然のサイズ変化が見られない。
  • すべてのテキストが320px幅で読みやすい。
  • 見出しが本文テキストに対して明確な階層を維持している。
  • システムがベースにrem単位、流体動作にclamp()を使用している。
  • ブラウザズーム400%で、テキストがコンテンツや機能を失うことなくリフローする(WCAG 1.4.10 リフロー)、かつユーザーのフォントサイズ設定を尊重している(WCAG 1.4.4)。

Individual skills in this repo

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

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for progressive disclosure using accordions, ensuring structural integrity, visual affordances, and accessibility across different content densities and devices.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for long-form content, managing readability, vertical rhythm, and information density to ensure a superior reading experience.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for informational elements that communicate state (Badges) and categorization (Tags) with clarity and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for non-overlay notifications, managing global announcements and contextual inline alerts to communicate system states without interrupting the user's flow.

coastdigitalgroup/coastai-skills

Design and implement a systematic, asymmetrical bento-grid layout framework to organize diverse content types cohesively while maintaining strict visual hierarchy, logical focus order, and responsive flexibility.

coastdigitalgroup/coastai-skills

Design a responsive, mobile-first bottom navigation bar and persistent action dock system for mobile websites and web applications, establishing spatial anchors, tab bar anatomy, badge indicators, thumb-zone ergonomics, safe area inset handling, active/inactive state contrast, and desktop responsive adaptation rules.

coastdigitalgroup/coastai-skills

Design a mobile-first bottom sheet overlay system with configurable detents, drag affordances, safe area padding, responsive desktop modal/popover adaptation, and WCAG AA accessibility compliance.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for secondary navigation trails that provide orientation, context, and one-click access to parent levels in deep information architectures.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for buttons and interactive triggers, managing visual hierarchy, variant logic, and action grouping to ensure clear intent and accessible interaction.

coastdigitalgroup/coastai-skills

Design a systematic framework for date and time selection, managing calendar grids, range pickers, and scheduling interfaces to ensure precision and accessibility.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for modular content containers that maintain hierarchy, structural integrity, and action alignment across variable content and responsive viewports.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for horizontal discovery components, managing navigation affordances, scroll behavior, and accessibility to ensure effective content density without compromising usability.

coastdigitalgroup/coastai-skills

Design a systematic, highly accessible, and developer-friendly UI layout framework for code blocks, snippet showcases, multi-file code tabs, line-highlighting, diff views, and syntax token contrast in technical documentation and developer platforms.

coastdigitalgroup/coastai-skills

Design a systematic framework for global command menus (Cmd+K panels) that combines keyboard-driven navigation, command execution, and shortcut discovery into an accessible, responsive overlay.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for threaded conversations, managing nesting depths, action hierarchies, and community signaling to foster engagement and readability.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for side-by-side comparison interfaces, managing high attribute density and responsive complexity to support informed decision-making.

coastdigitalgroup/coastai-skills

Design and implement a systematic framework for user privacy, managing consent banners, preference centers, and persistent privacy controls to balance legal compliance with user trust.

coastdigitalgroup/coastai-skills

Design and implement a systematic, highly accessible, and responsive visual layout framework for conversational chat widgets, live chat boxes, and chatbot panels that ensures clear message scannability, native focus flow, and seamless mobile keyboard adaptation.

coastdigitalgroup/coastai-skills

Design a systematic, accessible, and high-conversion framework for custom select dropdowns and comboboxes, defining anatomy, states, search-filtering, and responsive mobile-adaptive patterns.

coastdigitalgroup/coastai-skills

Design and implement a systematic color palette that ensures WCAG 2.2 accessibility compliance. Trigger this skill when asked to define brand colors, create UI themes, or establish a visual system for a website.

関連スキル