/storefront-next:sfnext-performancefrom storefront-next
Reviews Storefront Next storefront performance: LCP, CLS, TBT, Suspense placement, promise identity, lazy modals/drawers, image priority, font loading, resource hints, bundle size, and Lighthouse CI. Use for slow pages, LCP regressions, skeleton flashes, or pre-merge performance review.
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.
Performance rules are part of AGENTS.md ("Performance & Data Rules") and detailed in docs/README-PERFORMANCE.md, docs/README-SUSPENSE.md, docs/README-IMAGES.md and docs/README-PERFORMANCE-METRICS.md in your project. This skill is the working summary plus a checklist to run on your own diff: PERFORMANCE-REVIEW-CHECKLIST.md.
storefront-next:sfnext-data-fetching).<Suspense> per async operation, with a skeleton that reserves the final size. No fallback={null} above the fold unless space is reserved.loaderData/props, never Promise.all/.then/new Promise in render, never useMemo around a promise. Escape hatches: useState(() => ...) pinning or useRef re-pinning.use()/<Await> consumer needs a <Suspense> ancestor; otherwise it blocks the first byte of the streamed shell.React.lazy and mounted only while needed.async/defer.import { lazy, Suspense, useState } from 'react';
import { useDeferredUnmount } from '@/hooks/use-deferred-unmount';
const SizeGuide = lazy(() => import('@/components/size-guide').then((m) => ({ default: m.SizeGuide })));
export function SizeGuideButton() {
const [open, setOpen] = useState(false);
const mounted = useDeferredUnmount(open); // stays mounted briefly after close for the exit animation
return (
<>
<button onClick={() => setOpen(true)}>Size guide</button>
{mounted && (
<Suspense fallback={null}>
<SizeGuide open={open} onOpenChange={setOpen} />
</Suspense>
)}
</>
);
}
Avoid a sticky "loaded" latch (a state that flips true on first open and never resets): fetchers inside the modal stay registered and re-run on every later revalidation. See src/components/product-tile/quick-add-button.tsx.
useDeferredRender(enabled, options) (@/hooks/use-deferred-render) delays mounting a Suspense boundary until an idle frame; use it for large below-the-fold grids. DeferredProductGrid (@/components/product-grid/deferred) is the reference. useDeferredRenderSequence(n) fans out work one step per idle frame.
Mark a region <Region critical> only when it is required for the initial HTML or is an LCP candidate, and await that page in the loader (omit a region fallback). Below-the-fold regions stay streamed. See storefront-next:sfnext-page-designer.
DynamicImage (@/components/dynamic-image). Props: src, alt, widths, heights, imageProps, as, className, loading, priority, objectFit. Give the LCP image priority="high" (React 19 preload) and never lazy-load it. Provide widths matching the layout, or wrap a group in DynamicImageProvider (@/providers/dynamic-image, value={{ widths }}). URL helpers are in docs/README-IMAGES.md.public/fonts/sen-variable.woff2, preloads it in src/root.tsx links, and declares @font-face with font-display: swap in src/theme/base.css. Keep fonts same-origin, preload only the one above-the-fold face, and consider system fonts for secondary text.app.links.preconnect, prefetchDns, prefetch in config.server.ts or via PUBLIC__app__links__preconnect='["https://cdn.example.com"]'. Default preconnects to the image host only.| Task | Command |
|---|---|
| Check bundle size limits (block CI) | pnpm bundlesize |
Interactive treemaps (build/client-bundle-size.html, build/ssr-bundle-size.html) | cross-env BUNDLES_SIZE_ANALYZE=true pnpm build |
| Compare size runs | pnpm bundlesize:compare |
| Lighthouse | pnpm lighthouse:ci |
| Request timings | performance.metrics flags in config.server.ts |
The limits live in the bundlesize block of package.json. If a legitimate change exceeds a limit, state the reason and raise it deliberately; do not use manualChunks to bucket components.
performance.metrics (serverPerformanceMetricsEnabled, serverTimingHeaderEnabled, clientPerformanceMetricsEnabled) are all false in the shipped config.server.ts; docs/README-PERFORMANCE-METRICS.md lists two of them as defaulting to true, but the shipped config wins. Enable them only while debugging, because serverTimingHeaderEnabled adds a Server-Timing header and costs response time. Override via PUBLIC__app__... environment variables (storefront-next:sfnext-configuration).
pnpm typecheck, pnpm lint, pnpm test.pnpm bundlesize when you add dependencies or routes.Impact rule of thumb: traffic of the page x number of instances on it x cost per instance. A fetch in a product tile is multiplied by every tile.
AGENTS.md "Key Documentation" and docs/README-PERFORMANCE.md. b2c docs search "storefront next performance" or docs_search MCP tool.
storefront-next:sfnext-data-fetching - loaders, streamingstorefront-next:sfnext-revalidation - cutting wasted loader re-runsstorefront-next:sfnext-state-management - render scope and storesstorefront-next:sfnext-components - component conventionsstorefront-next:sfnext-page-designer - critical regionsstorefront-next:sfnext-quality-gates - lint, typecheck, tests before mergestorefront-next:sfnext-deployment - bundle and MRT limitsb2c-cli:b2c-mrt - Managed Runtime logs and deploysWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
storefront-next, lcp, cls, tbt, suspense, lighthouse-ci, bundle-size
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