Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

sfnext-page-designer

FreeNo executable scriptsNot checked

Build merchant-editable Page Designer content in a Storefront Next project: components decorated with @Component/@AttributeDefinition/@RegionDefinition, page…

SalesforceCommerceCloudby SalesforceCommerceCloud★ 58 GitHub stars

About 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

  1. Create or edit the component (metadata class, props, default export, fallback, optional loader) under src/components/<name>/index.tsx.
  2. Run pnpm dev (or pnpm build). The Vite plugin scans src/components for @Component and rewrites the registry between the STATIC_REGISTRY_START/END markers.
  3. pnpm cartridge:generate writes the metadata JSON (pnpm build runs it for you).
  4. pnpm cartridge:validate checks the generated JSON against the schemas. Generation also fails on an invalid attribute config (for example a bad searching combination).
  5. pnpm cartridge:deploy uploads the cartridge to the B2C instance (pnpm cartridge:deploy -- --delete removes old cartridge files first). The optional MCP tool cartridge_deploy does the same. See b2c-cli:b2c-code for credentials and code-version handling.
  6. 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 id must agree.
  • The metadata class must be exported; the generator only sees exported classes.
  • The typeId must be a string literal. It is stored as <group>.<typeId> (default group storefrontnext_base), for example Content.promoBanner. Use the group option (Content, Layout, ...) so related components sit together in the palette.
  • An image attribute delivers an object ({ url, focalPoint?, metaData? }), typed Image from @/types,
Full SKILL.md on GitHub

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
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

evals/trigger-evals.jsonreferences/BUSINESS-MANAGER.mdreferences/COMPONENT-REGISTRY.mdreferences/DECORATOR-PATTERNS.mdreferences/REVIEW-CHECKLIST.mdreferences/TROUBLESHOOTING.md

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

Compare sfnext-page-designer with