Enables the Consumer Goods Cloud TPM Promotion BO API in a Salesforce org. Interviews for a custom Workflow Step, generates/deploys the Apex class, wires it into create/update/copy workflows, and validates via headless REST ingest.
Ships in sf-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turns on the Consumer Goods Cloud TPM Promotion Business Object (BO) API in a
Salesforce org, interviews the user for one custom Workflow Step to add to
the promotion pipeline, generates and deploys that Apex class, registers it
against a BO API entity, wires it into the customer's chosen subset of
{create, update, copy} workflows, then proves the whole path end-to-end via
three REST endpoints:
POST /services/apexrest/<prefix>/promotions/initializePOST /services/apexrest/<prefix>/promotions/ingestGET /services/apexrest/<prefix>/promotions/status?importId=...It is meant for headless delivery: point it at an org, answer the interview, the skill installs and verifies the step. The Promotion BO API ships in the CGCloud managed package (cgcloud released, cgcloud_dev dev/beta). Every Apex identifier, object/field API name, and REST URL is derived from the detected package prefix at runtime.
derive is out of scope here (a follow-up skill covers it). Detailed runbooks
for the write and smoke phases live under references/:
references/preflight-and-seed-queries.md — Phase 1/2/3 SOQL (TPM entitlement, permset gate, framework-state verification, static-resource retrieve recipe, batch-chain polling).references/conventions-and-payload-rules.md — sales-org partitioning, schema-first contract derivation, and the nine cross-workflow payload rules R1–R9.references/generate-and-wire.md — Phase 5a (generate + deploy the class) and Phase 5b (register + wire the step), with the full register-step.apex.references/smoke-and-verify.md — Phase 6 (contract derivation, payload materialization, create/update/copy legs + verification).references/reference-example-set-comment-value.md — the shipped SetCommentValue preset (assets at assets/set-comment-value/).Ask before starting; do not guess.
sf alias of the target org. Required.0001. Must be 4 chars, uppercase (mirrors TPMSetupData.validateSalesOrg). Every downstream lookup (promotion template, tactic template, anchor account, product filter criteria, SKUs) is scoped to this sales org — see references/conventions-and-payload-rules.md ("Sales-org partitioning").--yes for CI callers.--dry-run runs Phases 1, 2, 3a-preview, the Phase 5 interview, and a validate-only deploy. Writes nothing.What the customization is gets collected in Phase 5's interview, once the framework state is known.
The prefix depends on the installed build — detect it, do not guess. Released
package → cgcloud; dev/beta → cgcloud_dev; source-deployed → no prefix.
sf data query --target-org <alias> \
--query "SELECT NamespacePrefix FROM ApexClass WHERE Name = 'TPMSetupData'" --json
Read records[0].NamespacePrefix and bind three variables used everywhere below:
PREFIX_DOT — Apex references: cgcloud. / cgcloud_dev. / empty.PREFIX_UNDER — object/field API names: cgcloud__ / cgcloud_dev__ / empty.URL_NS — REST paths: /cgcloud / /cgcloud_dev / empty.Every Apex call is ${PREFIX_DOT}ClassName.method(...); every SOQL object/field is
${PREFIX_UNDER}Object__c; every REST URL is
/services/apexrest${URL_NS}/promotions/<endpoint>. Substitute at run time.
Run these and stop on the first failure.
sf --version; node --version (only if running shipped scripts). Also export SF_SKIP_NEW_VERSION_CHECK=true once at session start so a stale CLI's update banner cannot leak onto stdout and break any sf … --json | jq … pipe downstream (see references/smoke-and-verify.md "parse caveat" for the alternate sed strip).sf org display --target-org <alias> --json — confirm reachable; capture instanceUrl + org id (display/logging only). REST calls use sf api request rest on the CLI's stored session — the skill never extracts the access token.TPMSetupData.validateSalesOrg). Fail fast.CGCRetailAndTPMMgmtPsl PSL assignment on the running user. SOQL + warn/stop routing in references/preflight-and-seed-queries.md Step 4.TPM_Master_Data_Admin (or a clone matching %TPM%Master Data Admin%); if missing, offer sf org assign permset --name TPM_Master_Data_Admin --target-org <alias> and wait. SOQL in references/preflight-and-seed-queries.md Step 5. Proceed only once admin access is confirmed.${PREFIX_UNDER}Sales_Org__c equals <salesOrg>. Blank throws SOU0003; mismatch surfaces as "not found" (create/update) or TransformationError (copy). SOQL in references/preflight-and-seed-queries.md Step 7. Blank or != '<salesOrg>' → stop; fix on the user record only. See references/conventions-and-payload-rules.md R6; category access is preflighted in Phase 6 per R9.Read-only; tells you whether Phase 3 needs to run. Run the three
sales-org-scoped SOQL queries in references/preflight-and-seed-queries.md
("Phase 2 — Verify BO API framework state"): workflow rows, step row count,
junction row count — all scoped to <salesOrg>.
create/update/copy/derive; >0 step + junction rows) → Phase 3 is a no-op for this sales org (still run for idempotency; 3a shows zero net-new).The workflows/steps/junctions/entities/input-structures ship as CSVs inside the
packaged TPMSetupData static resource; TPMSetupData.setupBOApi reads and
upserts them. Before running it, show the user what will land.
TPMSetupData static resource into a dedicated setup-data/ subproject (keeps the read-only managed resource out of the Phase-5a deploy tree at ./.promotion-bo-api-deploy/force-app), then confirm each target sObject exists. SOQL + the full retrieve recipe + 8-CSV manifest + describe loop are in references/preflight-and-seed-queries.md ("Phase 3a — Retrieve the packaged seed"). Any step failing → stop with the printed delta/error.Unique_Key__c — idempotent") + first 3 rows of 0_BO_API_Workflow__c.csv and 0_BO_API_Workflow_Step__c.csv with {{NS}}/{{SALES_ORG}} substituted.--yes. "no"/blank → abort clean, point at the retrieved BOApi/ directory.--dry-run → stop here; do not run 3b.Only after 3a confirmation.
PHASE3_START=$(date -u +%FT%TZ).${PREFIX_DOT}TPMSetupData.setupMetadataWizard('<salesOrg>'); → sf apex run --target-org <alias> --file ./.promotion-bo-api-deploy/setup-metadata-wizard.apex.GenericDemoSetupDataBatch self-chains via finish(), so poll by class with the two-consecutive-zero break pattern + run the final NumberOfErrors/ExtendedStatus check. SOQL in references/preflight-and-seed-queries.md ("Phase 3b — Poll the batch chain"). Any Failed/Aborted/NumberOfErrors > 0 → stop.${PREFIX_DOT}TPMSetupData.setupBOApi('<salesOrg>');.Re-run the Phase 2 queries. Expect 4 BO_API_Workflow__c rows
(create/update/copy/derive, uniqueness on Unique_Key__c), ≥46
BO_API_Workflow_Step__c rows, ≥54 BO_API_Workflow_Workflow_Step__c junction
rows. Anything short → stop, print what's missing. Never claim success while a
component failed.
The framework is now on. The customization is user-supplied — do not skip the interview or invent an answer. Print:
The Promotion BO API framework is installed. To add a custom step, tell me:
- Which BO API entity does it target? (e.g. Promotion/Tactic — I'll list registered entities)
- Which workflows should it fire in? (create, update, copy)
- What does it read from the ingest input?
- What does it write on the SObject or elsewhere?
- Any preconditions or side effects?
Say "use the SetCommentValue reference" for a worked example.
| Field | Required | Notes |
|---|---|---|
stepName | yes | PascalCase Apex class name + BO API Workflow Step Name. Unique across ApexClass. |
entity | yes | BO API entity Name — MUST match a row queried live from ${PREFIX_UNDER}BO_API_Entity__c (shared, not sales-org-partitioned). Typical rows include Promotion, Tactic, ProductFilter, ManualInputs, CustomState. Query the org — don't assume a fixed list. |
workflows | yes | Non-empty subset of {create, update, copy}. derive is out of scope. |
actionName | yes | Symbolic action string the class receives in call(String action, ...). Convention: lowerCamelCase of stepName. |
inputPaths | yes (≥1) | JSON paths to read from currentInput, e.g. ["Comment"]. |
inputPathType | yes | JSON type of the input paths — String, Array, Boolean, Number, Object. Drives the RecordType on each SIS row; a wrong value causes TransformationError: Expected <Type> at ingest. Different types → run Phase 5b once per type group. |
inputPathRequired | optional | Whether inputPaths must appear on the ingest payload. Defaults to false. Drives BO_API_Step_Input_Structure__c.Required__c (platform default is true — skill always writes explicitly). See references/generate-and-wire.md. |
outputWrites | yes (≥1) | {field, source} pairs; field is the target API name without the namespace prefix (skill adds ${PREFIX_UNDER}), source references an inputPaths value / literal / computed expression. |
description | yes | One-sentence step description → ${PREFIX_UNDER}Description__c + class docstring. |
preconditions | optional | Free-text guards before writing. |
sortAfter | optional | Named packaged step to sort after; default max(Sort__c) + 10. |
--preset set-comment-value (or "use the SetCommentValue reference") loads answers from references/reference-example-set-comment-value.md (assets/set-comment-value/interview-answers.json) and skips the interactive interview. --interview-file <path> loads a JSON mirroring the 5.1 table (wins over --preset).sf sobject describe --target-org <alias> --sobject '${PREFIX_UNDER}<Entity>__c' --json \
| jq -r '.fields[] | select(.updateable == true and .createable == true) | .name'
Any outputWrites field must appear here; otherwise stop and ask for a different one (FLS is caller-scoped).workflows includes copy, flag TWO copy-only preconditions up front so neither surfaces as a runtime surprise: (a) per-child input values come from the source promotion — outputWrites still fires but <inputPaths> values are ignored (only top-level fields like Slogan propagate); (b) the running User.Sales_Org__c MUST equal the source template's Sales_Org__c (preflighted in Phase 1 step 7 + re-checked before every Phase 6 ingest; a mid-flow drift fails copy with TransformationError: The User and the Promotion Template must have the same Sales org — fix on the user record, do not mutate mid-flow; see references/conventions-and-payload-rules.md R6). n/blank → save answers to ./.promotion-bo-api-deploy/interview.json and exit. y → Phase 5a.Runbook in references/generate-and-wire.md. In short: guard the class name
for idempotency; confirm target-field writeability; clean any stale
.cls/.cls-meta.xml from
./.promotion-bo-api-deploy/force-app/main/default/classes/ (leftovers cause a
silent MDAPI full-batch rollback); generate a namespace-agnostic Callable
from the interview — class and call method must be global (packaged
CallableManager resolves via Type.forName across the namespace boundary;
public fails at runtime on managed installs — see runbook); show + confirm;
sf project deploy start. Then, in one anon-Apex transaction, upsert one
BO_API_Workflow_Step__c (bare class name in Classname__c), one
BO_API_Workflow_Workflow_Step__c junction per chosen workflow (derive
dropped), and the BO_API_Step_Input_Structure__c rows (RecordType per
inputPathType, Required__c set explicitly from inputPathRequired). Both
upserts key on Unique_Key__c (idempotent).
Runbook in references/smoke-and-verify.md. Derive the payload contract per
invoked workflow from BO_API_Step_Input_Structure__c (schema-first), apply
rules R1–R9 from references/conventions-and-payload-rules.md, resolve every
reference in-sales-org, materialize ./out/smoke/{create,update,copy}.json, then
run initialize → ingest → poll status for each chosen workflow. Verify via a
direct BO_API_Transaction_Log__c query (any row != 'Calculated' → fail) plus
an outputWrites field assertion against ./out/smoke/expected.json. Update and
copy legs run only if the interview included them.
Short status: org, sales org, dry-run flag; namespace prefix; seed rows
before/after (Phases 2 & 4); interview summary; deploy result + workflow-step
id + junction ids; smoke import ids per invoked workflow — all Calculated
with matching assertions, or exactly which failed (SOQL, expected, actual);
manual follow-ups (none if clean).
BO_API_Transaction_Log__c row for the smoke import ids has Status__c != 'Calculated'. Calculated is the terminal success state (R2); Processed does NOT exist in the picklist.outputWrites assertion fails, or while any GenericDemoSetupDataBatch AsyncApexJob since the phase start is still running or failed.TPMSetupData / BO_API_* objects and the shipping REST endpoints declare.TPMSetupData.setupBOApi.--preset/--interview-file, stop and print the questions.create/update/copy are opt-in; derive is always excluded.BO_API_Step_Input_Structure__c and validate user input against that contract first.Callable step class with public visibility — declare the class and the call method global. public works only on same-namespace dev orgs and fails on managed installs with Type "<stepName>" does not exist; the transaction log shows a generic Error. See references/generate-and-wire.md../.promotion-bo-api-deploy/force-app/main/default/classes/ across step deploys — remove the prior step's .cls/.cls-meta.xml first. A stale file triggers a silent MDAPI full-batch rollback while the CLI still reports "created": true.BO_API_Step_Input_Structure__c row without setting Required__c explicitly. The platform defaults it to true; the skill defaults false and only opts in when inputPathRequired is set. Omitting the field silently makes every optional path mandatory.${PREFIX_UNDER}Sales_Org__c equals <salesOrg> — blank throws SOU0003; mismatch surfaces as "not found" (create/update) or TransformationError (copy). Fix on the user record only. See references/conventions-and-payload-rules.md R6.ProductFilter.Criteria.<level> references categories the running user lacks Product_Category_Share__c Access_Level__c='ReadWrite' on — Phase 6 preflight per references/conventions-and-payload-rules.md R9. Do not silently insert share rows.assets/set-comment-value/README.md (opens in a new tab)assets/set-comment-value/SetCommentValue.cls (opens in a new tab)assets/set-comment-value/SetCommentValue.cls-meta.xml (opens in a new tab)assets/set-comment-value/interview-answers.json (opens in a new tab)assets/set-comment-value/payloads/copy.json (opens in a new tab)assets/set-comment-value/payloads/create.json (opens in a new tab)assets/set-comment-value/payloads/update.json (opens in a new tab)references/conventions-and-payload-rules.md (opens in a new tab)references/generate-and-wire.md (opens in a new tab)references/preflight-and-seed-queries.md (opens in a new tab)references/reference-example-set-comment-value.md (opens in a new tab)references/smoke-and-verify.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/sf-skills:consumer-goods-promotion-bo-api-deployfrom sf-skills
sf-skills@sf-skills-plugin is listed by ccmalcom/sf-skills-plugin — review the source before installing
npx claudepluginhub ccmalcom/sf-skills-plugin --plugin sf-skills266 skills in this plugin
/afcc-setup-coordinateOrchestrates end-to-end headless setup of Agentforce Contact Center (AFCC) on a Salesforce org. Scans the org first, presents a delta plan for approval, then sequentially provisions demo users, Omni-Channel base settings, a human queue with routing config and members, presence statuses, permission sets, a PSTN voice number, and an active PstnVoice MessagingChannel wired to the queue. Interactive at key decision points — never assumes country, number type, queue names, or user counts. TRIGGER: set up AFCC, configure Agentforce Contact Center, stand up voice contact center, AFCC migration setup, provision AFCC org headlessly./agentforce-architecture-analyzeDeclared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA plugins. Renders a human-readable architecture document and Mermaid invocation graph from design-time metadata (not runtime audit rows). TRIGGER when user asks to describe, diagram, inventory, audit, document, or diff (e.g. v3 vs v5) the architecture / action tree / topic structure / tool inventory of a specific agent by agent API name in a specific org. DO NOT TRIGGER for runtime session traces, conversation transcripts, generation timings, or gateway audit chains — this skill reads design-time metadata only (use agentforce-d360-analyze for session traces)./agentforce-bot-upgradeUse this skill to upgrade Einstein Bots into Agentforce agents end-to-end in a single pass, orchestrating per-bot Agent Spec generation, agentforce-generate authoring, and post-conversion .agent enhancements. TRIGGER when: user asks to migrate, upgrade, or convert one or more Einstein Bots (BotDefinition/BotVersion chatbots) to Agentforce agents; runs a multi-bot bot-to-agent upgrade; needs Einstein Bot metadata turned into Agent Spec handoffs and generated .agent agents; convert bots to agents; upgrade my service bots; move bots to Agentforce. DO NOT TRIGGER when: user already has an approved Agent Spec and only wants direct .agent authoring, deploy, test, or observe flows; user wants to migrate or upgrade an EXISTING Agentforce agent from a legacy GenAiPlannerBundle to an NGA aiAuthoringBundle (that is agentforce-generate's 'Migrate a Legacy Agent to Agent Script' flow, not an Einstein Bot upgrade); the request is unrelated to Einstein Bot migration./agentforce-d360-analyzeData Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific Agentforce session by session id (Agent Session UUID `019d…` or MessagingSession id `0Mw…`). Also triggers on session discovery — find/list/search sessions by time, agent, channel, outcome, or conversation text — when the user has no session id yet. DO NOT TRIGGER for design-time architecture questions (use agentforce-architecture-analyze instead) or for runtime perf/latency/SLO questions that require platform telemetry beyond Data Cloud./agentforce-generateBuild, modify, audit, repair, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, reviews, or changes .agent files or aiAuthoringBundle metadata; asks to fix AgentScript, audit an existing agent, run an AgentScript health check, common-pitfall review, or baseline-versus-candidate repair loop; changes a response, action, subagent, route, state flow, or Agent Spec; migrates or upgrades a legacy GenAiPlannerBundle Agentforce agent (NOT an Einstein Bot) to an aiAuthoringBundle (Agent Script) agent; previews, debugs, deploys, publishes, or tests agents; uses sf agent generate/preview/publish/test; or manages Agentforce MCP servers, tools, assets, or authentication. DO NOT TRIGGER when: Apex, Flow, Prompt Template, Experience Cloud, or general Salesforce CLI work is unrelated to Agent Script; the source is an Einstein Bot (BotDefinition/BotVersion) — use agentforce-bot-upgrade; or the primary input is a production session or trace ID rather than an agent artifact./agentforce-hyperclassifier-configureOnboard a customer org and evaluate or improve Agentforce HyperClassifier routing descriptions against labeled utterances. TRIGGER for classifier evaluation, expected-versus-actual routing reports, repeated regressions, or description optimization with customer ECA authentication. DO NOT TRIGGER for general agent conversation testing, runtime session tracing, or automatic agent deployment.3 plugins ship this exact skill · first indexed Nov 1, 2026
Other plugins' skills for the same job