Receber por email
← Voltar para o catálogo

setup-datamodel

Creates Dataverse tables, columns, and relationships for a Power Pages site based on a data model proposal. Use when the user wants to set up the data model, create database tables, or build the Dataverse schema for their site.

375estrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add microsoft/power-platform-skills

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/setup-datamodel/svg)](https://www.skillteca.com.br/skills/setup-datamodel)

Skills relacionadas

Ver todas de Desenvolvimento →

Alerta por categoria

Receba novas skills de Desenvolvimento toda segunda

1 email curto, só com as skills novas de Desenvolvimento. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa
Plugin check: Run node "${CLAUDE_PLUGIN_ROOT}/scripts/check-version.js" — if it outputs a message, show it to the user before proceeding.

Set Up Dataverse Data Model

Guide the user through creating Dataverse tables, columns, and relationships for their Power Pages site. Follow a systematic approach: verify prerequisites, obtain a data model (via AI analysis or user-provided diagram), review and approve, then create all schema objects via OData API.

Core Principles

  • Never create without approval: Always present the full data model proposal and get explicit user confirmation before making any Dataverse changes.
  • Use TaskCreate/TaskUpdate: Track all progress throughout all phases — create the todo list upfront with all phases before starting any work.
  • Resilient execution: Refresh tokens proactively, check for existing tables before creating, and report failures without automated rollback.

Initial request: $ARGUMENTS

Phase 1: Verify Prerequisites

Goal: Confirm PAC CLI authentication, acquire an Azure CLI token, and verify API access

Actions:

  1. Create todo list with all 8 phases (see [Progress Tracking](#progress-tracking) table)
  2. Follow the prerequisite steps in ${CLAUDE_PLUGIN_ROOT}/references/dataverse-prerequisites.md to verify PAC CLI auth, acquire an Azure CLI token, and confirm API access. Note the environment URL as <envUrl> for subsequent script calls.

Output: Verified PAC CLI auth, valid Azure CLI token, confirmed API access, <envUrl> noted

Phase 2: Choose Data Model Source

Goal: Determine whether the user will upload an existing ER diagram or let AI analyze the site

Actions:

  1. Ask the user how they want to define the data model using the AskUserQuestion tool:

Question: "How would you like to define the data model for your site?"

| Option | Description | |--------|-------------| | Upload an existing ER diagram | Provide an image (PNG/JPG) or Mermaid diagram of your existing data model | | Let the Data Model Architect figure it out | The Data Model Architect will analyze your site's source code and propose a data model automatically |

  1. Route to the appropriate path:

Path A: Upload Existing ER Diagram

If the user chooses to upload an existing diagram:

  1. Ask the user to provide their ER diagram. Supported formats:
  2. Image file (PNG, JPG) — Use the Read tool to view the image and extract tables, columns, relationships, and cardinalities from it
  3. Mermaid syntax — The user can paste Mermaid ER diagram text directly in chat
  4. Text description — A structured list of tables, columns, and relationships
  1. Parse the diagram into the same structured format used by the data-model-architect agent:
  2. Publisher prefix (ask the user, or retrieve from the environment via pac env who)
  3. Table definitions: logicalName, displayName, status (new/modified/reused), columns, relationships
  4. Column definitions: logicalName, displayName, type, required
  5. Relationship definitions: type (1:N or M:N), referenced/referencing tables
  1. Query existing Dataverse tables (same as Phase 3 would) to mark each table as new, modified, or reused.
  1. Generate a Mermaid ER diagram from the parsed data (if the user provided an image or text) for visual confirmation.
  1. Proceed directly to Phase 4: Review Proposal with the parsed data model.

Path B: Let the Data Model Architect Figure It Out

If the user chooses to let the Data Model Architect figure it out, proceed to Phase 3: Invoke Data Model Architect (the existing automated flow).

Output: Data model source chosen and, for Path A, parsed data model ready for review

Phase 3: Invoke Data Model Architect

Goal: Spawn the data-model-architect agent to autonomously analyze the site and propose a data model

Actions:

  1. Use the Task tool to spawn the data-model-architect agent. This agent autonomously:
  2. Analyzes the site's source code to infer data requirements
  3. Queries existing Dataverse tables via OData GET requests
  4. Identifies reuse opportunities (reuse, extend, or create new)
  5. Proposes a complete data model with an ER diagram
  1. Spawn the agent:

``` Task tool: subagent_type: general-purpose prompt: | You are the data-model-architect agent. Follow the instructions in the agent definition file at: ${CLAUDE_PLUGIN_ROOT}/agents/data-model-architect.md

Analyze the current project and Dataverse environment, then propose a complete data model. Return:

  1. Publisher prefix
  2. Table definitions (logicalName, displayName, status, columns, relationships)
  3. Mermaid ER diagram

```

  1. Wait for the agent to return its structured proposal before proceeding.

Output: Structured data model proposal from the agent (publisher prefix, table definitions, ER diagram)

Phase 4: Review Proposal

Goal: Present the data model proposal to the user and get explicit approval before creating anything

Actions:

4.1 Present Proposal

Present the data model proposal directly to the user as a formatted message, including:

  • Publisher prefix
  • All proposed tables with columns (logical names + display names)
  • Relationship descriptions
  • Mermaid ER diagram
  • Which tables are new vs. modified vs. reused

4.2 Get User Approval

Use AskUserQuestion to get approval:

| Question | Header | Options | |----------|--------|---------| | Does this data model look correct? | Data Model Proposal | Approve and create tables (Recommended), Request changes, Cancel |

  • If "Approve and create tables (Recommended)": Proceed to Phase 5
  • If "Request changes": Ask what they want changed, modify the proposal, and re-present for approval
  • If "Cancel": Stop the skill

Only proceed to creation after explicit user approval.

Output: User-approved data model proposal

Phase 5: Pre-Creation Checks

Goal: Refresh the token, verify what already exists in Dataverse, and build the creation plan to avoid duplicates

Actions:

5.1 Refresh Token

Re-acquire the auth token (tokens expire after ~60 minutes):

node "${CLAUDE_PLUGIN_ROOT}/scripts/verify-dataverse-access.js" <envUrl>

5.2 Query Existing Tables

For each table in the approved proposal marked as new, check whether it already exists:

node "${CLAUDE_PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> GET "api/data/v9.2/EntityDefinitions(LogicalName='<table_logical_name>')"
  • If 404: Table does not exist, proceed to create it
  • If 200: Table already exists — skip creation, warn the user

For tables marked as modified, verify the table exists (it should) and check which columns are missing.

5.3 Build Creation Plan

From the pre-creation checks, build a list of:

  • Tables to create (new tables that don't exist yet)
  • Columns to add (new columns on existing/modified tables)
  • Relationships to create
  • Tables/columns to skip (already exist)

Inform the user of any skipped items.

Output: Finalized creation plan with tables, columns, and relationships to create or skip

Phase 6: Create Tables & Columns

Goal: Create each approved table and its columns using the Dataverse OData Web API

Actions:

Refer to references/odata-api-patterns.md for full JSON body templates.

6.1 Create Tables

For each new table, POST to the EntityDefinitions endpoint:

node "${CLAUDE_PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> POST "api/data/v9.2/EntityDefinitions" --body '<JSON body from references/odata-api-patterns.md>'

Use the deep-insert pattern to create the table and its columns in a single POST request. See references/odata-api-patterns.md for the complete JSON structure.

6.2 Add Columns to Existing Tables

For tables marked as modified, add new columns one at a time:

node "${
Compartilhar X LinkedIn