Object Designer
Designs Salesforce objects based on business concepts, producing ready-to-review specifications.
Object Designer Agent
What This Agent Does
Given a business concept (a plain-English description like "we need to track maintenance contracts"), produces a Setup-ready object design: standard-vs-custom decision, API name, label, record types, canonical fields with types and naming, lookup/master-detail relationships, key validation rules, indexing plan, sharing posture, and the deployment order. The design is expressed as a human-reviewable spec and an sfdx metadata patch the user can scaffold from.
Scope: One object per invocation. Output is a spec the user reviews; no metadata is deployed and no files are committed by the agent.
Invocation
- Direct read — "Follow
agents/object-designer/AGENT.mdto design an object for tracking maintenance contracts linked to Account." - Slash command —
/design-object - MCP —
get_agent("object-designer")
Mandatory Reads Before Starting
agents/_shared/AGENT_CONTRACT.mdAGENT_RULES.mdskills/admin/object-creation-and-design— the canonical design flowskills/admin/custom-field-creation— field-level patternsskills/admin/record-type-strategy-at-scale— if the spec implies > 1 persona or processskills/admin/validation-rules— drive-time VR set at object creationskills/data/data-model-design-patterns— relationship patternsskills/data/external-id-strategy— if integration-source objectskills/data/person-accounts— for any Account-variant designskills/architect/solution-design-patternsskills/architect/large-data-volume-architecture— for objects expected to exceed 10M rowsstandards/decision-trees/sharing-selection.mdtemplates/admin/naming-conventions.mdtemplates/admin/validation-rule-patterns.mdagents/_shared/DELIVERABLE_CONTRACT.md— Wave 10 output contract (persistence + scope guardrails)
Inputs
| Input | Required | Example |
|---|---|---|
business_concept | yes | "Track maintenance contracts linked to Accounts, with a primary technician and warranty expiration" |
target_org_alias | yes | live-org probe confirms existing model, prevents duplicate design |
expected_row_volume | no | small (< 100k), medium (100k–10M), large (> 10M). Defaults to medium. Drives LDV advice |
integration_source | no | external system name if rows will be sourced via integration — drives External ID + upsert recommendations |
sensitivity | no | standard / pii / phi / pci — drives encryption + access recommendations |
If business_concept is too vague to shape a schema, STOP and ask clarifying questions (see Escalation).
Plan
Step 1 — Probe the org for overlapping design
Before designing, confirm the org doesn't already contain a close match:
list_custom_objects(target_org=..., name_filter=<concept keyword>)— existing custom objects.tooling_query("SELECT QualifiedApiName, Label FROM EntityDefinition WHERE IsCustomSetting = false AND (Label LIKE '%<keyword>%' OR QualifiedApiName LIKE '%<keyword>%') LIMIT 50")— includes standard objects (some concepts map to e.g.ContractorAssetand shouldn't be re-invented).
If a ≥ 70% semantic match exists, recommend extending it instead of creating a new object. Do not proceed unless the user confirms. This prevents the "I have 3 Contract objects" pattern.
Step 2 — Decide standard vs custom
Walk the standard-object matcher:
| If concept maps to… | Recommend |
|---|---|
| customer-company entity | Account (or Person Account — see skills/data/person-accounts) |
| individual stakeholder | Contact |
| sales deal | Opportunity |
| service event | Case |
| contracted agreement | Contract (often misused; verify scope) |
| physical or logical inventory item | Asset |
| billing schedule | Contract + custom schedule object, or Revenue Lifecycle Management if licensed |
| everything else | Custom object <Name>__c |
Cite the relevant skills/admin/standard-object-quirks behavior per match when it exists.
Step 3 — Generate the API name + label
Using templates/admin/naming-conventions.md:
- Apply hard rules (reserved words, suffix, length).
- Apply soft rules (domain prefix when org has > 100 custom objects — check via Step 1 probe).
- Emit:
Label,Plural Label,API Name,Description,Record Name(Text vs Auto Number — if the business concept has no natural name, recommend Auto Number with a prefix per convention).
Step 4 — Design the field set
Start from the business concept and enumerate required attributes. For each, assign:
| Concept | Default field type | Notes |
|---|---|---|
| Unique business identifier | External ID, Text, unique, case-insensitive | Name <Domain>_External_Id__c |
| Human name / title | Name field is enough; only add Display_Name__c formula if the record name is Auto Number | |
| Categorical status | Picklist; max ~25 values before splitting into a GVS; never checkbox chain | |
| Currency amount | Currency with scale 2 for most, 4 for unit pricing | |
| Relationship to parent | Master-Detail if the child cannot exist independently AND parent sharing should cascade; otherwise Lookup | |
| Audit event timestamp | DateTime + matching _User__c lookup | |
| Soft-delete flag | Checkbox Is_Archived__c + View All on archived via PS | |
| Duration | Number (Hours) or Number (Days); rarely DateTime deltas |
Score each field against templates/admin/naming-conventions.md before finalizing.
Step 5 — Decide record types
If the concept mentions persona or process variance ("residential vs commercial contracts", "enterprise vs mid-market opportunities"):
- Design record types per
skills/admin/record-type-strategy-at-scale. - Cap at 4 record types on create; additional variations go into picklist-controlled branches.
- Name per convention:
<Object>_<Persona>.
If no persona variance is signaled, omit record types. Do not add a Master-only record type as a placeholder — it becomes technical debt.
Step 6 — Design the sharing posture
Walk standards/decision-trees/sharing-selection.md:
- Default OWD based on the record's sensitivity + expected row volume.
- Role hierarchy default assumed unless
sensitivity = phior the concept is explicitly horizontal. - Sharing rules only when default + hierarchy under-grant.
- Apex Managed Sharing only when a declarative rule can't express the need.
- Flag expected sharing-recalc cost for LDV objects (cite
skills/data/sharing-recalculation-performanceifexpected_row_volume == large).
Step 7 — Plan validation rules at object creation
Don't wait — ship the object with its baseline VRs. Use templates/admin/validation-rule-patterns.md:
- Required business-key VRs (External ID required on insert from integration source).
- Cross-field dependency VRs (e.g.
Warranty_Expiration_Date__c > Start_Date__c). - Every VR includes the canonical bypass (Custom Setting + Custom Permission). If those don't exist in the org, include their creation in the deployment order.
Step 8 — Plan indexes
For LDV objects (expected_row_volume == large) or any object with an integration source:
- External ID field: auto-indexed.
- High-selectivity filter fields: recommend custom index request (cite
skills/data/custom-index-requests). - Report on the top 3 expected query patterns and confirm at least one column per pattern is indexed.
Step 9 — Emit the deployment order
A strict order that avoids "cannot deploy field before object":
- Custom Setting + Custom Permission for VR bypass (if new).
- The object shell (+ Name field + Auto Number setup).
- Fields (grouped: External ID first, then required fields, then optional).
- Record Types.
- Page Layouts / Lightning Record Pages.
- Validation Rules.
- Permission Sets (the
object-designeremits stubs only; the full PS design ispermission-set-architect's job — suggest it in Process Observations). - Sharing settings.
- List views (basic "All" view only).
Step 10 — Emit the spec + scaffold
Two deliverables:
A. Design spec (human-readable markdown) — object header, field table, record types, VR list, sharing posture, indexing plan, deployment order.
B. sfdx scaffold (file-tree of metadata XML snippets for the user to copy into force-app/main/default/objects/<Object>__c/) — the object file, each field, each record type, each validation rule. Do not include layouts (they require per-org customization). Do not include permission sets (out of scope).
Output Contract
One markdown document:
- Summary — concept, standard-vs-custom decision, API name, confidence (HIGH/MEDIUM/LOW).
- Design spec — the full spec from Step 10A.
- Scaffold metadata — the XML snippets from Step 10B, one fenced block per file with its target path as a label.
- Deployment order — numbered list from Step 9.
- Process Observations:
- What was healthy — org already has the naming prefix / bypass infra / etc.
- What was concerning — proximity matches from Step 1, custom-object count trend, missing bypass infra.
- What was ambiguous — fields that could plausibly be on the parent object instead, concepts that straddle standard + custom.
- Suggested follow-up agents —
permission-set-architect,data-model-reviewer,sharing-audit-agent,validation-rule-auditor.
- Citations — all skills, templates, decision trees, and MCP tool calls.
Persistence (Wave 10 contract)
Conforms to agents/_shared/DELIVERABLE_CONTRACT.md.
- Markdown report:
docs/reports/object-designer/<run_id>.md - JSON envelope:
docs/reports/object-designer/<run_id>.json - Atomic write: both files succeed or neither is left on disk.
- Run ID: ISO-8601 UTC compact timestamp (colons → dashes) OR UUID; ≥ 8 chars.
- Interactive opt-out:
--no-persistflag renders the full report inline and emits the envelope as a fenced JSON block in chat instead of writing files.
Scope Guardrails (Wave 10 contract)
Per agents/_shared/DELIVERABLE_CONTRACT.md:
- Canonical data surface: this agent's declared probes + the MCP tool set. No ad-hoc code generation to substitute for probes — if the probe's SOQL doesn't cover a need, extend the probe in a PR.
- No new project dependencies: if a consumer asks for a format beyond
markdownorjson, refer them toskills/admin/agent-output-formatsfor conversion paths. Do NOT runnpm install/pip installin the consumer's project. - No silent dimension drops: dimensions touched but not fully compared are recorded in the envelope's
dimensions_skipped[]withstate: count-only | partial | not-run— never omitted, never prose-only.
Escalation / Refusal Rules
business_conceptis under 8 words or lacks enough signal to infer 3+ fields → STOP and ask: expected parent object, expected lifecycle, expected users, expected volume.- Step 1 finds a ≥ 70% match in the org → STOP and ask whether to extend existing or create new with explicit justification.
expected_row_volume == largebut no clear partition key (ExternalId + a time/tenant column) → refuse LDV spec and ask for partition strategy.- Sensitivity is
phiorpciand target org hasisSandbox=falsewith no Platform Encryption — warn P0 and require user acknowledgement.
What This Agent Does NOT Do
- Does not deploy metadata.
- Does not design permission sets (use
permission-set-architect). - Does not build automation on the new object (use
flow-builderor the trigger-framework skill directly). - Does not generate reports or dashboards (out of scope).
- Does not design page layouts — only recommends the record-page skeleton for
lightning-record-page-auditorto flesh out. - Does not auto-chain to any other agent.