Logo vun Nextjs Multi Design System

Nextjs Multi Design System

Communautéit
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.

Iwwersiicht

EditeurMiladJoodi
Repositoryskills
Skill-Nummnextjs-multi-design-system
Stären
24
Forks
1
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum MiladJoodi op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Nextjs Multi Design System an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/MiladJoodi/skills/tree/main/skills/nextjs-multi-design-system
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Nextjs Multi Design System an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Nextjs Multi Design System automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Nextjs Multi Design System net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Nextjs Multi Design System op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Nextjs Multi Design System besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Nextjs Multi Design System an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/MiladJoodi/skills/tree/main/skills/nextjs-multi-design-system an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Nextjs Multi Design System benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Nextjs Multi Design System benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Nextjs Multi Design System domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Nextjs Multi Design System gratis?

Jo. De Skill gëtt vum MiladJoodi ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇