К основному содержанию
скилл CX Codex

experience-ui-bundle-metadata-generate — скилл для Claude Code

Добавляет React- или Angular-бандл в уже существующий SFDX-проект и настраивает его метаданные. Пригодится, когда нужен второй UI-бандл или правка ui-bundle.json.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add forcedotcom/sf-skills --skill experience-ui-bundle-metadata-generate -a claude-code
Открыть на GitHub

Что делает experience-ui-bundle-metadata-generate

Скилл ведёт агента по шагам: сначала обязательно sf template generate ui-bundle с шаблоном reactbasic или angularbasic, потом проверка через node <skill_dir>/scripts/verify-bundle-location.mjs, затем node <skill_dir>/scripts/check-api-version.mjs — он поднимает sourceApiVersion в sfdx-project.json до 67.0, если там меньше. Фреймворк определяется скриптом detect-framework.mjs: он печатает react, angular, ambiguous или unknown, и на ambiguous скилл останавливается и спрашивает вас.

Бандл живёт только в force-app/main/default/uiBundles/<AppName>/, имя папки совпадает с <AppName>.uibundle-meta.xml. В мета XML обязательны masterLabel, version (до 20 знаков) и isActive, а без <target> бандл не появится в организации вообще — ни в App Launcher, ни по адресу Experience Site. Для внутренних приложений это CustomApplication, для внешних — Experience.

Скилл не для проекта с нуля: там весь стартовый SFDX-набор генерируется одной командой, и для этого есть отдельный скилл. Ещё он закрывает CSP Trusted Sites — если картинки, шрифты или внешние API блокируются, правки идут в cspTrustedSites/*.cspTrustedSite-meta.xml. Для скриптов нужны node 18.0.0 и выше, sf 2.0.0 и выше, jq 1.6.0 и выше.

Какие задачи решает

  • добавить второй UI-бандл в существующий SFDX-проект
  • создать бандл по шаблону reactbasic или angularbasic
  • прописать маршрутизацию и заголовки в ui-bundle.json
  • зарегистрировать CSP Trusted Site, чтобы перестали блокироваться шрифты и внешние API
  • поднять sourceApiVersion до 67.0 перед деплоем

Примеры запросов агенту

  • добавь новый UI-бандл на React в наш существующий SFDX-проект
  • настрой маршрутизацию и output directory в ui-bundle.json для этого бандла
  • внешние картинки не грузятся — зарегистрируй CSP Trusted Site

Как установить experience-ui-bundle-metadata-generate

1Через Skills CLI (Vercel)

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

2Вручную: положить файлы

~/.claude/skills/experience-ui-bundle-metadata-generate/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/experience-ui-bundle-metadata-generate/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора167

experience-ui-bundle-custom-app-generate Создаёт CustomApplication в Salesforce для запуска React UI bundle в Lightning Experience. Пригодится, когда нужно вывести бандл в App Launcher без Digital Experience Site. CX Codex +1 5 200установок experience-ui-bundle-salesforce-data-access Подключает чтение и запись записей Salesforce в компоненты uiBundles через @salesforce/platform-sdk. Нужен, когда страница, таблица или форма должна показывать реальные данные. CX Codex +1 5 200установок experience-ui-bundle-deploy Скилл проводит деплой UI-бандла в Salesforce-орг по шагам: авторизация, сборка, метаданные, права, self-registration, SSO и codegen. CX Codex +1 5 200установок experience-ui-bundle-app-coordinate Координирует сборку приложений React UI bundle в Salesforce с нуля. Пригодится при генерации веб-приложений и SPA через связку вспомогательных скилов. CX Codex +1 5 300установок platform-value-set-generate Скилл собирает и проверяет метаданные Salesforce GlobalValueSet и StandardValueSet, чтобы деплой не падал на ошибках. CX Codex +1 5 100установок dx-devops-test-failures-analyze Разбирает сбои тестов Salesforce DevOps Center и предупреждения Code Analyzer простыми словами. Помогает понять корень ошибки и создать задачу WorkItem. CX Codex +1 5 100установок experience-ui-bundle-features-generate Ставит в Salesforce UI bundle готовые пакеты фич — вход, выход, защищённые маршруты, поиск — вместо того чтобы писать их руками. CX Codex +1 5 100установок platform-trust-archive-manage Скилл для работы с Salesforce Archive через Archive Connect API: поиск, восстановление, маскирование и удаление архивных записей. CX Codex +1 5 100установок

Похожие

salesforce-dx Mindrally Скилл задаёт агенту правила разработки на Salesforce DX: Apex, триггеры, LWC, scratch orgs и выкладка через SFDX CLI. CX Codex +1 688установок fixing-metadata ibelick Проверяет и приводит в порядок метаданные страниц: заголовки, описания, canonical, Open Graph, карточки Twitter, иконки и JSON-LD. CX Codex +1 18 200установок secrets-in-file-metadata UseOSINT Достаёт EXIF, XMP, IPTC и свойства Office и PDF через exiftool: GPS, серийник камеры, авторы, даты. Пригодится, когда надо понять, откуда файл и кто его правил. CX Codex +1 1 800установок metadata machina-sports Тянет логотипы клубов, фото игроков и данные о стадионах через бесплатный API TheSportsDB. Пригодится, когда ответ нужно дополнить картинкой или визуальным идентификатором. CX Codex +1 490установок asc-metadata-sync rorkai Скилл для CLI asc: тянет метаданные App Store Connect в локальные JSON, проверяет их и заливает назад. Пригодится при правке локализаций, ключевых слов и ассетов. CX Codex +1 7 800установок dicom-metadata-extract NVIDIA MedTech Team Скилл запускает скрипт на pydicom для чтения одного DICOM-файла и проверки стандартных тегов PHI. Пригодится при первичной проверке медицинских метаданных в агенте. CX Codex +1 1 900установок

Рядом в теме «Фронтенд и UI»

Всё по теме «Фронтенд и UI» →

Вопросы о experience-ui-bundle-metadata-generate

Как установить experience-ui-bundle-metadata-generate в Claude?

Выполните npx skills add forcedotcom/sf-skills --skill experience-ui-bundle-metadata-generate -a claude-code. Скилл окажется в ~/.claude/skills/experience-ui-bundle-metadata-generate/SKILL.md.

Что делает experience-ui-bundle-metadata-generate?

Проводит агента через генерацию UI-бандла в существующем SFDX-проекте, проверку расположения файлов и версии API, а также настройку ui-bundle.json и .uibundle-meta.xml. Отдельно разбирается с CSP Trusted Sites, когда блокируются изображения, шрифты или внешние вызовы.

Чем этот скилл отличается от experience-ui-bundle-project-generate?

Он работает с проектом, который уже существует. Для нового Salesforce-проекта с нуля, где UI-бандл, метаданные Experience Site и инструменты создаются за один шаг, нужен experience-ui-bundle-project-generate.

Исходный текст

SKILL.md · Apache-2.0
---
name: experience-ui-bundle-metadata-generate
description: "Use this skill when adding a front-end React or Angular UI bundle to an EXISTING SFDX project, or configuring UI bundle metadata and config files. TRIGGER when: adding or scaffolding a new UI bundle — including adding one more or another UI bundle — into a project that already exists; scaffolding a single bundle with the basic template (reactbasic or angularbasic) via sf template generate ui-bundle; editing ui-bundle.json routing, headers, or output directory; working with *.uibundle-meta.xml files; or registering CSP Trusted Sites, resolving blocked images or fonts or external API calls, or editing cspTrustedSites/*.cspTrustedSite-meta.xml files. DO NOT TRIGGER when: creating a brand-new Salesforce project entirely from scratch, where the whole SFDX starter project (UI bundle plus Experience Site metadata and toolchain) is generated together in one step (use experience-ui-bundle-project-generate)."
metadata:
  version: "1.3"
  domains: ["Experience"]
  minApiVersion: "67.0"
  relatedSkills:
    - "experience-ui-bundle-custom-app-generate"
    - "experience-ui-bundle-frontend-generate"
    - "experience-ui-bundle-project-generate"
    - "experience-ui-bundle-site-generate"
  cliTools:
    - tool: ["jq"]
      semver: ">=1.6.0"
    - tool: ["node"]
      semver: ">=18.0.0"
    - tool: ["sf"]
      semver: ">=2.0.0"
---

# UI Bundle Metadata

## Scaffolding a New UI Bundle

**REQUIRED FIRST STEP — never skip, even if asked to.** Always run `sf template generate ui-bundle` to create new apps — never a framework CLI (create-react-app, Vite, Angular CLI), hand-written metadata, or any other substitute.

This step is mandatory even if the user says "just create the metadata," "skip the scaffold," "only do the metadata scaffolding," or "stop after the metadata files are in place." Those instructions describe what to stop doing *after* the scaffold (building, deploying, authoring pages) — they do not mean skip running the scaffold command itself. The `.uibundle-meta.xml` and `ui-bundle.json` files are configuration **on top of** the generated project, not a replacement for it. A bundle without `package.json`, `src/`, and an entry `index.html` cannot be built or deployed, even if the metadata files are perfectly formed.

### Determine the framework

The frameworks this skill supports are exactly the reference files under `<skill_dir>/references/`, each named `<framework>-metadata-generate.md` (`react`, `angular`, …). This is the single source of truth — adding a framework means adding a reference file, nothing here changes.

**Detect the framework deterministically — run the script:**

```sh
node <skill_dir>/scripts/detect-framework.mjs [<ROOT>]
```

Always invoke via `node` (never as a bare executable) so this works on Windows cmd/PowerShell as well as macOS/Linux/Git Bash.

`ROOT` defaults to the current directory; pass the bundle or project root when editing/configuring an existing bundle. The script prints exactly one token and sets a matching exit code — branch on it:

- `react` / `angular` (exit 0) — open `<skill_dir>/references/<framework>-metadata-generate.md` and use it.
- `ambiguous` (exit 2, both frameworks present) — ask the user which one, then use that reference.
- `unknown` (exit 3, no signals — e.g. scaffolding a brand-new bundle into a project that has none yet) — fall back to the calling context or the user's stated framework; if still undecided, list `<skill_dir>/references/`, derive the supported set by stripping the `-metadata-generate.md` suffix from each filename, and ask the user to pick.

If the calling context or the user already named the framework, that overrides detection — but still confirm a matching reference file exists. **Never guess.**

The reference file gives you the exact `--template` flag, the entry-file layout, and the default boilerplate strings to replace for that framework.

- **UI bundle name (`-n`):** Alphanumerical only — no spaces, hyphens, underscores, or special characters.
- Pass `--output-dir` to use a different location for template generation. If you do, pass that same path to the verification script in step 1 below.

After generation:
1. **Verify the scaffold is complete** — run `node <skill_dir>/scripts/verify-bundle-location.mjs <BundleName> [<CustomOutputDir>] [<framework>]` from the project root and follow any error output. This checks both the bundle's location AND that `package.json`, `src/`, and an entry `index.html` exist — if any are missing, the scaffold step was skipped; go back and run `sf template generate ui-bundle` before continuing. Pass `<CustomOutputDir>` only if you used `--output-dir` during scaffolding (pass `""` to skip it while still supplying a framework); pass `<framework>` (`react` or `angular`) so the remediation hint uses the right template.
2. **Verify API version** — run `node <skill_dir>/scripts/check-api-version.mjs` from the project root to ensure `sourceApiVersion` in `sfdx-project.json` is 67.0 or higher. The script will automatically update it if needed.
3. Replace all default boilerplate — the framework reference file lists the exact stock `<title>` and placeholder strings to replace
4. Populate the home page with real content (landing section, banners, hero, navigation)
5. Update navigation and placeholders (see the `experience-ui-bundle-frontend-generate` skill)
6. **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 **MUST** live under `force-app/main/default/uiBundles/<AppName>/` — never create it at the SFDX project root or under any other path. The SFDX deploy command will not find it otherwise.

The bundle directory 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
<?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
<?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:**
```json
{
  "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.

4. **Create the metadata file** — follow `references/csp-metadata-format.md` for the `.cspTrustedSite-meta.xml` format and naming rules. Place in `force-app/main/default/cspTrustedSites/`.

© forcedotcom · Apache-2.0 · forcedotcom/sf-skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой