Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

b2c-page-designerB2C 页面设计师

Agent Skill

b2c-page-designer 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,818

周安装

75

GitHub Stars

38

下载量

594
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:b2c-page-designer(B2C 页面设计师)
来源仓库:https://github.com/salesforcecommercecloud/b2c-developer-tooling
仓库路径:skills/b2c-page-designer
安装命令:
npx skills add https://github.com/salesforcecommercecloud/b2c-developer-tooling --skill b2c-page-designer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/salesforcecommercecloud/b2c-developer-tooling --skill b2c-page-designer

简介

用于创建 Page Designer 可视化编辑器的自定义页面类型与组件类型。

  • 支持拖拽式内容块配置和区域布局定义。b2c-page-designer 属于前端设计类 Skill,可作为该场景下的辅助能力补充。
  • 文件结构包含 JSON 元数据、JS 逻辑和模板定义。
  • 安装需使用 npx skills add 命令从指定 GitHub 仓库添加技能。
  • 开发新组件时应遵循平台规范,确保与现有页面兼容。

SKILL.md

Page Designer Skill

This skill guides you through creating custom Page Designer page types and component types for Salesforce B2C Commerce.

Overview

Page Designer allows merchants to create and manage content pages through a visual editor. Developers create:

  1. Page Types - Define page structures with regions
  2. Component Types - Reusable content blocks with configurable attributes

File Structure

Page Designer files are in the cartridge's experience directory:

/my-cartridge
    /cartridge
        /experience
            /pages
                homepage.json           # Page type meta definition
                homepage.js             # Page type script
            /components
                banner.json             # Component type meta definition
                banner.js               # Component type script
        /templates
            /default
                /experience
                    /pages
                        homepage.isml   # Page template
                    /components
                        banner.isml     # Component template

Naming: The .json and .js files must have matching names. Use only alphanumeric or underscore in file names and in any subdirectory names under experience/pages or experience/components.

Component types in subfolders: You can put component meta and script in a subdirectory (e.g. experience/components/assets/). The component type ID is then the path with dots: assets.hero_image_block. The template path under templates/default/ must mirror that path (e.g. templates/default/experience/components/assets/hero_image_block.isml), and the script must call Template('experience/components/assets/hero_image_block') so the path matches. Stored ID is component.{component_type_id}; total length must not exceed 256 characters.

Page Types

Meta Definition (pages/homepage.json)

{
    "name": "Home Page",
    "description": "Landing page with hero and content regions",
    "region_definitions": [
        {
            "id": "hero",
            "name": "Hero Section",
            "max_components": 1
        },
        {
            "id": "content",
            "name": "Main Content"
        },
        {
            "id": "footer",
            "name": "Footer Section",
            "component_type_exclusions": [
                { "type_id": "video" }
            ]
        }
    ]
}

Page Script (pages/homepage.js)

'use strict';

var Template = require('dw/util/Template');
var HashMap = require('dw/util/HashMap');

module.exports.render = function (context) {
    var model = new HashMap();
    var page = context.page;

    model.put('page', page);

    return new Template('experience/pages/homepage').render(model).text;
};

Page Template (templates/experience/pages/homepage.isml)

<isdecorate template="common/layout/page">
    <isscript>
        var PageRenderHelper = require('*/cartridge/experience/utilities/PageRenderHelper');
    </isscript>

    <div class="homepage">
        <div class="hero-region">
            <isprint value="${PageRenderHelper.renderRegion(pdict.page.getRegion('hero'))}" encoding="off"/>
        </div>

        <div class="content-region">
            <isprint value="${PageRenderHelper.renderRegion(pdict.page.getRegion('content'))}" encoding="off"/>
        </div>

        <div class="footer-region">
            <isprint value="${PageRenderHelper.renderRegion(pdict.page.getRegion('footer'))}" encoding="off"/>
        </div>
    </div>
</isdecorate>

Component Types

Meta Definition (components/banner.json)

{
    "name": "Banner",
    "description": "Promotional banner with image and CTA",
    "group": "content",
    "region_definitions": [],
    "attribute_definition_groups": [
        {
            "id": "image",
            "name": "Image Settings",
            "attribute_definitions": [
                {
                    "id": "image",
                    "name": "Banner Image",
                    "type": "image",
                    "required": true
                },
                {
                    "id": "alt",
                    "name": "Alt Text",
                    "type": "string",
                    "required": true
                }
            ]
        },
        {
            "id": "content",
            "name": "Content",
            "attribute_definitions": [
                {
                    "id": "headline",
                    "name": "Headline",
                    "type": "string",
                    "required": true
                },
                {
                    "id": "body",
                    "name": "Body Text",
                    "type": "markup"
                },
                {
                    "id": "ctaUrl",
                    "name": "CTA Link",
                    "type": "url"
                },
                {
                    "id": "ctaText",
                    "name": "CTA Button Text",
                    "type": "string"
                }
            ]
        },
        {
            "id": "layout",
            "name": "Layout Options",
            "attribute_definitions": [
                {
                    "id": "alignment",
                    "name": "Text Alignment",
                    "type": "enum",
                    "values": ["left", "center", "right"],
                    "default_value": "center"
                },
                {
                    "id": "fullWidth",
                    "name": "Full Width",
                    "type": "boolean",
                    "default_value": false
                }
            ]
        }
    ]
}

Component meta: Always include region_definitions. Use [] when the component has no nested regions (no slots for other components).

Component Script (components/banner.js)

'use strict';

var Template = require('dw/util/Template');
var HashMap = require('dw/util/HashMap');
var URLUtils = require('dw/web/URLUtils');

module.exports.render = function (context) {
    var model = new HashMap();
    var content = context.content;

    // Access merchant-configured attributes
    model.put('image', content.image);        // Image object
    model.put('alt', content.alt);            // String
    model.put('headline', content.headline);  // String
    model.put('body', content.body);          // Markup string
    model.put('ctaUrl', content.ctaUrl);      // URL object
    model.put('ctaText', content.ctaText);    // String
    model.put('alignment', content.alignment || 'center');
    model.put('fullWidth', content.fullWidth);

    return new Template('experience/components/banner').render(model).text;
};

Template path: The path passed to Template(...) must match the template path under templates/default/. If the component lives in a subfolder (e.g. experience/components/assets/hero_image_block), use Template('experience/components/assets/hero_image_block') and place the ISML at templates/default/experience/components/assets/hero_image_block.isml.

Handling colors (string or color picker object): If an attribute can be a hex string or a color picker object {color: "#hex"}, use a small helper so the script works with both:

function getColor(colorAttr) {
    if (!colorAttr) return '';
    if (typeof colorAttr === 'string' && colorAttr.trim()) return colorAttr.trim();
    if (colorAttr.color) return colorAttr.color;
    return '';
}

Component Template (templates/experience/components/banner.isml)

<div class="banner ${pdict.fullWidth ? 'banner--full-width' : ''}"
     style="text-align: ${pdict.alignment}">
    <isif condition="${pdict.image}">
        <img src="${pdict.image.file.absURL}"
             alt="${pdict.alt}"
             class="banner__image"/>
    </isif>

    <div class="banner__content">
        <h2 class="banner__headline">${pdict.headline}</h2>

        <isif condition="${pdict.body}">
            <div class="banner__body">
                <isprint value="${pdict.body}" encoding="off"/>
            </div>
        </isif>

        <isif condition="${pdict.ctaUrl && pdict.ctaText}">
            <a href="${pdict.ctaUrl}" class="banner__cta btn btn-primary">
                ${pdict.ctaText}
            </a>
        </isif>
    </div>
</div>

Attribute Types

TypeDescriptionReturns
stringText inputString
textMulti-line textString
markupRich text editorMarkup string (use encoding="off")
booleanCheckboxBoolean
integerNumber inputInteger
enumSingle select dropdownString
imageImage pickerImage object with file.absURL
fileFile pickerFile object
urlURL pickerURL string
categoryCategory selectorCategory object
productProduct selectorProduct object
pagePage selectorPage object
customJSON object or custom editorObject (or editor-specific)

Enum — critical for component visibility: Use a string array for values: "values": ["left", "center", "right"]. Do not use objects like {"value": "x", "display_value": "X"}; that format can cause the component type to be rejected and not appear in the Page Designer component list.

Custom and colors: type: "custom" with e.g. editor_definition.type: "styling.colorPicker" requires a cartridge that provides that editor on the Business Manager site cartridge path. If the component does not show up in the editor, use type: "string" for color attributes (merchant types a hex). In the script, support both: accept a string or an object like {color: "#hex"} (e.g. a small getColor(attr) helper that returns the string).

default_value: Used for storefront rendering only; it is not shown as preselected in the Page Designer visual editor.

Region Definitions

{
    "region_definitions": [
        {
            "id": "main",
            "name": "Main Content",
            "max_components": 10,
            "component_type_exclusions": [
                { "type_id": "heavy-component" }
            ],
            "component_type_inclusions": [
                { "type_id": "text-block" },
                { "type_id": "image-block" }
            ]
        }
    ]
}
PropertyDescription
idUnique region identifier
nameDisplay name in editor
max_componentsMax number of components (optional)
component_type_exclusionsComponents NOT allowed
component_type_inclusionsOnly these components allowed

Rendering Pages

In Controllers

var PageMgr = require('dw/experience/PageMgr');

server.get('Show', function (req, res, next) {
    var page = PageMgr.getPage(req.querystring.cid);

    if (page && page.isVisible()) {
        res.page(page.ID);
    } else {
        res.setStatusCode(404);
        res.render('error/notfound');
    }
    next();
});

In ISML

<isscript>
    var PageMgr = require('dw/experience/PageMgr');
    var page = PageMgr.getPage('homepage-id');
</isscript>

<isif condition="${page && page.isVisible()}">
    <isprint value="${PageMgr.renderPage(page.ID)}" encoding="off"/>
</isif>

Component Groups

Organize components in the editor sidebar:

{
    "name": "Product Card",
    "group": "products"
}

Common groups: content, products, navigation, layout, media

If the component does not appear in Page Designer

  1. Enums: Ensure all enum attributes use "values": ["a", "b"] (string array), not objects with value/display_value.
  2. Custom editors: Replace type: "custom" (e.g. color picker) with type: "string" for the problematic attributes and redeploy; if the component then appears, the issue is likely the custom editor or BM cartridge path.
  3. Naming: File and subdirectory names only alphanumeric or underscore.
  4. region_definitions: Component meta must include region_definitions (use [] if no nested regions).
  5. Template path: Script Template('...') path must match the template path under templates/default/ (including subfolders like experience/components/assets/...).
  6. Logs: In Business Manager, Administration > Site Development > Development Setup, check error logs when opening Page Designer for script or meta errors related to your component type ID.
  7. Code version: Deploy the cartridge to the correct code version; in non-production, meta can be cached for a few seconds—try a code version switch or short wait.

Best Practices

  1. Use dw.util.Template for rendering (NOT dw.template.ISML)
  2. Keep components self-contained - avoid cross-component dependencies
  3. Provide default values for optional attributes (they apply to rendering; not shown as preselected in the editor)
  4. Group related attributes in attribute_definition_groups
  5. Use meaningful IDs - they're used programmatically
  6. Don't change type IDs or attribute types after merchants create content (creates inconsistency with stored data); add a new component type and deprecate the old one if needed
  7. Prefer string arrays for enums and string for colors unless you control the BM cartridge path and custom editors

Detailed Reference

For comprehensive attribute documentation:

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.47%
按下载量换算205

Claude

31.64%
按下载量换算188

Cursor

17.04%
按下载量换算101

Gemini CLI

9.87%
按下载量换算59

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills