sfnext-page-designer
FreeNo executable scriptsNot checkedBuild merchant-editable Page Designer content in a Storefront Next project: components decorated with @Component/@AttributeDefinition/@RegionDefinition, page…
by SalesforceCommerceCloud★ 58 GitHub starsAbout this skill
Page Designer in Storefront Next
In Storefront Next your React components are the Page Designer components. You annotate them with decorators, the build generates Business Manager metadata (JSON) from those decorators, and at runtime a route loader fetches the page structure from the Shopper Experience API and <Region> renders it.
The in-project guide is docs/README-PAGE-DESIGNER.md and the rules in AGENTS.md apply; this skill is the task-oriented path through them. Where the guide and the source disagree, trust the source.
Pieces and where they live
| Piece | Location in your project |
|---|---|
Decorators (Component, AttributeDefinition, RegionDefinition, PageType) |
@/lib/decorators (src/lib/decorators/) |
| Page fetch with per-component loader promises | fetchPageWithComponentData in @/lib/page-designer/page-loader.server |
| Single-component fetch (preview, embedded) | fetchComponentWithComponentData in @/lib/page-designer/component-loader.server |
| Region renderer | Region from @/components/region |
| Generated registry (do not hand-edit) | src/lib/page-designer/static-registry.ts |
Runtime hooks (usePageDesignerMode) |
@salesforce/storefront-next-runtime/design/react/core |
| Design/preview mode detection in loaders | isDesignModeActive / isPreviewModeActive from @salesforce/storefront-next-runtime/design/mode |
| Generated Business Manager metadata | cartridges/app_storefrontnext_base/cartridge/experience/{components,pages,aspects} |
The runtime package's /design entry exports only the registry. Decorators come from your project, not from @salesforce/storefront-next-runtime.
Workflow
- Create or edit the component (metadata class, props, default export,
fallback, optionalloader) undersrc/components/<name>/index.tsx. - Run
pnpm dev(orpnpm build). The Vite plugin scanssrc/componentsfor@Componentand rewrites the registry between theSTATIC_REGISTRY_START/ENDmarkers. pnpm cartridge:generatewrites the metadata JSON (pnpm buildruns it for you).pnpm cartridge:validatechecks the generated JSON against the schemas. Generation also fails on an invalid attribute config (for example a badsearchingcombination).pnpm cartridge:deployuploads the cartridge to the B2C instance (pnpm cartridge:deploy -- --deleteremoves old cartridge files first). The optional MCP toolcartridge_deploydoes the same. Seeb2c-cli:b2c-codefor credentials and code-version handling.- In Business Manager, merchants build pages from the new palette entries. See Business Manager.
A component
// src/components/promo-banner/index.tsx
import { AttributeDefinition, Component, RegionDefinition } from '@/lib/decorators';
import { DynamicImage } from '@/components/dynamic-image';
import { type Image } from '@/types';
import { cn } from '@/lib/utils';
@Component('promoBanner', {
name: 'Promo Banner',
description: 'Headline and optional image. Headline text and alignment are editable.',
group: 'Content',
})
@RegionDefinition([])
export class PromoBannerMetadata {
@AttributeDefinition({ id: 'headline', name: 'Headline', type: 'string', required: true, defaultValue: 'Spring sale' })
headline?: string;
@AttributeDefinition({ id: 'image', name: 'Image', type: 'image' })
image?: Image;
@AttributeDefinition({ id: 'align', name: 'Alignment', type: 'enum', values: ['left', 'center'], defaultValue: 'left' })
align?: 'left' | 'center';
}
interface PromoBannerProps {
headline?: string;
image?: Image;
align?: 'left' | 'center';
className?: string;
}
// Page Designer also injects component, data, designMetadata and regionId.
// Never spread them onto a DOM element; destructure them out first if you forward ...rest.
export default function PromoBanner({ headline = 'Spring sale', image, align = 'left', className }: PromoBannerProps) {
return (
<section className={cn('relative', align === 'center' && 'text-center', className)}>
{image?.url && <DynamicImage src={image.url} alt="" />}
<h2>{headline}</h2>
</section>
);
}
// REQUIRED. Rendered in a Suspense boundary; receives the same attribute props. Keep it light.
export function fallback() {
return <div className="h-48 animate-pulse bg-muted" />;
}
Rules that matter:
- Attribute values arrive as props named after the class field, so the field name and
idmust agree. - The metadata class must be
exported; the generator only sees exported classes. - The
typeIdmust be a string literal. It is stored as<group>.<typeId>(default groupstorefrontnext_base), for exampleContent.promoBanner. Use thegroupoption (Content,Layout, ...) so related components sit together in the palette. - An
imageattribute delivers an object ({ url, focalPoint?, metaData? }), typedImagefrom@/types,
Install sfnext-page-designer in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the sfnext-page-designer skill do?
Build merchant-editable Page Designer content in a Storefront Next project: components decorated with @Component/@AttributeDefinition/@RegionDefinition, page routes decorated with @PageType, Region component rendering, fetchPageWithComponentData, component loaders and fallbacks, the generated static registry, and the pnpm cartridge:generate / cartridge:validate / cartridge:deploy workflow. Use when adding or editing a Page Designer component, exposing a region on a route (home, PDP, PLP, search), fetching a page by pageId or aspectType, marking a Region critical, debugging a component that does not appear in the Business Manager palette or renders empty, or reviewing Page Designer code. Do not use for classic ISML/SFRA Page Designer (use `b2c:b2c-page-designer`), for turning a Figma frame into blocks (use `figma-to-sfnext-pagedesigner:figma-to-sfnext-pagedesigner`), or for plain React components that merchants never edit (use `storefront-next:sfnext-components`).
How do I install the sfnext-page-designer skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the sfnext-page-designer skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
by Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
by Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
by Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
by Anthropic