Skip to content

forcedotcom/sf-skills / skills/experience-app-mcp-generate

experience-app-mcp-generate

Verified

Create, extend, deploy, review readiness for, or activate an App MCP, a Salesforce custom hosted MCP server for an Aura Experience Site. Trigger when the user wants to expose an Experience UI or backend action to agents, create local ECA and server metadata, add eligible global invocable Apex or autolaunched Flow tools, add Prompt Builder templates as MCP prompts or tools, preview or perform server activation, deploy the existing MCP stack, or review its readiness. For server setup, always ask whether the user wants HXL widgets for eligible Apex-backed tools through platform-mcp-tool-widget-coordinate. For a standalone request to generate Custom Lightning Types or widgets for an Apex-backed MCP tool, route directly to platform-mcp-tool-widget-coordinate; do not trigger this skill for HXL generation alone. Do not trigger for remote MCP registration or generic Apex and Flow work unrelated to Experience Site agent access.

scripts/list_sites.mjs

View on GitHub
#!/usr/bin/env node
// List local Experience Sites with readiness and support status.
import fs from "node:fs";
import path from "node:path";

const args = process.argv.slice(2);
if (args.length > 1) {
  console.error("Usage: list_sites.mjs [project-root]");
  process.exit(1);
}

function entries(dir) {
  return fs.existsSync(dir) ? fs.readdirSync(dir, { withFileTypes: true }) : [];
}

function* files(dir) {
  for (const entry of entries(dir)) {
    const full = path.join(dir, entry.name);
    if (entry.isDirectory() && !["node_modules", "dist", "build"].includes(entry.name) && !entry.name.startsWith(".")) {
      yield* files(full);
    } else if (entry.isFile()) {
      yield full;
    }
  }
}

function readJson(file) {
  return JSON.parse(fs.readFileSync(file, "utf8"));
}

function* componentNames(value) {
  if (Array.isArray(value)) {
    for (const child of value) yield* componentNames(child);
  } else if (value && typeof value === "object") {
    if (typeof value.componentName === "string") yield value.componentName;
    for (const child of Object.values(value)) yield* componentNames(child);
  }
}

function hasAuraComponents(names, roots) {
  if (names.some((name) => /^(community_builder|community_layout|community_login):/.test(name))) return false;
  return names.some((name) => /^(forceCommunity|siteforce):/.test(name) ||
    (/^c:[a-zA-Z][a-zA-Z0-9_]*$/.test(name) && roots.some((root) => fs.existsSync(path.join(root, "aura", name.slice(2), `${name.slice(2)}.cmp`)))));
}

function tag(xml, name) {
  return (xml.match(new RegExp(`<${name}>\\s*([^<]*?)\\s*</${name}>`))?.[1] ?? "")
    .replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"')
    .replace(/&apos;/g, "'").replace(/&amp;/g, "&");
}

function matchesUrlPathPrefix(surface, network) {
  return !!network.urlPathPrefix && surface.urlPathPrefixes.some((prefix) => prefix === network.urlPathPrefix || prefix.replace(/\/s\/?$/, "") === network.urlPathPrefix);
}

function matchesSiteBundleName(surface, network) {
  // Use the same site-name-to-bundle derivation as Core and SF CLI.
  let decodedName;
  try {
    decodedName = decodeURIComponent(network.name);
  } catch (error) {
    if (error instanceof URIError) return false;
    throw error;
  }
  const name = decodedName
    .replace(/[^a-zA-Z0-9]+/g, "_")
    .replace(/_$/, "")
    .replace(/^([0-9])/, "X$1");
  return !!name && surface.bundle === `${name}1`;
}

function assignNetworkBundles(links) {
  for (const { network, surface } of links) {
    const matches = links.filter((link) => link.surface === surface);
    if (matches.length > 1) surface.reason = `Multiple Networks match bundle ${surface.bundle}: ${matches.map((link) => link.network.name).join(", ")}`;
    network.bundle = surface.bundle;
  }
}

function recordAmbiguity(network, surfaces) {
  network.reason = `Ambiguous bundles for Network ${network.name}: ${surfaces.map((surface) => surface.bundle).join(", ")}`;
  network.candidateSurfaces = surfaces;
  for (const surface of surfaces) surface.reason = network.reason;
}

function mergeSourceConflicts(surfaces) {
  const conflicts = new Set(surfaces.filter((site) => surfaces.some((other) => other.bundle === site.bundle && other.sourceFormat !== site.sourceFormat)).map((site) => site.bundle));
  return surfaces.filter((site, index) => {
    if (!conflicts.has(site.bundle)) return true;
    const sources = surfaces.filter((other) => other.bundle === site.bundle);
    if (index !== surfaces.indexOf(sources[0])) return false;
    site.sourceFormat = null;
    site.reason = `Conflicting source formats for bundle ${site.bundle}`;
    for (const key of ["uiRoots", "entryFiles", "urlPathPrefixes", "evidence"]) site[key] = sources.flatMap((source) => source[key]);
    return true;
  });
}

function listSites(projectRoot) {
  const project = readJson(path.join(projectRoot, "sfdx-project.json"));
  if (!project.packageDirectories?.length || project.packageDirectories.some((pkg) => typeof pkg.path !== "string" || !pkg.path)) {
    throw new Error("sfdx-project.json must contain packageDirectories with paths");
  }
  const roots = project.packageDirectories.map((pkg) => path.resolve(projectRoot, pkg.path, "main/default"));
  const networks = [];
  const configs = [];
  let surfaces = [];
  for (const root of roots) {
    for (const file of files(path.join(root, "networks"))) {
      if (!file.endsWith(".network-meta.xml")) continue;
      const xml = fs.readFileSync(file, "utf8");
      networks.push({ file, bundle: tag(xml, "picassoSite"), name: path.basename(file, ".network-meta.xml"), urlPathPrefix: tag(xml, "urlPathPrefix") });
    }
    for (const file of files(path.join(root, "digitalExperienceConfigs"))) {
      if (!file.endsWith(".digitalExperienceConfig-meta.xml")) continue;
      const xml = fs.readFileSync(file, "utf8");
      configs.push({ file, sourceFormat: "digital-experience", bundle: tag(xml, "space").replace(/^site\//, ""), name: tag(xml, "label") || path.basename(file, ".digitalExperienceConfig-meta.xml"), urlPathPrefix: tag(xml, "urlPathPrefix") });
    }
    const experienceBundles = new Set(entries(path.join(root, "experiences")).flatMap((entry) => entry.isDirectory() ? [entry.name] : entry.name.endsWith(".site-meta.xml") ? [entry.name.slice(0, -14)] : []));
    for (const bundle of experienceBundles) {
      const dir = path.join(root, "experiences", bundle);
      const metadataFile = `${dir}.site-meta.xml`;
      const metadata = fs.existsSync(metadataFile) ? fs.readFileSync(metadataFile, "utf8") : "";
      const entryFiles = [...files(path.join(dir, "routes")), ...files(path.join(dir, "views"))].filter((file) => file.endsWith(".json"));
      const viewComponents = [];
      let reason;
      for (const file of entryFiles) {
        try {
          const definition = readJson(file);
          if (file.includes(`${path.sep}views${path.sep}`)) viewComponents.push(...componentNames(definition));
        } catch (error) {
          reason = `Cannot read ExperienceBundle JSON in ${file}: ${error.message}`;
          break;
        }
      }
      surfaces.push({ name: tag(metadata, "label") || bundle, bundle, sourceFormat: "experience-bundle", auraComponents: hasAuraComponents(viewComponents, roots), uiRoots: [dir], entryFiles, urlPathPrefixes: [tag(metadata, "urlPathPrefix")].filter(Boolean), evidence: metadata ? [metadataFile] : [], ...(reason ? { reason } : {}) });
    }
    for (const entry of entries(path.join(root, "digitalExperiences/site"))) {
      if (!entry.isDirectory()) continue;
      const dir = path.join(root, "digitalExperiences/site", entry.name);
      const siteFiles = [...files(path.join(dir, "sfdc_cms__site"))].filter((file) => path.basename(file) === "content.json");
      surfaces.push({ name: entry.name, bundle: entry.name, sourceFormat: "digital-experience", uiRoots: [], entryFiles: [], urlPathPrefixes: [], evidence: siteFiles });
    }
  }
  surfaces = mergeSourceConflicts(surfaces);
  for (const config of configs) {
    const surface = surfaces.find((site) => config.bundle && site.bundle === config.bundle);
    if (surface) {
      if (surface.sourceFormat === "experience-bundle") {
        surface.sourceFormat = null;
        surface.reason = `Conflicting source formats for bundle ${surface.bundle}`;
      }
      if (surface.sourceFormat === "digital-experience") surface.name = config.name;
      if (config.urlPathPrefix) surface.urlPathPrefixes.push(config.urlPathPrefix);
    } else if (config.bundle) {
      surfaces.push({ name: config.name, bundle: config.bundle, sourceFormat: config.sourceFormat, uiRoots: [], entryFiles: [], urlPathPrefixes: [config.urlPathPrefix].filter(Boolean), evidence: [] });
    }
  }
  const directLinks = [];
  for (const network of networks) {
    if (network.bundle) continue;
    const matches = surfaces.filter((surface) => surface.bundle &&
      !networks.some((other) => other.bundle === surface.bundle) &&
      (!network.urlPathPrefix || !surface.urlPathPrefixes.length || matchesUrlPathPrefix(surface, network)) && (
        surface.bundle === network.name || surface.name === network.name ||
        matchesUrlPathPrefix(surface, network)
      ));
    if (matches.length > 1) recordAmbiguity(network, matches);
    if (matches.length === 1) directLinks.push({ network, surface: matches[0] });
  }
  assignNetworkBundles(directLinks);
  const inferredLinks = [];
  for (const network of networks) {
    if (network.bundle || network.reason) continue;
    const matches = surfaces.filter((surface) => surface.bundle &&
      !networks.some((other) => other.bundle === surface.bundle) &&
      (!network.urlPathPrefix || !surface.urlPathPrefixes.length || matchesUrlPathPrefix(surface, network)) &&
      matchesSiteBundleName(surface, network));
    if (matches.length > 1) recordAmbiguity(network, matches);
    if (matches.length === 1) inferredLinks.push({ network, surface: matches[0] });
  }
  assignNetworkBundles(inferredLinks);
  const records = [...networks, ...configs];
  for (const surface of surfaces) {
    const links = records.filter((record) => (record.bundle && record.bundle === surface.bundle) || record.candidateSurfaces?.includes(surface));
    surface.networkNames = networks.filter((record) => links.includes(record)).map((record) => record.name);
    surface.urlPathPrefixes = [...new Set([...surface.urlPathPrefixes, ...links.map((record) => record.urlPathPrefix)].filter(Boolean))];
    surface.evidence.push(...links.map((record) => record.file));
  }
  for (const record of records) {
    if (record.candidateSurfaces?.length) continue;
    if (surfaces.some((surface) => record.bundle && surface.bundle === record.bundle)) continue;
    const links = record.bundle ? records.filter((other) => other.bundle === record.bundle) : [record];
    surfaces.push({ name: record.name, bundle: record.bundle || null, sourceFormat: links.find((link) => link.sourceFormat)?.sourceFormat ?? null, networkNames: networks.filter((network) => links.includes(network)).map((network) => network.name), urlPathPrefixes: [...new Set(links.map((link) => link.urlPathPrefix).filter(Boolean))], uiRoots: [], entryFiles: [], evidence: links.map((link) => link.file), ...(record.reason ? { reason: record.reason } : {}) });
  }
  return { sites: surfaces.map((surface) => {
    const { entryFiles, sourceFormat, auraComponents, ...site } = surface;
    const supported = sourceFormat === "experience-bundle" && !!auraComponents;
    const found = entryFiles.some((file) => file.includes(`${path.sep}views${path.sep}`));
    const status = sourceFormat === null ? "metadata-incomplete" : sourceFormat !== "experience-bundle" ? "unsupported" : site.reason ? "metadata-incomplete" : !found ? "ui-not-found" : supported ? "ready" : "unsupported";
    return { ...site, uiFileCount: entryFiles.length, status };
  }).sort((a, b) => a.name.localeCompare(b.name)) };
}

try {
  const result = listSites(path.resolve(args[0] ?? process.cwd()));
  console.log(JSON.stringify(result, null, 2));
} catch (error) {
  console.error(`ERROR: ${error.message}`);
  process.exitCode = 1;
}
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall