Agent Skillsforcedotcom/sf-skills › experience-ui-bundle-metadata-generate

experience-ui-bundle-metadata-generate

GitHub

用于在Salesforce项目中生成、配置和管理UI Bundle。涵盖脚手架创建、元数据文件编辑及CSP站点注册,确保Bundle正确关联目标并部署。

skills/experience-ui-bundle-metadata-generate/SKILL.md forcedotcom/sf-skills

Trigger Scenarios

项目包含 uiBundles/*/src/ 目录 需要搭建新的 UI bundle 或应用 编辑 ui-bundle.json、.uibundle-meta.xml 或 CSP trusted site 文件

Install

npx skills add forcedotcom/sf-skills --skill experience-ui-bundle-metadata-generate -g -y
More Options

Use without installing

npx skills use forcedotcom/sf-skills@experience-ui-bundle-metadata-generate

指定 Agent (Claude Code)

npx skills add forcedotcom/sf-skills --skill experience-ui-bundle-metadata-generate -a claude-code -g -y

安装 repo 全部 skill

npx skills add forcedotcom/sf-skills --all -g -y

预览 repo 内 skill

npx skills add forcedotcom/sf-skills --list

SKILL.md

Frontmatter
{
    "name": "experience-ui-bundle-metadata-generate",
    "metadata": {
        "version": "1.0"
    },
    "description": "MUST activate when the project contains a uiBundles\/*\/src\/ directory and scaffolding a new UI bundle or app, or when editing ui-bundle.json, .uibundle-meta.xml, or CSP trusted site files. Use this skill when scaffolding with sf template generate ui-bundle, configuring ui-bundle.json (routing, headers, outputDir), or registering CSP Trusted Sites. Activate when the task involves files matching *.uibundle-meta.xml, ui-bundle.json, or cspTrustedSites\/*.cspTrustedSite-meta.xml."
}

UI Bundle Metadata

Scaffolding a New UI Bundle

Use sf template generate ui-bundle to create new apps — not create-react-app, Vite, or other generic scaffolds.

Always pass --template reactbasic to scaffold a React-based bundle.

UI bundle name (-n): Alphanumerical only — no spaces, hyphens, underscores, or special characters.

Example:

sf template generate ui-bundle -n CoffeeBoutique --template reactbasic

After generation:

  1. Replace all default boilerplate — "React App", "Vite + React", default <title>, placeholder text
  2. Populate the home page with real content (landing section, banners, hero, navigation)
  3. Update navigation and placeholders (see the experience-ui-bundle-frontend-generate skill)
  4. Configure a hosting target — a UI bundle without a <target> in its meta XML will not be visible in the org. Use experience-ui-bundle-custom-app-generate for internal (App Launcher) apps or experience-ui-bundle-site-generate for external (Experience Site) apps.

Always install dependencies before running any scripts in the UI bundle directory.


UIBundle Bundle

A UIBundle bundle lives under uiBundles/<AppName>/ and must contain:

  • <AppName>.uibundle-meta.xml — filename must exactly match the folder name
  • A build output directory (default: dist/) with at least one file

Meta XML

Required fields: masterLabel, version (max 20 chars), isActive (boolean). Optional: description (max 255 chars), target.

Target Field

The <target> element specifies where the UI bundle is hosted:

Value Use Case Companion Metadata
Experience External-facing site via Digital Experience Network, CustomSite, DigitalExperienceConfig, DigitalExperienceBundle
CustomApplication Internal app via Lightning App Launcher CustomApplication (applications/*.app-meta.xml)

A <target> is required for the app to be accessible in a Salesforce org. A UI bundle deployed without a target will not appear anywhere — no App Launcher entry, no Experience Site URL. Always pair the bundle with one of:

  • experience-ui-bundle-site-generate (for Experience target)
  • experience-ui-bundle-custom-app-generate (for CustomApplication target)

Example with Experience target:

<?xml version="1.0" encoding="UTF-8"?>
<UIBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <masterLabel>propertyrentalapp</masterLabel>
    <description>A Salesforce UI Bundle.</description>
    <isActive>true</isActive>
    <version>1</version>
    <target>Experience</target>
</UIBundle>

Example with CustomApplication target:

<?xml version="1.0" encoding="UTF-8"?>
<UIBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <masterLabel>propertymanagementapp</masterLabel>
    <description>A Salesforce UI Bundle.</description>
    <isActive>true</isActive>
    <version>1</version>
    <target>CustomApplication</target>
</UIBundle>

ui-bundle.json

Optional file. Allowed top-level keys: outputDir, routing, headers.

Constraints:

  • Valid UTF-8 JSON, max 100 KB
  • Root must be a non-empty object (never {}, arrays, or primitives)

Path safety (applies to outputDir and routing.fallback): Reject backslashes, leading / or \, .. segments, null/control characters, globs (*, ?, **), and %. All resolved paths must stay within the bundle.

outputDir

Non-empty string referencing a subdirectory (not . or ./). Directory must exist and contain at least one file.

routing

If present, must be a non-empty object. Allowed keys: rewrites, redirects, fallback, trailingSlash, fileBasedRouting.

  • trailingSlash: "always", "never", or "auto"
  • fileBasedRouting: boolean
  • fallback: non-empty string satisfying path safety; target file must exist
  • rewrites: non-empty array of { route?, rewrite } objects — e.g., { "route": "/app/:path*", "rewrite": "/index.html" }
  • redirects: non-empty array of { route?, redirect, statusCode? } objects — statusCode must be 301, 302, 307, or 308

headers

Non-empty array of { source, headers: [{ key, value }] } objects.

Example:

{
  "routing": {
    "rewrites": [{ "route": "/app/:path*", "rewrite": "/index.html" }],
    "trailingSlash": "never"
  },
  "headers": [
    {
      "source": "/assets/**",
      "headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }]
    }
  ]
}

Never suggest: {} as root, empty "routing": {}, empty arrays, [{}], "outputDir": ".", "outputDir": "./".


CSP Trusted Sites

Salesforce enforces Content Security Policy headers. Any external domain not registered as a CSP Trusted Site will be blocked (images won't load, API calls fail, fonts missing).

When to Create

Whenever the app references a new external domain: CDN images, external fonts, third-party APIs, map tiles, iframes, external stylesheets.

Steps

  1. Identify external domains — extract the origin (scheme + host) from each external URL in the code
  2. Check existing registrations — look in force-app/main/default/cspTrustedSites/
  3. Map resource type to CSP directive:
Resource Type Directive Field
Images isApplicableToImgSrc
API calls (fetch, XHR) isApplicableToConnectSrc
Fonts isApplicableToFontSrc
Stylesheets isApplicableToStyleSrc
Video / audio isApplicableToMediaSrc
Iframes isApplicableToFrameSrc

Always also set isApplicableToConnectSrc to true for preflight/redirect handling.

  1. Create the metadata file — follow references/csp-metadata-format.md for the .cspTrustedSite-meta.xml format. Place in force-app/main/default/cspTrustedSites/.

Version History

  • 1.29.0 Current 2026-07-05 18:49

Same Skill Collection

skills/automation-flow-generate/SKILL.md
skills/commerce-b2b-open-code-components-integrate/SKILL.md
skills/commerce-b2b-store-create/SKILL.md
skills/data360-activate/SKILL.md
skills/data360-code-extension-generate/SKILL.md
skills/data360-prepare/SKILL.md
skills/data360-schema-get/SKILL.md
skills/design-systems-slds-apply/SKILL.md
skills/dx-org-permission-set-assign/SKILL.md
skills/dx-org-switch/SKILL.md
skills/experience-lwc-generate/SKILL.md
skills/experience-ui-bundle-features-generate/SKILL.md
skills/experience-ui-bundle-file-upload-generate/SKILL.md
skills/experience-ui-bundle-site-generate/SKILL.md
skills/external-diagram-visual-generate/SKILL.md
skills/platform-apex-logs-debug/SKILL.md
skills/platform-custom-application-generate/SKILL.md
skills/platform-custom-tab-generate/SKILL.md
skills/platform-lightning-app-coordinate/SKILL.md
skills/platform-list-view-generate/SKILL.md
skills/platform-metadata-deploy/SKILL.md
skills/platform-permission-set-generate/SKILL.md
skills/platform-validation-rule-generate/SKILL.md
skills/agentforce-architecture-analyze/SKILL.md
skills/agentforce-d360-analyze/SKILL.md
skills/agentforce-generate/SKILL.md
skills/agentforce-observe/SKILL.md
skills/agentforce-test/SKILL.md
skills/commerce-b2b-open-code-components-replace/SKILL.md
skills/data360-connect/SKILL.md
skills/data360-harmonize/SKILL.md
skills/data360-orchestrate/SKILL.md
skills/data360-query/SKILL.md
skills/data360-segment/SKILL.md
skills/design-systems-slds-validate/SKILL.md
skills/design-systems-slds2-migrate/SKILL.md
skills/dx-app-analytics-query/SKILL.md
skills/dx-code-analyzer-configure/SKILL.md
skills/dx-code-analyzer-custom-rule-create/SKILL.md
skills/dx-code-analyzer-run/SKILL.md
skills/dx-devops-test-failures-analyze/SKILL.md
skills/dx-devops-test-pipeline-configure/SKILL.md
skills/dx-devops-test-suite-assignments-configure/SKILL.md
skills/dx-devops-test-suite-run/SKILL.md
skills/dx-org-manage/SKILL.md
skills/experience-cms-brand-apply/SKILL.md
skills/experience-content-media-search/SKILL.md
skills/experience-ui-bundle-agentforce-client-generate/SKILL.md
skills/experience-ui-bundle-app-coordinate/SKILL.md
skills/experience-ui-bundle-custom-app-generate/SKILL.md
skills/experience-ui-bundle-deploy/SKILL.md
skills/experience-ui-bundle-frontend-generate/SKILL.md
skills/experience-ui-bundle-salesforce-data-access/SKILL.md
skills/external-diagram-mermaid-generate/SKILL.md
skills/integration-connectivity-connected-app-configure/SKILL.md
skills/integration-connectivity-generate/SKILL.md
skills/integration-eventing-cdc-configure/SKILL.md
skills/integration-eventing-subscription-configure/SKILL.md
skills/mobile-apps-create/SKILL.md
skills/mobile-platform-native-capabilities-integrate/SKILL.md
skills/mobile-platform-offline-validate/SKILL.md
skills/omnistudio-callable-apex-generate/SKILL.md
skills/omnistudio-datamapper-generate/SKILL.md
skills/omnistudio-datapacks-deploy/SKILL.md
skills/omnistudio-dependencies-analyze/SKILL.md
skills/omnistudio-epc-catalog-generate/SKILL.md
skills/omnistudio-flexcard-generate/SKILL.md
skills/omnistudio-integration-procedure-generate/SKILL.md
skills/omnistudio-omniscript-generate/SKILL.md
skills/platform-agentexchange-partner-offers-configure/SKILL.md
skills/platform-agentsetup-categories-fetch/SKILL.md
skills/platform-apex-generate/SKILL.md
skills/platform-apex-test-generate/SKILL.md
skills/platform-apex-test-run/SKILL.md
skills/platform-custom-field-generate/SKILL.md
skills/platform-custom-lightning-type-generate/SKILL.md
skills/platform-custom-object-generate/SKILL.md
skills/platform-data-manage/SKILL.md
skills/platform-docs-get/SKILL.md
skills/platform-flexipage-generate/SKILL.md
skills/platform-metadata-api-context-get/SKILL.md
skills/platform-metadata-retrieve/SKILL.md
skills/platform-sharing-rules-generate/SKILL.md
skills/platform-soql-query/SKILL.md
skills/platform-tracing-agentforce-configure/SKILL.md
skills/platform-tracing-configure/SKILL.md
skills/platform-trust-archive-manage/SKILL.md
skills/platform-value-set-generate/SKILL.md

Metadata

Files
0
Version
1.29.0
Hash
b16db568
Indexed
2026-07-05 18:49

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-08 20:15
浙ICP备14020137号-1 $Гость$