setup-datamodel
This Claude Code skill guides users through creating Dataverse tables, columns, and relationships for Power Pages sites. It systematically verifies prerequisites, obtains a data model through either user-provided diagrams or AI analysis, presents proposals for explicit approval, then creates schema objects via OData API while tracking progress and handling failures without automated rollback.
git clone --depth 1 https://github.com/microsoft/power-platform-skills /tmp/setup-datamodel && cp -r /tmp/setup-datamodel/plugins/mobile-apps/skills/setup-datamodel ~/.claude/skills/setup-datamodelSKILL.md
**📋 Shared instructions: [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md)** — read first.
# Set Up Data Model + Connectors
Combined orchestrator for standalone data source planning. Designs the Dataverse schema, plans connectors, gets approval on both, then delegates execution to `/add-dataverse` and `/add-connector`.
| Use this skill when | Use `/add-dataverse` directly when |
|---|---|
| Standalone schema + connector design (project may or may not exist yet) | The plan already exists and you just need to apply tables + generate services |
| You have an existing ER diagram (image / Mermaid / text) to import | `/create-mobile-app` is invoking this as a sub-step with `--skip-planning` |
| Re-planning the schema or connectors mid-project | You only need to add a single table or a single connector |
## Workflow
1. Verify project & auth → 2. Design data model → 3. Plan connectors → 4. Combined approval → 5. Execute data model → 6. Execute connectors → 7. Summary
---
### Phase 1 — Verify Project & Auth
Confirm we're inside a Power Apps mobile app:
```bash
test -f power.config.json && echo "OK" || echo "ERROR: not a mobile app — run /create-mobile-app first"
node "${PLUGIN_ROOT}/scripts/resolve-environment.js" "$(node -e \"console.log(require('./power.config.json').environmentId)\")"
```
Capture the **environment URL**, **environment ID**, **tenant ID**, and **organization ID** for Phase 5.
### Phase 2 — Design Data Model
Check `$ARGUMENTS` for diagram hints first (`*.png`, `*.jpg`, `erDiagram` keyword, `||--o{` cardinality syntax). If a hint is present → Path A. If `$ARGUMENTS` describes the app at all → silently take Path B (architect propose). Only if both are empty, ask:
> "How would you like to define the data model?"
| Option | What happens |
|---|---|
| Upload an existing ER diagram | Provide a PNG/JPG path, Mermaid block, or text description |
| Let the Data Model Architect propose one (default) | Spawns `data-model-architect` agent to infer from requirements |
| Skip — no Dataverse tables needed | Jump to Phase 3 |
Default the answer to "architect propose" so an empty answer auto-proceeds without blocking the user.
#### Artifact storage rules for PDFs and signatures
When requirements mention signatures, sign-off, ink, drawings, generated PDFs, exported reports, evidence packets, or retained documents, make the storage target explicit in `## Data Model` before approval:
| User signal | Dataverse model implication |
|---|---|
| "capture signature", "sign off", "approval signature", "ink" | Image column on the signed record for one current signature, or child Evidence/Signature table for multiple captures/history |
| "generate PDF", "export report", "evidence packet", "certificate PDF" | Ask whether the generated PDF should be retained. If yes, use a Dataverse File column, usually on the parent record or a child Evidence/Attachment table. If no, document on-device/share-only behavior and add no column. |
| "upload PDF", "attach file", "import document" | File column or child Attachment table with lookup to parent |
| "view PDF" | Store or reference an HTTPS URL if the app has a durable source. Native PDF viewer 0.2.9+ also supports local `file://` URIs; `content://`, `blob:`, and `http://` remain unsupported. |
PDF content must never be modeled as long text/base64 text. Use Dataverse File columns for retained PDFs. Signature PNGs may use Image columns when the generated service supports image payloads; use File columns or child Evidence rows when the capture should behave like an attachment.
#### Path A — Parse user-provided diagram
Accept PNG/JPG (use `Read` to view), Mermaid syntax (paste in chat), or text description. Parse into tables + columns + relationships. Query existing Dataverse tables to mark each as new / extend / reuse. Generate a Mermaid ER diagram for confirmation. Enter `EnterPlanMode` for data model approval. On `ExitPlanMode` approval, write the data model into `native-app-plan.md` `## Data Model` section (creating the file if absent).
#### Path B — Spawn data-model-architect
```
Task: mobile-app:data-model-architect
Prompt:
You are the data-model-architect agent for a Power Apps mobile app.
Requirements: <$ARGUMENTS or ask the user what the app does>
Working directory: <cwd>
Plugin root: ${PLUGIN_ROOT}
Follow your agent file. Return a ## Data Model section with Mermaid ER diagram,
reuse/extend/create table, and dependency-tier ordering. If requirements mention
signatures, pen/ink, generated PDFs, report exports, evidence packets, or uploaded
documents, include the artifact storage target: on-device/share-only, Dataverse
Image column, Dataverse File column, or child Evidence/Attachment table. Retained
PDF content must use a File column, not long text/base64.
```
Present the returned section via `EnterPlanMode` / `ExitPlanMode` for approval.
#### Path C — No Dataverse
Write `## Data Model` as "None — no Dataverse tables needed." Continue to Phase 3.
### Phase 3 — Plan Connectors
Follow [`shared/references/connector-planning.md`](${PLUGIN_ROOT}/shared/references/connector-planning.md):
1. **Infer** — if `$ARGUMENTS` describes what the app does, scan for connector keywords. Build a candidate list.
2. **Confirm** — present via `AskUserQuestion`. Let the user add, remove, or confirm.
3. **Record** — build the `## Connectors` section.
If the user provided no requirements context, ask:
> "What does your app need to connect to? (e.g. SharePoint, Teams, email, Excel, OneDrive, Azure DevOps — or none)"
### Phase 4 — Combined Approval
Present the full plan — data model + connectors — together in a single `EnterPlanMode` block:
```
## Plan: Data Sources
### Data Model
[reuse/extend/create table]
[Mermaid ER diagram]
[creation order tiers]
### Connectors
[connector table or "None"]
Approve both to proceed with execution?
```
- **Approved** → proceed to Phase 5
- **Change data model** → loop back toGuide the user to add a data source, connection, or API connector to a Canvas App via Power Apps Studio, then verify and continue. USE WHEN the user asks to add a data source, add a connection, add an API, add a connector, connect to SharePoint / Dataverse / SQL / Excel / OneDrive / Teams / Office 365, or any similar request to make new data available to the app. DO NOT USE WHEN the user is asking to list or describe existing data sources — call list_data_sources or list_apis directly instead.
Creates or edits a Power Apps Canvas App through the Canvas Authoring MCP coauthoring session. Handles new app generation, direct targeted edits, complex multi-screen changes, responsive layout, per-screen self-QA, and compile-error convergence. Trigger on requests to create, build, generate, modify, update, change, fix, or edit a Canvas App or .pa.yaml files.
Configure the Canvas Authoring MCP server for the current coauthoring session. USE WHEN "configure MCP", "set up MCP server", "MCP not working", "connect Canvas Apps MCP", "canvas-authoring not available", "MCP not configured", "set up canvas apps".
[DEPRECATED — use canvas-app instead] Generate a complete Power Apps canvas app.
>
Adds Azure DevOps connector to a Power Apps code app. Use when querying work items, creating bugs, managing pipelines, or making ADO API calls.
Use when adding a Power Platform connector to an Expo/React Native Power Apps mobile app and no dedicated mobile connector skill exists.
Use when adding an unspecified data source to an Expo/React Native Power Apps mobile app; routes to Dataverse, SharePoint, or another connector.