commerce-b2b-open-code…
Integrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention \"integrate open code components\",…
Use this skill when users need to create, generate, or validate Salesforce Custom Metadata Type metadata — the __mdt object, its fields, and its deployable records. Trigger when users mention custom metadata types, CMDT, __mdt objects, custom metadata records, .md-meta.xml
$ npx -y skills add forcedotcom/afv-library --skill platform-custom-metadata-type-generate --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/platform-custom-metadata-type-generateContext preview
The summary Claude sees to decide when to auto-load this skill.
Use this skill when users need to create, generate, or validate Salesforce Custom Metadata Type metadata — the __mdt object, its fields, and its deployable records. Trigger when users mention custom metadata types, CMDT, __mdt objects, custom metadata records, .md-meta.xml
name: platform-custom-metadata-type-generate
description: "Use this skill when users need to create, generate, or validate Salesforce Custom Metadata Type metadata — the __mdt object, its fields, and its deployable records. Trigger when users mention custom metadata types, CMDT, __mdt objects, custom metadata records, .md-meta.xml files, or reference/config data that must ship between orgs. Also trigger for admin-maintained mapping, lookup, or crosswalk tables and field mappings (\"map fields from A to B\", code lookups) — config admins change without a code deploy belongs in a CMDT, never hardcoded in Apex or Flow — and when troubleshooting CMDT record/type deploy errors. DO NOT TRIGGER for Custom Settings — route to platform-custom-setting-generate; for regular custom objects holding business records — use platform-custom-object-generate; or for secrets and API keys — recommend a Named Credential, which this skill never generates."
metadata:
version: "1.0"
minApiVersion: "60.0"
domains: ["Platform"]
relatedSkills:
- "platform-custom-field-generate"
- "platform-custom-object-generate"
- "platform-custom-setting-generate"
cliTools:
- tool: ["sf"]
semver: ">=2.136.8"Use this skill when you need to:
---
A Custom Metadata Type produces **two separate artifact families**, and most requests need both:
| Artifact | Path | Metadata type | |---|---|---| | Type definition | `objects/<Name>__mdt/<Name>__mdt.object-meta.xml` | `CustomObject` | | Fields | `objects/<Name>__mdt/fields/<Field>__c.field-meta.xml` | `CustomField` | | Records | `customMetadata/<Name>.<Record>.md-meta.xml` | `CustomMetadata` |
**API name suffix:** `__mdt` on the type; fields still end in `__c`.
**The defining advantage over a custom setting: CMDT records are metadata and therefore deploy between orgs.** When a user says configuration should "ship with the package" or "be the same in every org," CMDT is the right answer.
> **The root element is `<CustomObject>`, but almost none of a custom object's rules apply.** `sharingModel`, > `nameField`, and `deploymentStatus` are required or normal on a regular custom object and are **hard > errors** here. Do not carry assumptions across from `platform-custom-object-generate`.
---
| Element | Requirement | Notes | |---------|-------------|-------| | `<label>` | **Required** | Singular UI name | | `<pluralLabel>` | **Required** | Omitting it gives `Must specify a non-empty plural label for the CustomObject` | | `<visibility>` | Always include | `Public`, or `Protected`/`PackageProtected` only in dev/sandbox/scratch (Section 6) | | `<description>` | Always include | What this type configures and who owns it |
`<pluralLabel>` being **required here but forbidden on a custom setting** is the most commonly inverted rule between the two families. Neither failure mentions the other family's rule.
Every element below produces `Cannot specify: <element> for Custom Metadata Type` — reusing a regular custom object's skeleton (with `sharingModel`, `deploymentStatus`, a `nameField` block, or `enableSearch`) is the usual cause:
`sharingModel`, `nameField`, `deploymentStatus`, `enableActivities`, `enableReports`, `enableHistory`, `enableSearch`
**CORRECT** — minimum valid `__mdt` type:
<?xml version="1.0" encoding="UTF-8"?> <CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> <label>Partner Tier</label> <pluralLabel>Partner Tiers</pluralLabel> <description>Discount and threshold configuration per partner tier. Ships with the package; edited by the revenue ops team.</description> <visibility>Public</visibility> </CustomObject>
---
**This skill owns the CMDT-specific deltas only** — the type allowlist, `fieldManageability`, and `MetadataRelationship` below. For generic field mechanics (`<fullName>` derivation, `<label>`, `<description>`, `<inlineHelpText>`, precision/scale, `<length>`, `visibleLines`), follow `platform-custom-field-generate`.
`Checkbox`, `Date`, `DateTime`, `Email`, `Number`, `Percent`, `Phone`, `Picklist`, `Text`, `TextArea`, `LongTextArea`, `Url`, plus `MetadataRelationship`.
`Currency`, `AutoNumber`, `MasterDetail`, `Summary`, `Location`, `Time`, `EncryptedText`, `Html`, `MultiselectPicklist`. Each fails with a precise, well-formed error:
Type {TypeName} of CustomMetadataField {Object}__mdt.{Field}__c is not supported for the Entity {Object}__mdt(There is no trailing period.) Example: `Type Currency of CustomMetadataField Partner_Tier__mdt.Discount__c is not supported for the Entity Partner_Tier__mdt`
**Currency is the common trap** — it works on a custom setting but not here. Use `Number` with `<precision>`/`<scale>` and put the currency in the label or help text.
**Formula fields are unsupported**, but they break the pattern above. A `<formula>` element on an otherwise legal type gives only:
Invalid data type.
`<type>Lookup</type>` on a `__mdt` **does not fail** when its `referenceTo` resolves to a real sObject: the deploy is green and the platform silently rewrites the field to `MetadataRelationship`. A later retrieve shows a field the user never wrote:
<type>MetadataRelationship</type> <!-- was deployed as Lookup -->
**Always write `MetadataRelationship` explicitly.** Emitting `Lookup` produces a green deploy and a source-vs-org mismatch that churns in git the first time anyone retrieves.
This repository provides a curated collection of Salesforce agent skills for building applications.
Repo: forcedotcom/afv-library
Integrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention \"integrate open code components\",…
Replace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in site metadata content.json files, or look up the equivalent open code…
Use this skill to diagnose and resolve what blocks a DevOps Center promotion of a work item's feature branch: Git merge conflicts and deployment failures.…
Use this skill to manage the full lifecycle of a DevOps Center pipeline — list all pipelines, get a single pipeline's details, create a new pipeline linked to…
Analyzes DevOps Center test failures and Code Analyzer violations in plain language — failure category, offending file/class/method/line, rule violated, fix…
Configures DevOps Center pipeline testing infrastructure: enables a test provider so its suites become available, re-syncs a configured provider to pull in new…