Skip to content

forcedotcom/sf-skills / plugins/builder/experience-react/skills/experience-ui-bundle-frontend-generate

experience-ui-bundle-frontend-generate

Verified

MUST activate before editing ANY file under uiBundles/*/src/ (or the bundle's index.html) for visual or UI changes to an EXISTING app — pages, components, sections, layout, styling, colors, fonts, navigation, animations, branding, or any look-and-feel change. Use this skill when modifying pages, components, layout, styling, navigation, or branding in an existing UI bundle app. Activate when the project contains appLayout.tsx, routes.tsx, src/pages/, src/components/, src/styles/global.css, or the bundle's index.html. This skill contains critical project-specific conventions (appLayout.tsx shell, shadcn/ui components, Tailwind CSS, Salesforce base-path routing, module restrictions) that override general knowledge. Without this skill, generated code will use wrong imports, break routing, or ignore project structure. Do NOT use when creating a new app from scratch or the bundle has not been scaffolded yet (use experience-ui-bundle-app-coordinate instead).

FileKindSize
SKILL.mdskill md14.5 KB
references/component.mdmarkdown6.2 KB
references/header-footer.mdmarkdown5.7 KB
references/page.mdmarkdown5.5 KB
scripts/check-preconditions.mjsexecutablescript2.3 KB
scripts/resolve-ui-bundle.mjsexecutablescript2.5 KB
scripts/verify-rules.mjsexecutablescript3.3 KB

scripts/resolve-ui-bundle.mjs

View on GitHub
#!/usr/bin/env node
// Resolve the single UI bundle directory for this project.
// Usage: node resolve-ui-bundle.mjs [project-root]   (default: current directory)
//
// Reads sfdx-project.json's packageDirectories[0].path, looks under
// <that-path>/main/default/uiBundles/, and prints the resolved bundle
// directory to stdout on success.
//
// Always invoke via `node` (never as a bare executable) so this works on
// Windows cmd/PowerShell as well as macOS/Linux/Git Bash. Quote the
// project-root argument so paths with spaces or Windows backslashes stay
// a single argv.
//
// Exit 0: exactly one bundle directory found — printed to stdout.
// Exit 1: sfdx-project.json missing/invalid, or no uiBundles/* subdirectory
//         found at all (not a scaffolded SFDX project yet).
// Exit 2: multiple uiBundles/* subdirectories found — caller MUST ask the
//         user which one they mean rather than guessing; candidate names are
//         printed to stderr.

import fs from "node:fs";
import path from "node:path";

const PROJECT_ROOT = path.resolve(process.argv[2] ?? ".");
const SFDX_PROJECT = path.join(PROJECT_ROOT, "sfdx-project.json");

function fail(code, message) {
  console.error(message);
  process.exit(code);
}

if (!fs.existsSync(SFDX_PROJECT) || !fs.statSync(SFDX_PROJECT).isFile()) {
  fail(1, `ERROR: sfdx-project.json not found at ${SFDX_PROJECT}`);
}

let sourcePath = "";
try {
  const data = JSON.parse(fs.readFileSync(SFDX_PROJECT, "utf8"));
  const dirs = data?.packageDirectories ?? [];
  sourcePath = dirs[0]?.path ?? "";
} catch {
  sourcePath = "";
}

if (!sourcePath) {
  fail(1, "ERROR: sfdx-project.json is invalid or has no packageDirectories[0].path");
}

const BUNDLES_DIR = path.join(PROJECT_ROOT, sourcePath, "main", "default", "uiBundles");

if (!fs.existsSync(BUNDLES_DIR) || !fs.statSync(BUNDLES_DIR).isDirectory()) {
  fail(1, `ERROR: No uiBundles/ directory found at ${BUNDLES_DIR}`);
}

const bundleDirs = fs
  .readdirSync(BUNDLES_DIR, { withFileTypes: true })
  .filter((entry) => entry.isDirectory())
  .map((entry) => path.join(BUNDLES_DIR, entry.name))
  .sort();

if (bundleDirs.length === 0) {
  fail(1, `ERROR: ${BUNDLES_DIR} exists but contains no bundle subdirectories`);
}

if (bundleDirs.length > 1) {
  console.error(
    "AMBIGUOUS: Multiple UI bundle directories found — ask the user which one they mean before editing or running any command:",
  );
  for (const dir of bundleDirs) {
    console.error(`  - ${dir}`);
  }
  process.exit(2);
}

console.log(bundleDirs[0]);
process.exit(0);
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall