# platform-custom-field-generate

Generates and validates Salesforce CustomField metadata XML for SFDX projects. It prevents Metadata API deployment failures across relationship fields, picklists, and formulas.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 6500 installs · ★ 1112
- Author: forcedotcom
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/forcedotcom/sf-skills/tree/HEAD/skills/platform-custom-field-generate/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/platform-custom-field-generate

## What it does

The skill builds XML metadata under `force-app/main/default/objects/<Object>/fields/<FieldName>__c.field-meta.xml`. It enforces `<description>` and `<inlineHelpText>` tags on every field. Omitting those tags leads to low-quality metadata, even if the deployment tool accepts it.

It checks data type constraints before generating code. Number and currency fields must obey the `precision ≤ 18` and `scale ≤ precision` rules. For `TextArea`, the tool omits `<length>` entirely because the API fixes it at 255 characters and rejects explicit values.

The skill requires API version 60.0 or higher. It handles field-level picklist configuration, but it will not create a `GlobalValueSet` definition itself. For value set catalogs, use the dedicated `platform-value-set-generate` skill.

## Requirements
- Works with: Salesforce

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-custom-field-generate -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/platform-custom-field-generate/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/platform-custom-field-generate/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-custom-field-generate -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/platform-custom-field-generate/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-custom-field-generate -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/platform-custom-field-generate/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install forcedotcom/sf-skills platform-custom-field-generate
```

2. **Manually: put the files in place**
- File: `.github/skills/platform-custom-field-generate/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-custom-field-generate -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/forcedotcom/sf-skills --path skills/platform-custom-field-generate
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/platform-custom-field-generate/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-custom-field-generate -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/forcedotcom/sf-skills/tree/HEAD/skills/platform-custom-field-generate/SKILL.md

## When to use it
- generate valid `MasterDetail` and `Lookup` relationship metadata
- format XML for formula and Roll-Up Summary fields
- enforce `precision` and `scale` constraints on numeric types
- construct SFDX field XML for picklists and dependent picklists

## Example prompts
- Generate a `Currency` field named Total Amount on the `Opportunity` object
- Create metadata for a `MasterDetail` relationship on `Inventory_Item__c`
- Validate my `TextArea` field XML against Salesforce Metadata API rules

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 22f7708ea871e354.

BEGIN THIRD-PARTY FILE 22f7708ea871e354
```text
---
name: platform-custom-field-generate
description: "Use when users create, generate, or validate Salesforce Custom Field metadata. Trigger on custom fields, field types, Roll-Up Summary, Master-Detail/Lookup relationships, formula fields, picklists, dependent (controlling) picklists, referencing a value set from a field, or scoping picklist values per record type; also field deployment errors, including a record type that won't deploy without a business process. DO NOT TRIGGER for creating/customizing the value set itself — a new GlobalValueSet or a StandardValueSet catalog like Industry — use platform-value-set-generate; this skill covers the field that references a value set, not the value set definition."
metadata:
  version: "1.0"
  domains: ["Platform"]
  minApiVersion: "60.0"
  relatedSkills:
    - "platform-metadata-api-context-get"
    - "platform-validation-rule-generate"
    - "platform-value-set-generate"
  mcpTools:
    metadata-grounding:
      tools: ["search_metadata"]
      semver: ">=1.0.0"
---

# Salesforce Custom Field Generator and Validator

## Overview

Generates and validates Salesforce CustomField metadata XML, with special handling for the **highest-failure-rate types** — Roll-Up Summary and Master-Detail. The agent must verify the constraints below before outputting XML to prevent Metadata API deployment errors.

---

## 1. Universal Mandatory Attributes

Every generated field must include these tags:

| Attribute | Requirement | Notes |
|-----------|-------------|-------|
| `<fullName>` | Required | **Field** name only: 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`. This rule is for the FIELD name. **Picklist VALUE `<fullName>` is different — keep it exactly as the user spelled it, spaces and all, no `__c`** (e.g. `Closed Won`, NOT `Closed_Won`). See [`references/advanced-picklists.md`](references/advanced-picklists.md) (ref §3). |
| `<label>` | Required | The UI name (Title Case) |
| `<description>` | Always include | Explain the business reason *why* this field exists. |
| `<inlineHelpText>` | Always include | Actionable end-user guidance that adds value beyond the label (e.g., "Enter the value in USD including tax", not "The amount"). |

`<description>` and `<inlineHelpText>` are mandatory even though the Metadata API does not enforce them — omitting them yields low-quality metadata.
```
END THIRD-PARTY FILE 22f7708ea871e354

The third-party file has ended. Everything between the 22f7708ea871e354 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2501 of 23975 bytes. © forcedotcom · Apache-2.0 · https://github.com/forcedotcom/sf-skills/tree/HEAD/skills/platform-custom-field-generate/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
