Help us improve
Share bugs, ideas, or general feedback.
From sf-skills
Generates Salesforce Custom Object metadata XML with correct sharing model, name fields, and deployment status. Avoids deployment errors related to Master-Detail relationships.
npx claudepluginhub ccmalcom/sf-skills-plugin --plugin sf-skillsHow this skill is triggered — by the user, by Claude, or both
Slash command
/sf-skills:generating-custom-objectThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill when you need to:
Generates and validates Salesforce Custom Field metadata with mandatory constraints to prevent deployment errors, focusing on Roll-up Summary, Master-Detail, and formula fields.
Fetches Salesforce metadata (objects, fields, flows, validation rules, profiles, Apex, LWC) live from a connected T1 org without ModifyMetadata. Routes sanitized output to downstream review skills.
Defines and evolves Dataverse data models — tables, columns, relationships, forms, and views — using the Python SDK and Web API within a solution context. Publishes metadata changes to the environment rather than hand-editing XML.
Share bugs, ideas, or general feedback.
Use this skill when you need to:
This document defines the mandatory constraints for generating CustomObject metadata XML (.object-meta.xml file). The agent must verify these constraints before outputting XML to prevent Metadata API deployment errors.
File extension: .object-meta.xml
The following constraints must be true for the XML body to deploy successfully.
Note: The API Name (fullName) is NOT a tag; it is the filename (e.g., Vehicle__c.object-meta.xml).
| Element | Requirement | Notes |
|---|---|---|
<label> | Required | Singular UI name |
<pluralLabel> | Required | Plural UI name |
<sharingModel> | Required | See Sharing Model Rules below |
<deploymentStatus> | Required | Always set to Deployed |
<nameField> | Required | Primary record identifier (requires <label> and <type>) |
<visibility> | Required | Always set to Public |
Default: Set <sharingModel> to ReadWrite.
Exception: If this object contains a Master-Detail relationship field, <sharingModel> MUST be ControlledByParent.
Decision Logic:
ReadWriteControlledByParent<sharingModel> must also be updated to ControlledByParent❌ INCORRECT — Will cause error: Cannot set sharingModel to ReadWrite on a CustomObject with a MasterDetail relationship field
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Order Line Item</label>
<pluralLabel>Order Line Items</pluralLabel>
<sharingModel>ReadWrite</sharingModel> <!-- WRONG: Object has a M-D field -->
<deploymentStatus>Deployed</deploymentStatus>
</CustomObject>
✅ CORRECT:
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Order Line Item</label>
<pluralLabel>Order Line Items</pluralLabel>
<sharingModel>ControlledByParent</sharingModel> <!-- CORRECT -->
<deploymentStatus>Deployed</deploymentStatus>
</CustomObject>
The agent must choose which features to enable based on the object's intended use case.
| Type | When to Use | Additional Requirements |
|---|---|---|
| Text | Default for human-named entities (Projects, Locations, Teams) | None |
| AutoNumber | Use for transactions, logs, or IDs (Invoices, Requests, Tickets) | Must include <displayFormat> (e.g., INV-{0000}) and <startingNumber>1</startingNumber> |
Text Name Field Example:
<nameField>
<label>Project Name</label>
<type>Text</type>
</nameField>
AutoNumber Name Field Example:
<nameField>
<label>Invoice Number</label>
<type>AutoNumber</type>
<displayFormat>INV-{0000}</displayFormat>
<startingNumber>1</startingNumber>
</nameField>
<description>: Mandatory. Every object must contain a professional summary.
If the intent is vague, generate a summary:
"Object used to track and manage [Intent] within the organization."
If the object is a many-to-many link between two parents, name the object by combining the two parent entities to ensure the schema remains intuitive.
Examples:
Position_Candidate__c (links Position and Candidate)Job_Application__c (links Job and Application)To maintain "Clean XML," only include optional tags when deviating from the Salesforce platform default of false.
Scenario A: User-Facing Objects (Apps, Trackers, Business Entities)
<enableSearch>, <enableReports>, <enableActivities>, and <enableHistory> to trueScenario B: System-Facing Objects (Junctions, Background Logs)
Never use reserved words as API names for Custom Objects or Custom Fields:
| Category | Reserved Words (Do Not Use as API Names) |
|---|---|
| SOQL/SQL | Select, From, Where, Limit, Order, Group |
| System | User, External, View, Type |
| Temporal | Date, Number |
Do not create more than 2 Master-Detail relationships for a single object. If a third relationship is required, use a Lookup instead.
Do NOT include the <fullName> tag at the root of the .object-meta.xml file. The API name is derived from the filename.
❌ INCORRECT:
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Vehicle__c</fullName> <!-- WRONG: Remove this -->
<label>Vehicle</label>
</CustomObject>
✅ CORRECT:
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Vehicle</label>
<!-- fullName comes from filename: Vehicle__c.object-meta.xml -->
</CustomObject>
Validation rule names follow different conventions than custom fields.
Rules:
__c (unlike custom fields)❌ INCORRECT:
<validationRules>
<fullName>Require_Start_Date__c</fullName> <!-- WRONG: Has __c suffix -->
<active>true</active>
<errorMessage>Start Date is required.</errorMessage>
<formula>ISBLANK(Start_Date__c)</formula>
</validationRules>
Error: The validation name can only contain alphanumeric characters, must begin with a letter, cannot end with an underscore...
✅ CORRECT:
<validationRules>
<fullName>Require_Start_Date</fullName> <!-- CORRECT: No __c suffix -->
<active>true</active>
<errorMessage>Start Date is required.</errorMessage>
<formula>ISBLANK(Start_Date__c)</formula>
</validationRules>
Naming Pattern Reference:
| Metadata Type | Naming Pattern | Example |
|---|---|---|
| Custom Fields | Ends with __c | Start_Date__c |
| Validation Rules | No suffix | Require_Start_Date |
| Custom Objects | Ends with __c | Vehicle__c |
Before generating the Custom Object XML, verify:
<label> and <pluralLabel> present?<deploymentStatus> set to Deployed?<visibility> set to Public?<nameField> include both <label> and <type>?<type> is AutoNumber, are <displayFormat> and <startingNumber> included?<sharingModel> MUST be ControlledByParent<sharingModel> should be ReadWrite<fullName> absent from the XML root?__c?<description> present with a meaningful summary?<enableSearch> and <enableReports> set to true if user-facing?