Prompt template versioning

From PranavNagrecha/AwesomeSalesforceSkills · View interactive version

Prompt template versioning is an AI agent skill from the GitHub repository PranavNagrecha/AwesomeSalesforceSkills. Lifecycle management for Prompt Builder templates: version, test, promote, roll back via CMDT-backed bindings. NOT for source-control layout, model-version pinning, or versioning agent topic prompts — use agentforce/agentforce-prompt-versioning. NOT for authoring a template in Prompt Builder — use a

How to use this skill

Skill file

Prompt Template Versioning

This skill covers the runtime promotion mechanics of a prompt template: how

the live version changes, what a rollback costs in wall-clock time, and how to

serve two variants at once. The repository shape, changelog, model-pinning

policy, and drift detection live in agentforce/agentforce-prompt-versioning.

The two meet at activeVersionIdentifier — that skill decides which version

should be live, this one is about the flip.

Start From What The Platform Already Does

Prompt Builder has native versioning. You can create and use multiple

versions of a template and control which one users reach through activation and

deactivation, with only one version active at a time. The metadata mirrors

it: GenAiPromptTemplate (directory genAiPromptTemplates, minimum API 60.0)

holds every retained version in templateVersions[] — each with versionNumber,

versionIdentifier, status (Published/Draft), content, primaryModel,

inputs, outputSchema, responseFormat, and templateDataProviders — and

activeVersionIdentifier names the live one.

So "how do I keep a history" is already solved. Two gaps remain, and everything

below addresses one of them:

  1. Promotion latency equals your metadata deploy latency — an organisational

property, not a technical one.

  1. Concurrent variants are impossible natively — a hard platform limit.

Recommended Workflow

  1. Keep versions inside one template and have consumers reference the

template, never a version. Promotion is then a one-field change to

activeVersionIdentifier, and rollback is its inverse — both diffable in git,

neither touching a Flow or Apex class.

  1. Before promoting, run a structural diff of the version envelope, not just

the prose. A new required input fails at invocation rather than deploy;

responseFormat and outputSchema break parsers silently;

templateDataProviders changes what data reaches the model; primaryModel

invalidates the goldens even when the text is byte-identical.

  1. Order the release: deploy consumers first (able to handle both versions),

activate second, observe, retire third on a recorded date. Consumers that

only handle the new version remove your rollback.

  1. Measure the rollback wall-clock time in a rehearsal and record it. That

measurement — not a preference for configurability — is the only good reason

to add a CMDT slot-binding layer.

  1. For a canary, accept that you need two templates plus your own resolver:

bucket deterministically on user id, emit a variant-assignment event before

the ramp starts, ramp 10 → 25 → 50 → 100 with a full working day of

observation at each step, and delete the scaffolding on completion.

  1. Put GenAiPromptTemplate early in package.xml — the Metadata API

deploys types in file order, and the template must exist before anything

referencing it (for example AiAgentScorerDefinition) can deploy.

Key Considerations

attribution cannot be recovered after the conversations end.

records as metadata so a change is still a reviewable commit.

date, not on a cleanup instinct.

Trust Layer masking, so new grounding re-opens the PII register review.

Worked Examples (see `references/examples.md`)

wrong version-per-template alternative shown alongside.

tradeoff table for when not to use it.

failure signatures.

Common Gotchas (see `references/gotchas.md`)

variants need two templates and your own resolver.

first, always.

prompt text.

Top LLM Anti-Patterns (full list in `references/llm-anti-patterns.md`)

the opposite premise solve nothing.

were called topics before April 2026).

Official Sources Used

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.