Loading...
Loading...
Generates a minimal, ready-to-develop SFDX starter project from template instead of hand-scaffolding files. Use this skill when starting a brand-new Salesforce React UI bundle app and the initial project must be scaffolded — trigger phrases include create, start, or scaffold a new React UI bundle app, generate a starter project, or use a prebuilt/starter template. DO NOT TRIGGER when: editing, styling, or adding pages or components to an EXISTING app (use experience-ui-bundle-frontend-generate); configuring ui-bundle.json or metadata files (use experience-ui-bundle-metadata-generate); deploying to an org (use experience-ui-bundle-deploy); or when the user explicitly says they want to hand-scaffold from scratch.
npx skill4agent add forcedotcom/sf-skills experience-ui-bundle-project-generatenpm run setupsf template generate project| Template | | Best for |
|---|---|---|
| Internal starter | | Starter for internal, employee-facing Salesforce apps (e.g. support consoles, ops dashboards, internal admin apps) — users are already-authenticated employees. Includes Agentforce chat. No login flow or public. |
| External starter | | Starter for customer/partner-facing Salesforce apps/sites (e.g. portals, communities, storefront, public sites). Full auth support (login, registration, reset, profile) -- external users sign in with their own accounts. |
experience-ui-bundle-app-coordinate$DESTsfdx-project.json$DEST/sfdx-project.jsonsf template generate project--name$DEST$DEST<SKILL_DIR>SKILL.md$NAME$DEST.NAME=MyApp # project name the user chose; also names the UI bundle
DEST=. # target root directory (the contents land directly here, no NAME/ wrapper)
# choose ONE template flag based on the user's pick from Step 1
TEMPLATE=reactinternalapp # or reactexternalapp
mkdir -p "$DEST"
sf template generate project --name "$NAME" --template "$TEMPLATE" --output-dir "$DEST"
# Flatten the generated $DEST/$NAME contents up into $DEST (see <SKILL_DIR>/scripts/flatten-project.mjs).
# Use the absolute skill-dir path — a relative ./scripts/ would resolve against $DEST, not the skill.
node "<SKILL_DIR>/scripts/flatten-project.mjs" "$DEST/$NAME" "$DEST"
rm -rf "$DEST/$NAME"moves every generated entry (incl. dotfiles) into<SKILL_DIR>/scripts/flatten-project.mjs, overwriting any existing file/dir of any type on conflict while preserving unrelated files the user already had in$DEST. The per-entry$DEST+rmSyncis what guarantees the template's files win on conflict (including a file-vs-directory type mismatch).renameSync
$NAME/test -f "$DEST/sfdx-project.json" && echo "OK: project root landed" || echo "FAILED"sfdx-project.json$DEST/sfdx-project.jsonpackage.jsonforce-app/main/default/uiBundles/$NAME/scripts/config/README.mdsfdx-project.json$DEST/$NAME/node_modulespackage.json$DEST/package.json$DEST/force-app/main/default/uiBundles/$NAME/node_modules# 1. project root ($DEST was set in Step 2)
( cd "$DEST" && npm install )
# 2. each UI bundle
for b in "$DEST"/force-app/main/default/uiBundles/*/; do
[ -f "$b/package.json" ] && ( cd "$b" && npm install )
doneFirst-run install of the bundle is the heavy step (tailwind, radix-ui, recharts, vite, etc.); expect a short wait. If an install fails, surface it — don't hand off a half-installed project.
ls "$DEST" # sfdx-project.json, package.json, force-app/, scripts/, README.md ...
ls "$DEST"/force-app/main/default/uiBundles/*/node_modules >/dev/null && echo "bundle deps installed"README.mdexperience-ui-bundle-frontend-generateexperience-ui-bundle-salesforce-data-accessexperience-ui-bundle-deployuiBundles--namesf template generate project --help