Author and inspect Microsoft Dataverse data model: tables, columns, choices, lookups, relationships, alternate keys, forms, and views. Use for schema changes, not record operations.
Ships in dataverse. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create and evolve tables, columns, relationships, keys, forms, and views in a Dataverse environment, then pull the generated solution XML into the repo.
Use this skill to change or inspect the schema. Route other work elsewhere:
| Need | Use instead |
|---|---|
| Create, update, or delete records | dataverse-data |
| Query or read records | dataverse-query |
| Export, unpack, pack, or import solutions | dataverse-solution |
| Environment settings, audit, bulk delete | dataverse-admin |
Confirm the target environment with the user (see the environment rule in dataverse-overview).
Confirm the solution. If SOLUTION_NAME is in .env, confirm it. If no solution exists yet,
stop and ask:
"What solution name and publisher prefix should I use? The prefix (e.g.
contoso) is permanent on every table and column."
The publisher prefix cannot be changed after components are created with it.
Show existing publishers so the user can reuse one, then create the publisher (with the
user's prefix, never hardcoded) and solution with the SDK, never raw Web API. The full discovery
and creation flow is in dataverse-solution:
publishers = client.records.list("publisher",
filter="customizationprefix ne 'none' and uniquename ne 'MicrosoftCorporation'",
select=["publisherid", "uniquename", "friendlyname", "customizationprefix"], top=10)
Pass solution="<UniqueName>" on every SDK metadata call, or send the MSCRM.SolutionName
header on every raw Web API call. Never create tables or columns outside a solution.
Find an existing prefix with pac solution list --environment <url>, or read <CustomizationPrefix>
in solutions/<SOLUTION_NAME>/Other/Solution.xml after the first pull.
Do not hand-write solution XML to create tables, columns, forms, or views. The environment validates metadata far better than hand edits, and a single wrong attribute causes an opaque import failure.
pac).pac solution export + pac solution unpack (see dataverse-solution).Edit files directly only for small tweaks to components already in the repo (reorder form fields, change a label, adjust view columns).
Schema inspection from the CLI: dataverse data describe --table account --include all --json.
API discovery: dataverse api list --target dataverse.
import os, sys
sys.path.insert(0, os.path.join(os.getcwd(), "scripts"))
from auth import get_client
client = get_client()
All snippets below assume this client.
Prefer the SDK. Fall back to the Web API only for properties the SDK does not expose
(OwnershipType, HasActivities, HasNotes, and similar).
info = client.tables.create(
"new_ProjectBudget",
{"new_Amount": "decimal", "new_Description": "string"},
solution="MySolution",
primary_column="new_Name",
display_name="Project Budget", # plural display name auto-appends "s"
)
print(f"Created: {info['table_schema_name']}")
Web API fallback (POST /api/data/v9.2/EntityDefinitions with the MSCRM.SolutionUniqueName header):
def label(text):
return {"@odata.type": "Microsoft.Dynamics.CRM.Label",
"LocalizedLabels": [{"@odata.type": "Microsoft.Dynamics.CRM.LocalizedLabel",
"Label": text, "LanguageCode": 1033}]}
entity = {
"@odata.type": "Microsoft.Dynamics.CRM.EntityMetadata",
"SchemaName": "new_ProjectBudget",
"DisplayName": label("Project Budget"),
"DisplayCollectionName": label("Project Budgets"),
"Description": label(""),
"OwnershipType": "UserOwned",
"HasActivities": False, "HasNotes": False, "IsActivity": False,
"PrimaryNameAttribute": "new_name",
"Attributes": [{
"@odata.type": "Microsoft.Dynamics.CRM.StringAttributeMetadata",
"SchemaName": "new_name",
"DisplayName": label("Name"),
"RequiredLevel": {"Value": "ApplicationRequired"},
"MaxLength": 100, "IsPrimaryName": True,
}],
}
Creating several tables for an import? Use the check-first ensure_table helper and phased
creation in references/metadata-propagation.md, and add
alternate keys right after the tables exist.
If a table was created outside a solution, add it with
pac solution add-solution-component --solutionUniqueName <SOLUTION_NAME> --component <SchemaName> --componentType 1 --environment <url>
(1 = Entity; full type list in dataverse-solution). Web API equivalent:
POST /api/data/v9.2/AddSolutionComponent with ComponentId (entity metadata ID), ComponentType: 1,
SolutionUniqueName, and AddRequiredComponents: true.
Never give a regular column an Id suffix (e.g. prefix_DepartmentId). Lookups auto-generate
an ...Id schema name, so a later lookup creation fails with a name collision. Use
prefix_SrcDepartmentId or prefix_DepartmentSourceId instead.
created = client.tables.add_columns(
"new_ProjectBudget",
{"new_Description": "string", "new_Amount": "decimal", "new_Active": "bool"},
)
Supported type strings: string/text, int/integer, decimal/money, float/double,
datetime/date, bool/boolean, file, plus Enum subclasses for local choices:
from enum import IntEnum
class BudgetStatus(IntEnum):
DRAFT = 100000000
APPROVED = 100000001
REJECTED = 100000002
client.tables.add_columns("new_ProjectBudget", {"new_Status": BudgetStatus})
Use the Web API for types the SDK cannot shape, such as currency with precision or memo with a
custom max length (POST /api/data/v9.2/EntityDefinitions(LogicalName='new_projectbudget')/Attributes):
attribute = {
"@odata.type": "Microsoft.Dynamics.CRM.MoneyAttributeMetadata",
"SchemaName": "new_amount",
"DisplayName": label("Amount"),
"RequiredLevel": {"Value": "None"},
"MinValue": 0, "MaxValue": 1000000000,
"Precision": 2, "PrecisionSource": 2,
}
After creating columns, always report the actual logical names in a table. Names may be normalized or prefixed in ways the user does not expect, and downstream inserts fail otherwise:
| Display Name | Logical Name | Type |
|---|---|---|
contoso_email | String | |
| Tier | contoso_tier | Picklist |
| Customer | contoso_customerid | Lookup |
Simple lookup (preferred):
result = client.tables.create_lookup_field(
referencing_table="new_projectbudget",
lookup_field_name="new_AccountId",
referenced_table="account",
display_name="Account",
solution="MySolution",
)
Full control over a 1:N relationship:
from PowerPlatform.Dataverse.models.relationship import (
LookupAttributeMetadata, OneToManyRelationshipMetadata, CascadeConfiguration,
)
from PowerPlatform.Dataverse.models.labels import Label, LocalizedLabel
from PowerPlatform.Dataverse.common.constants import CASCADE_BEHAVIOR_REMOVE_LINK
lookup = LookupAttributeMetadata(
schema_name="new_AccountId",
display_name=Label(localized_labels=[LocalizedLabel(label="Account", language_code=1033)]),
)
relationship = OneToManyRelationshipMetadata(
schema_name="account_new_projectbudget",
referenced_entity="account",
referencing_entity="new_projectbudget",
referenced_attribute="accountid",
cascade_configuration=CascadeConfiguration(delete=CASCADE_BEHAVIOR_REMOVE_LINK),
)
result = client.tables.create_one_to_many_relationship(lookup, relationship, solution="MySolution")
Many-to-many:
from PowerPlatform.Dataverse.models.relationship import ManyToManyRelationshipMetadata
relationship = ManyToManyRelationshipMetadata(
schema_name="new_ticket_knowledgebase",
entity1_logical_name="new_ticket",
entity2_logical_name="new_knowledgebase",
)
result = client.tables.create_many_to_many_relationship(relationship, solution="MySolution")
Web API fallback: POST /api/data/v9.2/RelationshipDefinitions with a
Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata body (SchemaName, ReferencedEntity,
ReferencingEntity, and a nested Lookup of type LookupAttributeMetadata).
Setting a lookup on records uses the case-sensitive navigation property name from $metadata,
usually the lookup's SchemaName:
| Navigation property | @odata.bind key | Value |
|---|---|---|
new_AccountId | [email protected] | /accounts(<guid>) |
new_ParentTicketId | [email protected] | /new_tickets(<guid>) |
Using the lowercase logical name ([email protected]) returns HTTP 400.
UpsertMultiple needs an alternate key to match existing records. Create keys on source-system ID
columns (prefix_Src*Id) during schema setup so every import is idempotent.
key = client.tables.create_alternate_key(
"prefix_Country", "prefix_SrcCountryIdKey", ["prefix_srccountryid"],
display_name="Source Country ID",
)
client.tables.get_alternate_keys(table) until
the status is Active.Column-selection rules (database vs Excel/CSV source), the idempotent ensure_alternate_key helper,
and failure handling: references/alternate-keys.md.
systemform (forms) and savedquery (views) are ordinary entities, so create and modify them with
the SDK's record CRUD. Only publishing (PublishXml) goes through dataverse api request.
| Task | How |
|---|---|
| Create form | client.records.create("systemform", {..., "type": 2}) (2 Main, 7 Quick Create, 6 Quick View, 11 Card) |
| Modify form | List a template form, mutate formxml, client.records.update("systemform", id, {...}) |
| Create view | client.records.create("savedquery", {...}) (querytype 0 standard, 1 advanced find, 2 associated, 4 quick find) |
| Publish | dataverse api request POST /api/data/v9.2/PublishXml (required after every create or modify) |
| Add to solution | pac solution add-solution-component (60 form, 26 view); records.create has no solution= |
Key rules:
<tab>, <section>, <cell>) and labelid must be unique GUIDs; generate them
with str(uuid.uuid4()).upper() inside a .py file, never python -c on Windows.Full code, publish payload, classid table, and pitfalls:
references/forms-and-views.md.
Business rules: create them in the Power Apps maker portal, then export, unpack, and commit. They are too complex to author reliably as JSON/XAML.
Read-only calls that return raw metadata dictionaries (PascalCase keys); safe to run any time:
columns = client.tables.list_columns("account", select=["LogicalName", "AttributeType", "SchemaName"])
for col in columns:
print(f"{col['LogicalName']} ({col.get('AttributeType')})")
rels = client.tables.list_table_relationships("account") # 1:N, N:1, and N:N combined
for rel in rels:
print(f"{rel['SchemaName']} -> {rel.get('@odata.type')}")
all_rels = client.tables.list_relationships(select=["SchemaName", "ReferencedEntity", "ReferencingEntity"])
For SQL-queryable column discovery, dataverse-query offers client.query.sql_columns(table).
startswith() is not supported on EntityDefinitions and returns HTTP 400. Query each table
by EntityDefinitions(LogicalName='new_projectbudget')?$select=LogicalName,EntitySetName, or fetch
EntityDefinitions?$select=LogicalName,EntitySetName and filter client-side.
Dataverse spends 3-30 seconds building indexes and propagating caches after metadata changes.
Overlapping operations cause lock contention. Create all tables, wait 15-30 s, create all
alternate keys, wait 15-30 s, then create all lookups. Never interleave operations on the same
table. Retry helper, phase timings, and MCP create_table / update_table notes (supported column
types, timeouts, self-referential lookups):
references/metadata-propagation.md.
| Error code | Meaning | Recovery |
|---|---|---|
0x80040216 | Metadata not yet propagated (transient cache error) | Wait 3-5 s and retry |
0x80048d19 | Payload property does not match any column | Verify logical names via EntityDefinitions(LogicalName='...')/Attributes |
0x80040237 | Schema name already exists | Check whether a timed-out earlier call already created it |
0x8004431a | Publisher prefix mismatch | Use the solution's publisher prefix on all schema names |
0x80060891 | Metadata cache not ready after table creation | GET EntityDefinitions(LogicalName='...') to refresh, then retry |
Other propagation symptoms: lookup @odata.bind fails with "Invalid property", MCP update_table
reports "EntityId not found in MetadataCache", or key/lookup creation reports "another customization
operation is running". Always translate error codes into plain language for the user.
After every metadata session, export, unpack, and commit the solution (see dataverse-solution).
If you relied on the MSCRM.SolutionName header, verify the components landed first:
sol = client.records.list("solution",
filter="uniquename eq '<SOLUTION_NAME>'", select=["solutionid"], top=1).first()
if sol is not None:
components = client.records.list("solutioncomponent",
filter=f"_solutionid_value eq {sol['solutionid']}",
select=["componenttype", "objectid"])
print(f"{len(components)} components in the solution")
| Reference | When to load |
|---|---|
| references/alternate-keys.md | Choosing key columns, idempotent key creation, key status and failures |
| references/forms-and-views.md | Creating or editing forms and views, publishing, classid values, FormXml pitfalls |
| references/metadata-propagation.md | Multi-table schema setup, ensure_table, phased creation, lock-contention retries, MCP table tools |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
/dataverse:dataverse-metadatafrom dataverse
npx claudepluginhub atc-net/atc-agentic-toolkit --plugin dataverse8 skills in this plugin
/dataverse-adminEnvironment-level Microsoft Dataverse administration: bulk delete, retention and archival, organization settings, OrgDB settings, recycle bin, audit, and a hard allowlist of 37 Power Platform admin center toggles. USE FOR: bulk delete records, schedule bulk delete job, cancel or pause bulk delete, data retention policy, archive old records, enable auditing, audit retention, plugin trace log, org settings, pac org update-settings, OrgDB settings, enable MCP server, Dataverse search, TDS endpoint, recycle bin on or off, recycle bin cleanup days, app-level security roles toggle, multi-environment settings rollout. DO NOT USE FOR: record CRUD or sample data (use dataverse-data), tables and columns (use dataverse-metadata), reading records (use dataverse-query), solution export or import (use dataverse-solution), security roles and self-elevate (use dataverse-security).
/dataverse-connectOne-step, idempotent setup and connection diagnostics for a Microsoft Dataverse environment: installs tools, authenticates the Dataverse CLI and PAC CLI, writes `.env`, copies the Python auth helper into the project, registers the Dataverse MCP server, and verifies the connection. USE FOR: connect to Dataverse, set up a new Dataverse project, switch environment, fix Dataverse authentication, dataverse auth create, pac auth create, register Dataverse MCP server, MCP not working, allowlist MCP client, dataverse mcp allow, scripts/auth.py --check, privilege preflight. DO NOT USE FOR: creating tables or columns (use dataverse-metadata), reading or writing records (use dataverse-data), querying data (use dataverse-query), solution export or import (use dataverse-solution), environment settings (use dataverse-admin).
/dataverse-dataRecord-level writes to Microsoft Dataverse tables with the Python SDK, the dataverse CLI, or MCP tools: create, update, delete, upsert with alternate keys, bulk CreateMultiple/UpsertMultiple, CSV import, multi-table foreign-key loads, DataFrame write-back, and schema-driven sample data. USE FOR: create Dataverse record, update record, delete record, upsert, alternate key upsert, bulk import, CSV import, CreateMultiple, UpsertMultiple, @odata.bind lookup, associate records, file column upload, seed data, generate sample data, multi-table import with FK dependencies. DO NOT USE FOR: reading or analyzing records (use dataverse-query), tables, columns, relationships, alternate key definitions, forms, views (use dataverse-metadata), solution export or deployment (use dataverse-solution).
/dataverse-overviewBackground orientation for Microsoft Dataverse work: the dataverse skill map, hard rules, tool-capability matrix (MCP, Python SDK, dataverse CLI, PAC CLI, Azure CLI, GitHub CLI, Web API), SDK method cheat-sheet, and the safe change lifecycle. Load first for any Dataverse task, alongside the matching specialist dataverse-* skill. USE FOR: Dataverse, Dynamics 365, Dynamics 365 Customer Engagement, CRM, Power Platform, Power Apps model-driven apps, choosing between MCP / SDK / CLI / PAC, environment confirmation, solution-first changes, pulling solutions to the repo. DO NOT USE FOR: canvas apps, Power Automate flows, Business Central.
/dataverse-queryReading and analyzing Microsoft Dataverse records with the Python SDK, the dataverse CLI, or MCP tools: filtered reads, paging, lookups and $expand, SQL and FetchXML joins and aggregates, $apply, QueryBuilder, pandas DataFrames, and Jupyter notebook exploration. USE FOR: query Dataverse, read records, list records, filter, count, aggregate, group by, join tables, FetchXML, client.query.sql, $apply, $expand, formatted values, lookup display names, QueryBuilder, export to DataFrame or CSV, analyze data in pandas, Jupyter notebook, paging large tables. DO NOT USE FOR: creating, updating, deleting, or importing records (use dataverse-data), table, column, relationship, form, or view definitions (use dataverse-metadata), solution export or deployment (use dataverse-solution).
/dataverse-securityDataverse access management with PAC CLI: assigning security roles to users and application users, business units, batch role grants across environments, verifying assignments, and tenant admin self-elevation. USE FOR: give someone access, assign security role, grant System Administrator, become admin, application user, service principal access, business unit, pac admin assign-user, pac admin self-elevate, verify role assignment, roles across all environments. DO NOT USE FOR: tables, columns, relationships (use dataverse-metadata), org settings, audit, bulk delete, retention (use dataverse-admin), queries (use dataverse-query), record writes (use dataverse-data), solution deployment (use dataverse-solution).