forcedotcom/sf-skills / plugins/builder/experience-cms/skills/experience-cms-content-generate
experience-cms-content-generate
VerifiedCreates, edits, and publishes Salesforce CMS content of any kind — any domain, any topic. Single and bulk: create many in parallel, edit one or many, publish all or a subset. Use this skill ANY TIME a user asks to create, generate, write, draft, author, or add content, OR to update, edit, or revise a content record, OR to publish it, OR to delete/remove a content record. Triggers like "create a <thing> about X", "create 5 <things>", "update content <id>", "publish content <id>", "publish the record <id>", "make <id> live", "delete content <id>" — where <thing> is any user-named content type. Activates FIRST whenever content authoring, editing, publishing, or deletion is mentioned, regardless of subject. Handles the full workflow: finding the content type, resolving the workspace, creating content, editing or publishing it — including a record identified by its variantId. Does not apply to defining a content type / schema (use experience-cms-content-type-generate), cloning, versioning, workspaces, or media.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 23.5 KB |
| assets/display-formats.md | markdown | 2.6 KB |
| assets/payloads/create-content-bulk.json | config | 657 B |
| assets/payloads/create-content-single.json | config | 437 B |
| assets/payloads/publish-content.json | config | 651 B |
| assets/payloads/update-content.json | config | 421 B |
| assets/questions.md | markdown | 12.9 KB |
| examples/create-content-call.md | markdown | 4.1 KB |
| references/bulk-batching.md | markdown | 4.3 KB |
| references/content-type-classification.md | markdown | 10.3 KB |
| references/content-write-tool.md | markdown | 7.0 KB |
| references/delegation-protocol.md | markdown | 5.5 KB |
| references/edit-publish-workflow.md | markdown | 9.2 KB |
| references/error-recovery.md | markdown | 13.8 KB |
| references/identifier-resolution.md | markdown | 2.4 KB |
| references/intent-routing.md | markdown | 8.6 KB |
| references/principles.md | markdown | 7.6 KB |
| references/ux-rules.md | markdown | 4.5 KB |
| references/workspace-resolution.md | markdown | 5.9 KB |
references/workspace-resolution.md
View on GitHub# Step 3 — workspace resolution (full detail)
Resolves `contentSpaceOrFolderId` (and, for a UIBundle, `channelId` + `workspaceMethod`). See SKILL.md Step 3 for WHEN it runs (fast-path: after Step 2; delegation path: early, as the first action of Step 2a, before the sibling is dispatched).
## Discovery (silent — no output to user)
Scan the project for `uiBundles/` directories — read each `packageDirectories[].path` from `sfdx-project.json` and scan under it; if no `sfdx-project.json` is present, fall back to a recursive search for `uiBundles/` directories. For each `uiBundles/` directory, iterate its subdirectories. For each subdirectory `<name>`, read `<name>/<name>.uibundle-meta.xml` and extract `<masterLabel>`. Build a list of `{ developerName: "<folder-name>", masterLabel: "<masterLabel from XML>" }`. If the `.uibundle-meta.xml` is missing or unreadable, use the folder name as both `developerName` and `masterLabel` fallback.
If the scan returns **zero** UIBundles, use the "no local UIBundles" variant from `assets/questions.md` — ask the user directly for a Content Space or Folder ID. Do NOT invent a workspace, do NOT run SOQL / `sf data query` against `ContentSpace` or any other object, do NOT read `ui-bundle.json` from disk. If nothing is on disk, the user provides the ID.
## Ask (single question)
Use the "Step 3 — Workspace resolution" templates in `assets/questions.md`. Dispatch via `ask_user_tool` — do NOT print as plain text.
## Routing
- **User selects a UIBundle** → call `get_or_create_cms_workspace_and_web_app_channel` with the selected UIBundle's `developerName` and `masterLabel`. Use the returned `spaceId` as `contentSpaceOrFolderId` for the rest of the workflow. **Record** `workspaceMethod=uibundle` and store the selected UIBundle's `developerName`, `masterLabel`, and the returned `channelId` for Step 10. **Then persist the `channelId` to disk** — write it into `uiBundles/<developerName>/public/content-metadata.json` under the `channelId` key. File-writing rules: if `public/` doesn't exist, create it; if `content-metadata.json` doesn't exist, create it as `{"channelId": "<value>"}`; if it exists, merge — preserve every existing key and overwrite ONLY the `channelId` value, do NOT delete or reformat other keys. On failure of the tool call itself, dispatch the retry prompt from `assets/questions.md`.
- **User selects "Provide a space or folder ID manually"** → **Record** `workspaceMethod=manual`. Dispatch the manual-ID prompt from `assets/questions.md` with a "Go back" clickable option. If the user clicks "Go back", re-present the original Step 3 question. Otherwise **validate the provided ID before using it** (see below). **Note:** with `workspaceMethod=manual` there is no resolved `channelId`, so the Step 10 "Render to UI Bundle" option is hidden — the user can still create, edit, and publish, but the render handoff requires selecting a UIBundle up front.
## Validate a user-provided workspace ID — MANDATORY before use
Never accept a manual Content Space / Folder ID blindly (the observed bug: a wrong ID was accepted with no check, then failed deep in `create_cms_content`). Two-layer validation:
1. **Format gate (client-side, before any tool call).** A valid Content Space ID starts with `0Zu`; a valid Folder ID starts with `9Pu`. The full ID must also be a well-formed Salesforce ID: prefix + only alphanumeric chars, exactly 15 or 18 chars total, no spaces. If the pasted value starts with neither prefix, OR is not 15/18 alphanumeric chars (e.g. `9Pualkskjhlkasdfjhlksdf` — right prefix but junk length), do NOT proceed and do NOT call any tool. Re-dispatch the **invalid-ID re-ask** template from `assets/questions.md` with `<reason>` = "it wasn't a 15- or 18-character `0Zu`/`9Pu` ID". Classify a passing ID by prefix: `0Zu` → `spaceId`; `9Pu` → `folderId`.
**Prefix + length is NECESSARY, NOT SUFFICIENT.** A perfectly well-formed `0Zu`/`9Pu` ID can still be fake, stale, deleted, or from a different org — the format gate cannot prove the space exists. Passing Layer 1 does NOT confirm the ID; only a server call does (Layer 2). Do NOT reason "the format looks right, so I'll proceed and validation will happen later at create" — that deferral IS the bug. The ID is unconfirmed until Layer 2 fires.
2. **Server confirmation — fires on the FIRST server call that touches the space, whichever comes first.** The ID is confirmed real only when that call succeeds:
- **Delegation path (Bucket 4):** the space is passed to the sibling's `get_content_types_for_workspace` BEFORE any content type is built. That is the first touch. If the sibling returns `INVALID_API_INPUT` / "'spaceId' must be a valid ManagedContentSpace id" / space-not-found, the space is invalid — **HARD STOP. Do NOT let the sibling build or deploy a content type on a bad space.** Surface the server error **verbatim**, then re-dispatch the **invalid-ID re-ask** template with `<reason>` = the server error text. Only after a corrected ID passes Layer 1 do you re-dispatch the sibling.
- **Fast path (Buckets 1/2/3):** the first touch is `create_cms_content`. If it returns `INVALID_ID` / "Content space not found" / an invalid cross-reference error, same handling — surface verbatim, re-ask via the invalid-ID template.
Do NOT retry the same ID. Do NOT defer confirmation past the first touch.
**Cross-reference / wrong-org error — do NOT improvise an org picker.** On an invalid cross-reference error, the ID belongs to a different org than the connected default. Surface the error verbatim and re-ask for the correct `0Zu`/`9Pu` ID via the manual-ID template ONLY. Do NOT run `sf org list`, do NOT enumerate available orgs, and do NOT invent an "Which org should I use?" question with an org list as answers — org selection is not this skill's job and that improvised prompt is a documented regression. The connected org is fixed; the user supplies an ID that belongs to it.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |