
Generating Custom Field
Generate and validate Salesforce CustomField metadata XML so roll-ups, master-detail, and formulas deploy without Metadata API errors.
Install
npx skills add https://github.com/forcedotcom/sf-skills --skill generating-custom-fieldWhat is this skill?
- Mandatory constraint checks before any CustomField XML is emitted
- Deep coverage of Roll-up Summary and Master-Detail—the highest-failure field types
- Supports Lookup/Master-Detail, formula, picklist, and standard custom field types
- Troubleshoots deployment errors tied to roll-up format, MD constraints, and formulas
- Acts as generator and validator for any object’s custom field metadata
Adoption & trust: 752 installs on skills.sh; 513 GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Entra App Registrationmicrosoft/azure-skills
Azure Aigatewaymicrosoft/azure-skills
Lark Openapi Explorerlarksuite/cli
Supabasesupabase/agent-skills
Firebase Auth Basicsfirebase/agent-skills
Firebase Data Connectfirebase/agent-skills
Journey fit
Primary fit
Custom fields are created while wiring CRM data models and integrations during product build, not during launch or growth tactics. Salesforce metadata generation is platform integration work—relationship fields and roll-up summaries belong on the integrations shelf.
Common Questions / FAQ
Is Generating Custom Field safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Generating Custom Field
## When to Use This Skill Use this skill when you need to: - Create custom fields on any object - Generate field metadata for any field type - Set up relationship fields (Lookup or Master-Detail) - Create formula or roll-up summary fields - Troubleshoot deployment errors related to custom fields # Salesforce Custom Field Generator and Validator ## Overview Generate and validate Salesforce Custom Field metadata with mandatory constraints to prevent deployment errors. This skill has special focus on the **highest-failure-rate field types**: Roll-up Summary and Master-Detail relationships. ## Specification ## 1. Purpose This document defines the mandatory constraints for generating CustomField metadata XML. The agent must verify these constraints before outputting XML to prevent Metadata API deployment errors. **Critical Focus Areas:** - Roll-up Summary field format errors - Master-Detail field attribute restrictions - Lookup Filter restrictions --- ## 2. Universal Mandatory Attributes Every generated field must include these tags: | Attribute | Requirement | Notes | |-----------|-------------|-------| | `<fullName>` | Required | Derive from `<label>`: capitalize each word, replace spaces with `_`, append `__c`. Must start with a letter. E.g., label `Total Contract Value` → `Total_Contract_Value__c` | | `<label>` | Required | The UI name (Title Case) | | `<description>` | Mandatory | State the business "why" behind the field | | `<inlineHelpText>` | Mandatory | Provide actionable guidance for the end-user. Must add value beyond the label (e.g., "Enter the value in USD including tax" instead of just "The amount") | ### External ID Configuration **Trigger:** If the user mentions "integration," "importing data," "external system ID," or "unique key from [System Name]," set `<externalId>true</externalId>`. **Applicable Types:** Text, Number, Email --- ## 3. Technical Interplay: Precision, Scale, and Length To ensure deployment success, follow these mathematical constraints: ### Precision vs. Scale Rules - `precision` is the total digits; `scale` is the decimal digits - **Rule:** `precision ≤ 18` AND `scale ≤ precision` - **Calculation:** Digits to the left of decimal = `precision - scale` ### The "Fixed 255" Rule For standard TextArea types, the Metadata API requires `<length>255</length>`, even though it isn't configurable in the UI. ### Visible Lines Mandatory for Long/Rich text and Multi-select picklists to control UI height. --- ## 4. Field Data Types ### 4.1 Simple Attribute Types | Type | `<type>` Value | Required Attributes | |------|----------------|---------------------| | Auto Number | `AutoNumber` | `displayFormat` (must include `{0}`), `startingNumber` | | Checkbox | `Checkbox` | Default `defaultValue` to `false` | | Date | `Date` | No precision/length required | | Date/Time | `DateTime` | No precision/length required | | Email | `Email` | Built-in format validation | | Lookup Relationship | `Lookup` | `referenceTo`, `relationshipName`, `deleteConstraint` | | Master-Detail Relationship | `MasterDetail` | `referenceTo`, `relationshipName`, `relationshipOrder` | | Number | `Number` | `precision`, `scale` | | Currency | `Currency` | Default precision: 18, scale: 2 | | Percent | `Percent` | Default precision: 5, scale: 2 | | Phone | `Phone` | Standardizes phone number formatting | | Picklist | `Picklist` | `va