Nextjs Multi Design System logo

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.

Overview

PublisherMiladJoodi
Repositoryskills
Skill namenextjs-multi-design-system
Stars
24
Forks
1
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by MiladJoodi on GitHub. Read the source before you install it.

Installation

Install the Nextjs Multi Design System AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/MiladJoodi/skills/tree/main/skills/nextjs-multi-design-system
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Nextjs Multi Design System in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Nextjs Multi Design System on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Nextjs Multi Design System is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

Frequently asked questions

What does the Nextjs Multi Design System AI skill do?

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.

Why use Nextjs Multi Design System on TypingMind?

Because you install it once and use it with any model. Nextjs Multi Design System is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Nextjs Multi Design System in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/MiladJoodi/skills/tree/main/skills/nextjs-multi-design-system. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Nextjs Multi Design System?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Nextjs Multi Design System?

As many as you like. As long as a model supports skills, you can use Nextjs Multi Design System with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Nextjs Multi Design System AI skill free?

Yes. It is published on GitHub by MiladJoodi under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇