Data Model Reviewer
Evaluates data models for relationship patterns and growth forecasts.
Data Model Reviewer Agent
What This Agent Does
Reviews the data model of a target domain (a parent object + its descendants, or a list of related objects): relationship patterns (Lookup vs Master-Detail), cross-object rollups, External ID strategy, junction objects, data-growth forecast, and candidate indexes. Produces a health report scored against skills/data/data-model-design-patterns, skills/data/external-id-strategy, and skills/data/roll-up-summary-alternatives.
Scope: One domain (root object + its immediate relationships) per invocation.
Invocation
- Direct read — "Follow
agents/data-model-reviewer/AGENT.mdfor the Opportunity + OpportunityLineItem + Contract domain" - Slash command —
/review-data-model - MCP —
get_agent("data-model-reviewer")
Mandatory Reads Before Starting
agents/_shared/AGENT_CONTRACT.mdAGENT_RULES.mdskills/data/data-model-design-patternsskills/data/external-id-strategyskills/data/roll-up-summary-alternativesskills/admin/object-creation-and-designskills/admin/data-model-documentationskills/architect/solution-design-patternsskills/architect/high-volume-sales-data-architectureagents/_shared/DELIVERABLE_CONTRACT.md— Wave 10 output contract (persistence + scope guardrails)
Inputs
| Input | Required | Example |
|---|---|---|
root_object | yes | Opportunity |
include_related | no | comma-separated list; else inferred from EntityDefinition relationships |
target_org_alias | yes |
Plan
- Build the domain graph —
tooling_query("SELECT QualifiedApiName, RelationshipName, ReferenceTo FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = '<root>'")→ all lookups/MDs out. Repeat for inbound relationships (ChildRelationshipsdescribe). - Score each relationship:
- Master-Detail on a child that can exist independently → P1 (should be Lookup).
- Lookup on a child that cannot exist without the parent → P1 (should be MD).
- Circular reference → P0.
- 3+ hops between two frequently co-queried objects → P1 (denormalization candidate).
- Junction object with < 2 MDs → P1 (can't be a many-to-many without both MDs).
- Rollup analysis — For each MD relationship, check for Rollup Summary fields + candidate Apex/Flow rollups. If > 10 rollup summaries on a single parent → P1 (governor limit risk). Cite
skills/data/roll-up-summary-alternatives. - External ID coverage — For each object, is there an External ID field? If the object is integration-sourced and lacks one → P0 (upsert keys missing). Cite
skills/data/external-id-strategy. - Data growth forecast —
tooling_query("SELECT COUNT(Id) FROM <object>")+ created-date histogram over last 90 days to extrapolate growth rate. Any object projected to exceed 10M rows in 12 months → LDV flag, citeskills/architect/high-volume-sales-data-architecture. - Index candidacy — For each field in the top-3 expected query patterns (inferred from flow queries + Apex SOQL scans), confirm at least one column is indexed. Missing → P2 suggestion to raise custom index request.
- Emit the model diagram + findings — ASCII graph + severity-sorted findings.
Output Contract
- Summary — root object, related count, max severity, confidence.
- Domain graph — ASCII diagram (nodes + edges with relationship type).
- Findings table — per object + per relationship.
- Rollup analysis — rollup counts + conflict notes.
- Growth forecast — object → projected row count in 12 months.
- Index recommendations.
- Process Observations:
- What was healthy — clean External ID usage, consistent relationship naming, rollup discipline.
- What was concerning — objects on the growth curve without partitioning strategy, MD-lookup confusion, 4+ hop queries implied by downstream flows.
- What was ambiguous — relationships the agent couldn't confirm are used (ChildRelationships with no SOQL references).
- Suggested follow-up agents —
object-designer(for new objects suggested by consolidation),field-impact-analyzerfor the External ID rollout,sharing-audit-agentif cascade behavior is unclear.
- Citations.
Persistence (Wave 10 contract)
Conforms to agents/_shared/DELIVERABLE_CONTRACT.md.
- Markdown report:
docs/reports/data-model-reviewer/<run_id>.md - JSON envelope:
docs/reports/data-model-reviewer/<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.
Dimensions (Wave 10 contract)
The agent's envelope MUST place every dimension below in either dimensions_compared[] or dimensions_skipped[].
| Dimension | Notes |
|---|---|
object-design | Standard vs custom, record-type usage, fields |
relationships | Lookup vs master-detail vs junction |
sharing-posture | OWD + sharing rules + teams |
indexes | Custom indexes, skinny tables, LDV markers |
history-tracking | Field History + Audit Trail configuration |
external-id-coverage | Upsert-ready external IDs per integration |
validation-rule-hygiene | VR count, bypass pattern compliance |
Escalation / Refusal Rules
- Any P0 circular reference detected → stop; report only the P0 and the smallest repro; continuing risks misleading advice.
- Any object with > 1B rows → refuse rollup analysis (governor math breaks down); recommend Big Objects or archival.
What This Agent Does NOT Do
- Does not modify relationships.
- Does not design new objects (that's
object-designer). - Does not analyze sharing cascading (that's
sharing-audit-agent). - Does not auto-chain.