Logo von Nextjs Rsc To React Router V8 Migration

Nextjs Rsc To React Router V8 Migration

Community
Innei
nextjs-rsc-to-react-router-v8-migration

Verwenden Sie diesen Skill, wenn Sie eine mehrsprachige Next.js-RSC-/App-Router-Website zu React Router v8 migrieren, damit SSR-HTML vom CDN gecacht werden kann. RSC-Payloads lassen sich am Edge nicht cachen, und die Kombination aus Sprachversionen und Seitenanzahl vervielfacht die Kosten. Behandelt die Schritte in der richtigen Reihenfolge: SSR-Varianten aufgrund von UA, Geo und Cookies entfernen, `.data`-Loader von Client-Fetches trennen, Theme-SSR neu aufsetzen (next-themes + Head-Skript + /theme-vars.css), Middleware in Vercel Routing Middleware und einen Spiegel im Root-Loader aufteilen, statische Seiten vorab rendern und 3-stufiges Cache-Control einführen, damit Cloudflare den Cache verwaltet.

Add to TypingMind

Übersicht

HerausgeberInnei
RepositorySKILL
Skill-Namenextjs-rsc-to-react-router-v8-migration
Sterne
81
Forks
2
Mitgelieferte Dateien
3
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 3

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von Innei auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Nextjs Rsc To React Router V8 Migration in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/Innei/SKILL/tree/main/skills/infrastructure/nextjs-rsc-to-react-router-v8-migration
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Innei/SKILL.git /tmp/SKILL
mkdir -p .claude/skills
cp -r /tmp/SKILL/skills/infrastructure/nextjs-rsc-to-react-router-v8-migration .claude/skills/nextjs-rsc-to-react-router-v8-migration
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Nextjs Rsc To React Router V8 Migration in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Nextjs Rsc To React Router V8 Migration automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Nextjs Rsc To React Router V8 Migration nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

nextjs-rsc-to-react-router-v8-migration

Migrate a multi-locale Next.js RSC / App-Router site to React Router v8 so its SSR HTML is CDN-cacheable at the edge. The migration is not a "framework swap" — it is a cache-frame swap. RSC payload is per-request, per-cookie, per-header, and Vercel-only. RR8 gives you plain SSR HTML that Cloudflare can hold for hours if the response varies only by URL. The whole workflow enforces that invariant.

The gain is real only when locale × page multiplies the bill. On a 17-locale marketing surface with dynamic OG, sitemaps, and marketplace pages, RSC payload cost dominates even under ISR. RR8's plain SSR wins because the CDN can bypass origin for anonymous traffic.

When to use

  • Multi-locale (≥ 5 locales) SSR site whose RSC payload / ISR bill is a measurable cost driver.
  • Anonymous traffic dominates — the CDN can serve the same HTML to everyone in the same locale.
  • Team can absorb a phased cut: leave 3–5 URL groups on the legacy Next site behind for later ports (privacy/terms, growth pages, …).
  • CDN in front is Cloudflare (or any CDN that honours Cloudflare-CDN-Cache-Control). Vercel-CDN-only stacks lose the point — Vercel CDN cannot cache HTML that varies by cookie.

When NOT to use

  • Small site — RSC payload cost is a rounding error; keep Next.
  • Heavy Server Components composition — RR8 has no RSC. If your product surface is dashboard-shaped and you rely on RSC boundaries for streaming/composition, this trade is a loss.
  • SSR that legitimately varies per-user (dashboards, auth-gated pages) — CDN caching is moot; the migration only pays for anonymous surfaces.
  • Vercel CDN is the only CDN and you cannot bring Cloudflare in front.

Scope

  • Marketing / blog / marketplace-style SSR pages, multi-locale.
  • Loader-driven data fetch, most of which can move to client-side after hydration.
  • CSS-in-JS with SSR extraction (antd-style / emotion / stitches).
  • Middleware doing locale redirects, UA detection, geo hints.

Files

  • references/cache-control-profiles.md — the seven header profiles (HOME, PAGE, SITEMAP, DYNAMIC_OG, BADGE, STATIC_LONG, FEED, NO_STORE) and the 3-tier header rule.
  • references/loader-triage.md — decision matrix for splitting a loader between SSR-critical, prerender-safe, and client-fetch.
  • references/theme-ssr-recipe.md — next-themes + inline head script + cacheable /theme-vars.css compile-time recipe, incl. antd v6 cssVar override gotcha.

Workflow

text
[1]  Frame the migration as an edge-cache swap, not a framework swap
[2]  Stand up RR8 shell alongside legacy site (separate Vercel project)
[3]  Move src/app tree to RR8 route config; keep Next-like FS shape
[4]  Kill UA / geo / cookie-derived SSR variance
[5]  Split loader traffic: SSR-critical vs prerender-safe vs client-fetch
[6]  Restage theme SSR: next-themes + inline head script + /theme-vars.css
[7]  Rebuild middleware: Vercel Routing Middleware + root-loader mirror
[8]  Prerender the static surface (blog, about, docs) at build time
[9]  Decouple route-FS from feature-FS: routes/ = entry only
[10] Compile-time-ify runtime CSS via vite virtual modules
[11] Land 3-tier Cache-Control headers per route profile
[12] Cut traffic; leave the legacy Next site on for un-ported URL groups

Per-step notes

[1] Frame it as a cache swap. Before touching code, write down the per-locale RSC / ISR bill and the target cf-cache-status: HIT ratio. If the answer is "we cannot let CDN cache HTML because we personalise X", the migration will not pay — either fix X (move to CSR) or stop.

[3] Route FS shape. Do not flatten. Keep a Next-like nested tree (routes/blog/[slug]/page.tsx, routes/api/geo/route.ts, routes/docs/[...slugs]/page.tsx) even though RR8 uses explicit routes.ts. Every page module registers twice via a localized() helper: locale-less path (/blog/:slug, default en) and prefixed path (/:locale/blog/:slug). One module, two ids.

[4] Kill SSR variance. The single rule: SSR output must vary only by URL. No UA sniffing, no cookie-derived theme, no per-request geo. Move device detection to CSS media queries (or a matchMedia-based useIsMobile hook that agrees with those media queries), theme to next-themes + inline <head> script, geo to a client-side useGeo that calls /api/geo. If you leave one cookie-varying loader on a public route, that route stops caching.

[5] Loader triage. RR8 loaders re-run on client navigation as .data requests, which the CDN will not cache. Three buckets:

  • SSR-critical, prerender-safe (locale/route info, static blog metadata) → loader, and prerender at build.
  • SSR-critical, dynamic (fresh market/API data needed for first paint) → loader, but keep the SSR HTML cacheable by CDN because the URL fully identifies the result.
  • Post-hydration (marketplace lists, star counts, changelog tails) → strip from the loader; fetch client-side after hydration. This is the biggest CDN win — the .data round-trip disappears.

See references/loader-triage.md.

[6] Theme SSR. Ship both palettes (light + dark) as one cacheable stylesheet /theme-vars.css?v=<hash>, linked render-blocking from the root. An inline <head> script sets html[data-theme] from localStorage before first paint. antd v6 in cssVar mode re-declares --ant-* on any element carrying .ant-app / [class*='css-var-'], so scope the palette blocks to those selectors too, else the light literals shadow your dark palette on hydration. SSR CSS must be theme-agnostic: rewrite every appearance-dependent token to a var(--ant-*) reference so first paint picks the correct colour.

See references/theme-ssr-recipe.md.

[7] Middleware split. Legacy middleware.ts becomes two things:

  • src/middleware.ts (Vercel Routing Middleware, web-standard Request/Response, next()/rewrite() from @vercel/functions/middleware) — runs in prod before the CDN cache. Handles locale redirects, AI-tool redirects, NEXT_LOCALE cookie.
  • Root loader mirror — Vercel Routing Middleware does not run under bun run dev. Mirror the same locale / redirect logic in the root loader so dev matches prod.
  • Vercel's middleware compiler cannot resolve tsconfig path aliases. Pre-bundle src/middleware.ts (rolldown via vite's dep tree) into a self-contained /middleware.js in a build:middleware step.

[8] Prerender. RR8 supports build-time prerender. Ship the entire static surface (default-locale blog, docs, about, changelog) as HTML on disk; the CDN turns every one into a permanent HIT. Non-default locales stay dynamic if the bill allows; prerendering all 17 locales adds build minutes and repo weight.

[9] Route/feature FS. routes/ holds only route entry files (page.tsx, route.ts, Client.tsx, layout.tsx, [param] segments, not-found.tsx, pending-loading.tsx). Every feature implementation the route imports lives in src/features/<domain>/. Sub-features under [param] drop the brackets (coding/[agent] → features/coding/agent).

[10] Compile-time-ify runtime CSS. Any CSS generated in route.ts at request time (theme vars, antd static rules) becomes a vite virtual module baked at build. The route serves the module contents with a hash query and a long-lived Cache-Control. Zero runtime cost, infinite CDN cache.

[11] 3-tier Cache-Control. Every response ships three headers:

  • Cache-Control (browser)
  • Cloudflare-CDN-Cache-Control (Cloudflare)
  • Vercel-CDN-Cache-Control: no-store (bypass Vercel CDN — deliberate)

Because Cloudflare owns cache, Vercel CDN is a pass-through. Seven profiles (HOME, PAGE, SITEMAP, DYNAMIC_OG, BADGE, STATIC_LONG, FEED, NO_STORE) — see references/cache-control-profiles.md. Apply per route via export const headers = () => toHeaderMap(PAGE).

[12] Phased cut. Do not port every URL group at once. Leave privacy/terms, growth pages, im-landing, icon marketplace on the legacy Next site behind their existing URLs; port them one PR at a time using the frozen legacy repo as reference. The traffic split lives at the DNS / edge layer (see the sibling skill dokploy-traefik-traffic-split for the SPA-asset trap that breaks naive weighted splits).

Common pitfalls

MistakeFix
Framing the work as "Next → RR migration"It is a cache-frame swap. If Cloudflare cannot cache the resulting HTML, you gained nothing.
Any cookie / UA / geo header on the SSR response's VarySSR must vary only by URL. Move personalisation to CSR.
Cookie-derived theme surviving into loader logicCannot pre-paint from a cache-hit HTML. Ship both palettes in cacheable /theme-vars.css; use next-themes + inline <head> script; set data-theme from localStorage before hydration.
antd v6 cssVar mode shadowing your palette on hydrationantd re-declares --ant-* on every element carrying .ant-app / [class*='css-var-']. Scope palette blocks to those selectors too, and rewrite appearance-dependent SSR tokens to var(--ant-*).
Every loader keeps its Next data-fetch verbatimEvery retained loader becomes a .data round-trip on client nav. Triage: keep only SSR-critical; move the rest to client fetch.
Vercel-CDN-only stackVercel CDN cannot cache HTML that varies by cookie. Bring Cloudflare in front and set Vercel-CDN-Cache-Control: no-store.
Deleting middleware.ts before mirroring its logic in the root loaderDev has no Vercel Routing Middleware — locale redirects vanish, users hit 404. Mirror first, delete second.
tsconfig path alias in the middleware bundleVercel's middleware compiler cannot resolve aliases. Pre-bundle to a self-contained /middleware.js via rolldown before deploy.
Runtime CSS generation for theme vars / antd static rulesMove to a vite virtual module baked at build. Hash the URL, long-lived Cache-Control, infinite CDN cache.
Skipping prerender because "SSR is fast enough"Prerender is not about latency, it is about turning first-request MISS into permanent HIT. Blog / about / docs default locale must ship as HTML.
Flattening the route FSKeep a Next-like nested tree even under explicit routes.ts. It survives contributor rotation and matches URL 1:1.
Mixing feature code into routes/routes/ holds entry files only. All feature code lives in src/features/<domain>/.
Porting all 17 locale variants at prerender timeBuild minutes explode. Prerender default locale only; other locales dynamic.
One-shot cut over all URL groupsPhased cut — leave legacy Next site running for un-ported URL groups. Use the sibling skill for the traffic split.
Loader boundary shows no pending UI on client navRR8 does not render pending UI by default. Add a pending-loading.tsx skeleton per route segment (mirrors Next loading.tsx). Do not use antd Skeleton — the lobehub-ui variant differs.
Emoji-lookalike imports from @lobehub/ui where base-ui fitsPrefer @lobehub/ui/base-ui for headless primitives; keeps the SSR CSS smaller and avoids theme-token surprises.

Rules

  • SSR varies only by URL. No exceptions on public routes. If a variance is required (auth, session), that route is NO_STORE.
  • Skill first, cut second. Do not remove the legacy site until the new site's cf-cache-status HIT ratio matches the target.
  • Every route declares a Cache-Control profile. No implicit defaults; explicit headers export per route.
  • Middleware logic mirrors in the root loader. Two homes, one behaviour.

Verification

  • bun run build produces /middleware.js with no unresolved aliases (grep for @/ in the emitted bundle → zero hits).
  • bun run start serves the production build.
  • curl -I https://<host>/ twice: second response has cf-cache-status: HIT and vercel-cache: MISS (Vercel is pass-through by design).
  • No public route emits Set-Cookie in its SSR response.
  • curl -I https://<host>/blog/<slug>.data returns a body but is not cached at the CDN (cf-cache-status: BYPASS or MISS); that route was demoted to a client fetch instead if it appears on hot paths.
  • First paint shows the correct theme (light or dark) with no white → dark repaint. Test with prefers-color-scheme: dark and with theme=dark in localStorage.
  • NEXT_LOCALE=zh cookie on /blog/foo triggers 307 to /zh/blog/foo — both in dev (root-loader mirror) and prod (Vercel Routing Middleware).
  • build/client/blog/**/*.html exists for the prerendered default locale.
  • Every route module exports headers and each profile in references/cache-control-profiles.md appears at least once in the emitted route table.
  • Legacy site still serves the un-ported URL groups; traffic split config committed alongside the migration cut.

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Nextjs Rsc To React Router V8 Migration?

Verwenden Sie diesen Skill, wenn Sie eine mehrsprachige Next.js-RSC-/App-Router-Website zu React Router v8 migrieren, damit SSR-HTML vom CDN gecacht werden kann. RSC-Payloads lassen sich am Edge nicht cachen, und die Kombination aus Sprachversionen und Seitenanzahl vervielfacht die Kosten. Behandelt die Schritte in der richtigen Reihenfolge: SSR-Varianten aufgrund von UA, Geo und Cookies entfernen, `.data`-Loader von Client-Fetches trennen, Theme-SSR neu aufsetzen (next-themes + Head-Skript + /theme-vars.css), Middleware in Vercel Routing Middleware und einen Spiegel im Root-Loader aufteile...

Warum Nextjs Rsc To React Router V8 Migration in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Nextjs Rsc To React Router V8 Migration besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Nextjs Rsc To React Router V8 Migration in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/Innei/SKILL/tree/main/skills/infrastructure/nextjs-rsc-to-react-router-v8-migration ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Nextjs Rsc To React Router V8 Migration nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Nextjs Rsc To React Router V8 Migration verwenden?

So viele Sie möchten. In TypingMind können Sie Nextjs Rsc To React Router V8 Migration mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Nextjs Rsc To React Router V8 Migration kostenlos?

Der Skill wird von Innei auf GitHub veröffentlicht. Prüfen Sie im Repository, ob dort Lizenzbedingungen angegeben sind. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇