/sitecore-content-sdk-nextjs-app-router:content-sdk-app-router-component-variantsfrom Sitecore Content SDK - Next.js App Router
Implements component variants in a Sitecore Content SDK Next.js App Router app — one component type with multiple presentations selected by rendering variant or data. Useful when users ask for variants, versions, or multiple renderings of a component.
Ships in Sitecore Content SDK - Next.js App Router. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
One component definition can have multiple presentations or data-driven variants. Keep registration and layout aligned. This app does not use getComponentData; layout/placeholder data comes from getPage.
The SDK resolves a variant from the rendering's params.FieldNames to a named export, case-sensitive. Same componentName, one folder, one file per variant (<Name>.<Variant>.tsx); generate-map merges every variant's exports into a single map entry.
// src/components/Promo/Promo.Card.tsx — a variant of Promo
import { JSX } from 'react';
import type { PromoProps } from './Promo';
export const Card = ({ fields }: PromoProps): JSX.Element => (
<article className="promo-card">{/* card-specific layout, same fields */}</article>
);
export default Card;
// .sitecore/component-map.ts — `sitecore-tools project component generate-map` merges variants
import * as Promo from 'src/components/Promo/Promo'; // provides the default fallback
import * as PromoCard from 'src/components/Promo/Promo.Card'; // exports `Card`
export const componentMap = new Map<string, NextjsContentSdkComponent>([
// main module spread LAST so its `default` wins as the fallback; `Card` stays a named export
['Promo', { ...PromoCard, ...Promo }], // named export `Card` + default fallback under ONE componentName
]);
Resolution: FieldNames: "Card" → component.Card; empty / missing / "Default" → component.default fallback; any unmatched name → <MissingComponent> + console warning (case-sensitive: "card" ≠ "Card"). The variant also needs a CMS Headless Variant item to appear in the Pages dropdown. CM-side, a raw __Renderings write stores the variant item's GUID in FieldNames, not its name. Once any variant item exists, a missing FieldNames resolves to the alphabetically first variant, not Default. Full runtime contract + failure modes: content-sdk-variants-vs-siblings.
.sitecore/component-map.ts (Server) or .sitecore/component-map.client.ts (Client) as appropriate. If the app uses one key per variant, register each; if one key with variant param, single registration. Follow existing app convention.npm run sitecore-tools:generate-map (it also runs on npm run dev / npm run build) rather than editing them — the generator merges every <Name>.<Variant>.tsx export into the one map entry, which is easy to get wrong by hand.MissingComponent on a miss): content-sdk-variants-vs-siblings.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub chris1415/sitecore-skills-pocs --plugin sitecore-content-sdk-nextjs-app-router17 skills in this plugin
/content-sdk-app-router-atom-createWrites a Content SDK atom (beta.atoms): atom vs component, field schemas and enum tokens, renderer, catalog and registry keys, container slots, lock lifecycle, mock-MMS proof. Use when adding or changing an atom. Not wiring atoms into an app./content-sdk-app-router-atomsContent SDK Atoms (beta.atoms only): catalog, atomsConfig, ComponentRef rendering, lock CI gate, runtime CSS, Content Kit install, null-render traps. Use when wiring atoms or a low-code component renders nothing. Not code components or stable apps./content-sdk-app-router-cache-components-and-osrOn-demand revalidation (OSR) for a Content SDK App Router app: template choice, version floor, /api/revalidate contract, cache tags, cacheProfile. Use when content is stale after publish. Not Edge webhook setup./content-sdk-app-router-component-data-strategyHow component data flows in a Content SDK App Router app: layout data from getPage, editing data, site and locale from route params, Server vs Client components, BYOC. Use when wiring component props or choosing server vs client./content-sdk-app-router-component-level-navigationNavigation via component-level GraphQL in a Content SDK App Router app: server fetches top levels, client lazy-loads deeper ones via a route handler. Use for main, footer or sidebar nav, or when the SXA nav resolver returns empty./content-sdk-app-router-component-registrationRegisters components in the generated Content SDK App Router component maps (.sitecore/component-map*.ts, never hand-edited). Use when adding a component, a placeholder shows the raw name, or the editor cannot find a component.Other plugins' skills for the same job