Nextjs Multi Design Systemのロゴ

Nextjs Multi Design System

コミュニティ
MiladJoodi
nextjs-multi-design-system

Build and debug multiple isolated design systems in a Next.js app: style-* body classes, cookie/localStorage sync, FOUC prevention, light/dark coexistence, SSR/hydration, iframe component previews, parent↔iframe theme sync, and design tokens. Use when switching themes flashes wrong styles, iframe previews ignore the picker, or docs and preview disagree.

概要

公開者MiladJoodi
リポジトリskills
スキル名nextjs-multi-design-system
スター
24
フォーク
1
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    MiladJoodiがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Nextjs Multi Design System」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/MiladJoodi/skills/tree/main/skills/nextjs-multi-design-system
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MiladJoodi/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/nextjs-multi-design-system .claude/skills/nextjs-multi-design-system
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでNextjs Multi Design Systemを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にNextjs Multi Design Systemを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Nextjs Multi Design Systemは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Next.js Multi Design System

Practical workflow for apps that ship more than one Design System / visual style in a single Next.js surface (docs, marketing, component showcase).

This is not a basic light/dark theme toggle guide. It covers isolation of multiple style systems (style-*), persistence across SSR, and preview iframes that must match the parent picker.

Scope

In scopeMulti DS switching, tokens, FOUC, cookie/SSR, iframe preview sync, docs↔preview parity
Out of scopeSingle-theme apps, generic CSS architecture, unrelated component APIs

When to use

  • One Next.js app hosts several named Design Systems (e.g. Nova, Vega, Glass).
  • Users switch DS without full reload and must not see the wrong tokens flash.
  • Component / block previews render in an iframe and must follow the parent.
  • Light/dark mode must coexist with a DS that has its own default appearance.

Architecture (what usually works)

1) One active style class on a root element

Map each Design System id → a single CSS scope class on body (or a dedicated root):

text
default  → style-nova
comfort  → style-vega
glass    → style-glass
…

Tokens and variant utilities hang off that class (Tailwind @custom-variant / .style-*:… selectors). Only one style-* class should be active.

2) Persist for SSR

  • Cookie (readable on the server) + localStorage (client restore).
  • Root layout reads cookie (or a proxy-forwarded header) and applies the matching style-* class in the first HTML.
  • A blocking inline script as the first child of body re-syncs localStorage → cookie → body.classList before paint (FOUC guard).

Do not wait for React hydration to apply the style class.

3) Light / dark is orthogonal

  • Theme mode (light / dark / system) lives on html (or next-themes).
  • Design System lives on body as style-*.
  • Some DS may default to dark when selected — stash the previous mode so the user can restore light without fighting the DS.

4) Preview = separate document

Iframe previews are a new document. They do not inherit React context.

Reliable patterns:

  • Put the active style in the iframe URL: /view/{styleName}/{item}?embed=1
  • Remount iframe when style changes (key={styleName})
  • Optionally pass style via query/cookie that the view route reads on SSR
  • Do not assume postMessage alone is enough for first paint

Agent workflow

Inspect

  • Find DS ids, cookie name, storage key, style class map.
  • Check root layout: SSR class on body / html.
  • Find bootstrap script (must run before first paint).
  • Find preview surfaces: iframe src, key, embed routes.
  • Note Turbopack/Webpack quirks if CSS for a DS is lazily imported.

Diagnose

SymptomLikely cause
Flash of wrong DS on loadCookie missing; bootstrap script after paint; SSR class wrong
Picker updates parent but not iframeIframe URL/key not tied to active style
Hydration mismatch warningServer cookie ≠ client localStorage on first render
Tokens look mixedTwo style-* classes, or scoped CSS not loaded for that DS
Dark DS + light mode fightMode not stashed/restored when selecting dark-default DS
Docs page ≠ previewPreview route uses different style source than docs shell

Plan

Emit a short brief before edits:

markdown
## Pre-change brief
**Root cause:** …
**Evidence:** …
**Proposed fix:** …
**Files affected:** …

Implement (minimal)

  1. Single source of truth for id → style-* map.
  2. Cookie + localStorage write on change; SSR read in layout.
  3. Blocking bootstrap on body that strips other style-* then adds active.
  4. Iframe src + key include active style name.
  5. Ensure CSS for every DS is available where the preview document renders (eager ship for picker CSS beats lazy chunks that arrive after FOUC).

Verify

  • Hard reload: first paint already has correct style-*.
  • Switch DS: parent and iframe match without full app reload.
  • Toggle light/dark after selecting a dark-default DS.
  • View page source / disable JS briefly: SSR class still correct from cookie.
  • Compare a docs example and the same item in preview side-by-side.

Component preview (included here)

Do not invent a separate skill for iframe preview when the hard part is multi-DS sync. Preview checklist:

  • Isolation: preview document loads its own CSS + style-*.
  • Responsive: viewport width controlled by parent chrome, not by shrinking the whole app shell incorrectly.
  • Embed mode: hide site chrome (?embed=1) so docs chrome ≠ preview chrome.
  • Parity: same registry item, same style name, same tokens as the docs claim.

Common failures

  • Applying DS only in a client provider → FOUC.
  • Putting style-* on a nested wrapper while tokens expect body.
  • Lazy-importing DS CSS that is not present on the iframe route.
  • Syncing via React context into an iframe (impossible across documents).
  • Forcing dark on every boot for a DS that should respect user mode after first selection.
  • Turbopack HMR leaving stale CSS modules after renaming a style id.

Best practices

  • Keep the id ↔ class map in one module shared by layout, picker, and bootstrap.
  • Prefer cookie for SSR; localStorage as client preference mirror.
  • Remount iframes on style change; do not mutate iframe DOM from parent.
  • Treat preview routes as first-class pages with the same token CSS.
  • Document which DS are dark-default and how mode restore works.

Report

markdown
## Multi-DS report
**Symptom:** …
**Root cause:** …
**Fix:** …
**SSR / FOUC:** pass | fail
**Iframe sync:** pass | fail
**Light/dark coexistence:** pass | fail

よくある質問

AIスキル「Nextjs Multi Design System」では何ができますか?

Build and debug multiple isolated design systems in a Next.js app: style-* body classes, cookie/localStorage sync, FOUC prevention, light/dark coexistence, SSR/hydration, iframe component previews, parent↔iframe theme sync, and design tokens. Use when switching themes flashes wrong styles, iframe previews ignore the picker, or docs and preview disagree.

TypingMindでNextjs Multi Design Systemを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Nextjs Multi Design Systemはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにNextjs Multi Design Systemをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/MiladJoodi/skills/tree/main/skills/nextjs-multi-design-systemを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Nextjs Multi Design Systemを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Nextjs Multi Design Systemで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもNextjs Multi Design Systemを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Nextjs Multi Design System」は無料ですか?

はい。MiladJoodiがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇