Logo di Nextjs Multi Design System

Nextjs Multi Design System

Community
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.

Panoramica

AutoreMiladJoodi
Repositoryskills
Nome della skillnextjs-multi-design-system
Stelle
24
Fork
1
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da MiladJoodi su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Nextjs Multi Design System in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/MiladJoodi/skills/tree/main/skills/nextjs-multi-design-system
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Nextjs Multi Design System in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Nextjs Multi Design System non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Nextjs Multi Design System non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

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

Domande frequenti

Cosa fa la skill IA 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.

Perché usare Nextjs Multi Design System su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Nextjs Multi Design System è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Nextjs Multi Design System in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/MiladJoodi/skills/tree/main/skills/nextjs-multi-design-system. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Nextjs Multi Design System?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Nextjs Multi Design System?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Nextjs Multi Design System: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Nextjs Multi Design System è gratuita?

Sì. È pubblicata su GitHub da MiladJoodi con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇