/storefront-next:sfnext-componentsfrom storefront-next
Builds and modifies UI components in a Storefront Next storefront: page components with Suspense, Tailwind v4 token classes, shadcn/ui primitives, CVA variants, DynamicImage, and Storybook stories with snapshot tests.
Ships in storefront-next. 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.
Read when SKILL.md points to them.
How to write, style, and verify components in your storefront. Your project already ships the rules in AGENTS.md, docs/README-UI-STYLING.md, docs/README-SHAPE-TOKENS.md, docs/README-SUSPENSE.md, and docs/README-STORYBOOK.md; this skill is the task-oriented path through them.
src/components/ for an existing component (ls src/components). Extend or compose it before adding a new one.src/components/ui/. Only shadcn forks live there.src/components/<kebab-name>/.src/extensions/ (see storefront-next:sfnext-extensions).src/components/my-widget/
├── index.tsx # implementation (default or named export)
├── index.test.tsx # Vitest + Testing Library
└── stories/
├── index.stories.tsx # Storybook (stories/ subfolder is required)
├── my-widget-snapshot.tsx # optional snapshot fixture
└── __snapshots__/ # generated baselines, commit them
Every .ts/.tsx file needs the Apache header enforced by the custom/header-format lint rule. Copy it from any existing file (or AGENTS.md).
cn() from @/lib/utils. No CSS modules, no per-component CSS files, no style={{}} (a truly dynamic API-driven value is the only exception).src/theme/ only (entry src/theme/index.css). There is no src/app.css.custom/color-linter rule fails pnpm lint on raw palette classes such as text-white or bg-red-500; use text-primary-foreground, text-destructive-foreground, bg-card, text-muted-foreground, border-border.bg-header-background, text-header-foreground, bg-header-menu-background, bg-footer-background. Do not write bg-[--header-background].src/theme/tokens/*.css and a --color-x: var(--x) line inside @theme inline in src/theme/tailwind.css. See TOKEN-SYSTEM.md..dark token block. Do not promise dark mode in component work.sm, md, lg, xl, 2xl).Radius, shadow, and card border width come from three variables in src/theme/tokens/core.css: --ui-radius, --ui-shadow, --ui-border-width, consumed through rounded-ui, shadow-ui, border-ui.
rounded-xl, rounded-none, shadow-md, shadow-none, or border-0 to a primitive or a Card to force a shape. Change the token, or scope it: <Card className="[--ui-radius:var(--radius-xl)]">.--ui-radius). Writing the bridge names --radius-ui / --shadow-ui is a silent no-op.border-ui is Card-only. To show a Card border use [--ui-border-width:1px], not border.Full mechanism and scoped-override recipes: SHAPE-TOKENS.md.
Route components receive loaderData with deferred fields as unresolved promises. Rules from AGENTS.md: one <Suspense> per async operation, stable promise identity (never Promise.all/.then in render; compose in the loader), skeletons where layout is known.
import { Suspense, use } from 'react';
import { Await } from 'react-router';
function Reviews({ promise }: { promise: Promise<ReviewsData> }) {
const reviews = use(promise);
return <ReviewList reviews={reviews} />;
}
export default function ProductPage({ loaderData }: { loaderData: PageData }) {
return (
<>
{/* use() needs a small child component */}
<Suspense fallback={<ReviewsSkeleton />}>
<Reviews promise={loaderData.reviews} />
</Suspense>
{/* Await resolves inline and supports a local errorElement */}
<Suspense fallback={<RecsSkeleton />}>
<Await resolve={loaderData.recommendations}>{(recs) => <Recommendations items={recs} />}</Await>
</Suspense>
</>
);
}
createPage (@/components/create-page) wraps a component with the standard Suspense fallback and keys the page so navigations remount it:
import { createPage } from '@/components/create-page';
export default createPage({
component: CategoryView,
fallback: <CategorySkeleton />, // optional; default is a generic skeleton
getPageKey: (data) => data?.categoryId, // optional; default is pathname+search+hash
});
withSuspense (@/components/with-suspense) is the lower-level HOC for a single async child. Details: docs/README-SUSPENSE.md.
Link/NavLink from @/components/link and useNavigate from @/hooks/use-navigate, never from react-router. The wrappers add the site/locale URL prefix; the originals silently drop it. Combine with href() for typed params.react-i18next (useTranslation) and prices through formatCurrency in @/lib/currency. Do not hard-code 'en-US' or $. See storefront-next:sfnext-i18n.Use <DynamicImage> (@/components/dynamic-image) with widths (and heights for cropping) for product and content images; add priority="high" to the LCP image. Behavior is configured under the images key of config.server.ts (quality, formats, fallbackFormat, host, enableDis, realmHostMappings); see docs/README-IMAGES.md. Wrap grids in DynamicImageProvider (@/providers/dynamic-image) instead of prop-drilling sizes.
Modals, drawers, and dialogs hidden on first render must be React.lazy() and mounted only after first interaction, gated on open with useDeferredUnmount from @/hooks/use-deferred-unmount. Do not keep a sticky "loaded" latch. Pattern: docs/README-PERFORMANCE.md ("Lazy Loading for Overlays").
src/components/ui/ files are forks of shadcn/ui that you own and may edit in place (shape tokens, data-slot, extra props). Do not put non-shadcn components there, and do not hand-copy from the shadcn docs. Use the in-project sync-shadcn skill (.claude/skills/sync-shadcn/):
S=.claude/skills/sync-shadcn/sync.mjs
node $S add slider # fetch from shadcn, apply shape tokens + import convention, seed baseline
node $S restyle --all --check # gate: exit 1 if any fork has drifted off the shape-token rules
node $S restyle src/components/ui/toggle.tsx # normalize one file
Prefer add over npx shadcn@latest add: npx pulls the older new-york registry style and leaves raw rounded-md/shadow-sm classes you then have to restyle. To pull upstream fixes into an existing fork, use status / sync <name> / diff <name> / advance <name> (a 3-way merge that keeps your edits); these need a merge baseline in .shadcn-baseline/, which add and sync <name> --bootstrap create. Read .claude/skills/sync-shadcn/SKILL.md for conflict handling. If it mentions a path that does not exist in your project, use the ui directory configured in components.json.
Each reusable component needs stories/*.stories.tsx using @storybook/react-vite and a title from the fixed taxonomy (Products/Product Tile/Product Tile). src/components/ui/ is excluded from story coverage. Details and the snapshot fixture pattern: STORYBOOK.md.
pnpm typecheck
pnpm lint # oxlint (color-linter, header, a11y rules) + biome format check
pnpm test # Vitest
pnpm storybook:test --type=snapshot # add --update only for intended DOM changes
pnpm storybook:test --type=a11y # axe-core; new stories must pass
Interaction and a11y runs need Chromium once (pnpm exec playwright install chromium).
storefront-next:sfnext-theming - Change palette, fonts, logo, and shape for your brandstorefront-next:sfnext-data-fetching - Loaders that feed data to componentsstorefront-next:sfnext-page-designer - Make a component Page Designer-editablestorefront-next:sfnext-extensions - Extension folders and UI targetsstorefront-next:sfnext-testing - Vitest, Storybook, and e2e testingstorefront-next:sfnext-accessibility - Accessibility requirements and scansstorefront-next:sfnext-i18n - Translating component textstorefront-next:sfnext-performance - Lazy loading, images, bundle sizeWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub salesforcecommercecloud/b2c-developer-tooling --plugin storefront-next25 skills in this plugin
/sfnext-accessibilityBuild and fix accessible UI in a Storefront Next storefront (WCAG 2.1 AA): jsx-a11y lint findings, missing accessible names and labels, form error association, dialog focus management, aria-live status messages, keyboard behavior, color contrast, and verifying fixes with Storybook a11y/play() tests and the e2e axe scan with its baseline. Use for "accessibility", "a11y", "WCAG", "screen reader", "aria-label", "focus trap", "axe violation", pnpm lint:a11y, pnpm a11y, a11y-baseline.json, skip-a11y, STORYBOOK_A11Y_TEST_MODE, or an accessibility audit finding to fix. Do not use for general lint/typecheck gates (use `storefront-next:sfnext-quality-gates`), writing non-accessibility tests (use `storefront-next:sfnext-testing`), or color/token design (use `storefront-next:sfnext-theming`)./sfnext-analytics-consentStorefront Next analytics: engagement adapters (Einstein, Active Data, Data 360), adding a custom adapter, tracking consent gating, PageViewTracker, useAnalytics events, and first-touch attribution (dw_attribution). Use when configuring engagement.adapters in config.server.ts, writing an adapter with hasConsent, registering it in initializeEngagementAdapters, wiring the consent banner (trackingConsent, consentCategories, dw_dnt), firing trackViewProduct/trackCartItemAdd events, debugging why no analytics events are sent, or passing campaign attribution to orders. Do not use for general config loading or env vars (use `storefront-next:sfnext-configuration`), CSP/script allowlisting of third-party tags (use `storefront-next:sfnext-security`), or SEO meta/JSON-LD (use `storefront-next:sfnext-seo`).Other plugins' skills for the same job