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/preflight.mjs

View on GitHub
#!/usr/bin/env node
// Run from the SFDX project root; read the JSON `decision`. Exit 0 = decision reached (incl. skip, needs_input); exit 1 = error.
// Usage: node preflight.mjs <target-org-alias> --skill-named <true|false>
import fs from "node:fs";
import { execFileSync } from "node:child_process";

const [org, option, skillNamed, ...extra] = process.argv.slice(2);
const requestNamesSkill = skillNamed === "true";
let gatePassed = false;

function finish(report, code = 0) {
  console.log(JSON.stringify(report));
  process.exit(code);
}

function skip(disabled = false) {
  finish({
    decision: disabled && requestNamesSkill ? "disabled" : "skip",
    nextAction: "continue_without_this_skill",
    userMessage: disabled && requestNamesSkill ? "The App MCP skill is not enabled for this org." : null,
  });
}

function problem(errorCode, userMessage, nextAction, needsInput = false) {
  if (!needsInput && !gatePassed && !requestNamesSkill) skip();
  finish({ decision: needsInput ? "needs_input" : "error", errorCode, userMessage, nextAction, gatePassed }, needsInput ? 0 : 1);
}

if (!org || org.startsWith("--") || option !== "--skill-named" ||
    !["true", "false"].includes(skillNamed) || extra.length) {
  problem("invalid_arguments", "Provide a target org alias and --skill-named true or false.", "Correct the preflight arguments.", true);
}

let project;
try {
  project = JSON.parse(fs.readFileSync("sfdx-project.json", "utf8"));
} catch {
  problem("invalid_project", "Could not read sfdx-project.json.", "Select a valid SFDX project root, then rerun preflight.");
}
const version = project?.sourceApiVersion;
if (typeof version !== "string" || !/^\d+\.\d+$/.test(version) || Number(version) < 68) {
  problem("invalid_api_version", "sfdx-project.json sourceApiVersion must use X.Y format and be at least 68.0.",
    "Ask the user to correct sourceApiVersion to an org-supported version, then rerun preflight.", true);
}

function sf(args) {
  let output;
  let failed = false;
  try {
    output = execFileSync("sf", args, {
      encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30000,
    });
  } catch (error) {
    output = error.stdout ?? "";
    failed = true;
  }
  let response;
  try {
    response = JSON.parse(output);
  } catch {
    return { failed: true, response: null };
  }
  if (response?.name === "NamedOrgNotFoundError" || response?.code === "NamedOrgNotFoundError") {
    problem("invalid_org_alias", "No authenticated org matches the target org alias.",
      "Ask the user for a valid authenticated org alias, then rerun preflight.", true);
  }
  return { failed, response };
}

const versionsResult = sf(["api", "request", "rest", "/services/data/",
  "--target-org", org, "--method", "GET", "--json"]);
const versions = versionsResult.response?.result?.body;
if (versionsResult.failed || versionsResult.response?.status !== 0 ||
    versionsResult.response?.result?.statusCode !== 200 || !Array.isArray(versions) || !versions.length ||
    !versions.every((entry) => typeof entry?.version === "string" && /^\d+\.\d+$/.test(entry.version))) {
  problem("gate_check_failed", "Could not determine the target org's supported API versions.",
    "Check target-org authentication and connectivity, then rerun preflight.");
}
const compatibleVersions = versions.filter((entry) => Number(entry.version) >= 68).map((entry) => entry.version);
if (!compatibleVersions.length) {
  problem("invalid_api_version", "The target org does not advertise an API version of at least 68.0.",
    "Ask the user for an org alias supporting API 68.0 or later, then rerun preflight.", true);
}
if (!compatibleVersions.includes(version)) {
  problem("invalid_api_version", "sfdx-project.json sourceApiVersion is not supported by the target org.",
    "Ask the user to select a supported sourceApiVersion of at least 68.0 from: " +
    compatibleVersions.join(", ") +
    ". Then rerun preflight.", true);
}

const gateResult = sf(["api", "request", "rest", `/services/data/v${version}/headless/invocableaction`,
  "--target-org", org, "--method", "POST", "--body",
  JSON.stringify({ action: "getExperienceAppMcpMetadata-getExperienceAppMcpMetadata", inputs: {} }), "--json"]);
const gate = gateResult.response;
const body = gate?.result?.body;
if (gate?.result?.statusCode === 400 && Array.isArray(body) &&
    body.some((error) => error?.errorCode === "INVALID_INPUT")) skip(true);
const unsupportedGateActionMessage = /Unsupported action type: GET_EXPERIENCE_APP_MCP_METADATA(?![A-Za-z0-9_])/;
if (Array.isArray(body) && body.some((error) =>
    typeof error?.message === "string" && unsupportedGateActionMessage.test(error.message))) skip(true);
if (gateResult.failed || gate?.status !== 0 || gate?.result?.statusCode !== 200 ||
    typeof body?.outputs?.isAppMcpEnabled !== "boolean") {
  problem("gate_check_failed", "Could not verify whether the App MCP skill is enabled.",
    "Check target-org authentication and connectivity, then rerun preflight.");
}
if (!body.outputs.isAppMcpEnabled) skip(true);
gatePassed = true;

const metadataResult = sf(["org", "list", "metadata-types", "--target-org", org,
  "--api-version", version, "--json"]);
const metadata = metadataResult.response;
if (metadataResult.failed || (metadata?.status !== undefined && metadata.status !== 0)) {
  problem("metadata_describe_failed", "Could not describe the required metadata types.",
    "Check target-org authentication and connectivity, then rerun preflight.");
}
const listed = metadata?.result?.metadataObjects;
if (!Array.isArray(listed)) {
  problem("metadata_describe_failed", "Metadata describe returned an incomplete response.",
    "Resolve the metadata describe failure, then rerun preflight; this is not an entitlement result.");
}
const types = new Set(listed.map((entry) => entry?.xmlName));
const missing = ["McpServerDefinition", "ExternalClientApplication"].filter((type) => !types.has(type));
if (missing.length) {
  problem("missing_metadata_types", "Required metadata types were not returned: " + missing.join(", ") + ".",
    "Review sourceApiVersion and target-org metadata support, correct the configuration, then rerun preflight.");
}
finish({ decision: "continue" });
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