This skill should be used when the user asks to "add sample data", "populate tables", "seed data", "add test records", "generate sample records", "insert demo data", "fill tables with data", "create test data", or wants to populate their Dataverse tables with sample records so they can test and demo their Power Pages site.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
This skill should be used when the user asks to "add sample data", "populate tables", "seed data", "add test records", "generate sample records", "insert demo data", "fill tables with data", "create test data", or wants to populate their Dataverse tables with sample records so they can test and demo their Power Pages site.
{"Stop":[{"hooks":[{"type":"prompt","prompt":"If sample data was being added in this session (via /power-pages:add-sample-data), verify before allowing stop: 1) Tables were discovered (from .datamodel-manifest.json or OData API), 2) The user selected which tables to populate, 3) All records were inserted via OData API, 4) A verification summary was presented showing record counts per table. If incomplete, return { \"ok\": false, \"reason\": \"<specific issues>\" }. Otherwise return { \"ok\": true }.\n","timeout":30}]}]}
Add Sample Data
Populate Dataverse tables with sample records via OData API so users can test and demo their Power Pages sites.
Core Principles
Respect insertion order: Always insert parent/referenced tables before child/referencing tables so lookup IDs are available when needed.
Use TaskCreate/TaskUpdate: Track all progress throughout all phases -- create the todo list upfront with all phases before starting any work.
Fail gracefully: On insertion failure, log the error and continue with remaining records -- never attempt automated rollback.
Initial request: $ARGUMENTS
Phase 1: Verify Prerequisites
Goal: Confirm PAC CLI auth, acquire an Azure CLI token, and verify API access
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. Store the environment URL as $envUrl.
Output: Authenticated session with valid token and confirmed API access
Phase 2: Discover Tables
Goal: Find the custom tables available in the user's Dataverse environment
Actions:
Path A: Read .datamodel-manifest.json (Preferred)
Check if .datamodel-manifest.json exists in the project root (written by the setup-datamodel skill). If it exists, read it -- it already contains table logical names, display names, and column info.
# Check if manifest exists
Test-Path ".datamodel-manifest.json"
See ${CLAUDE_PLUGIN_ROOT}/references/datamodel-manifest-schema.md for the full manifest schema.
Path B: Query OData API (Fallback)
If no manifest exists, discover custom tables via OData:
Show the user the list of discovered tables with their columns so they can choose which to populate.
Output: List of discovered tables with their columns presented to the user
Phase 3: Select Tables & Configure
Goal: Gather user preferences on which tables to populate and how many records to create
Actions:
3.1 Select Tables
Use AskUserQuestion to ask which tables they want to populate (use multiSelect: true). List all discovered tables as options.
3.2 Select Record Count
Use AskUserQuestion to ask how many sample records per table:
Option
Description
5 records
Quick test -- just enough to verify the setup
10 records
Light demo data for basic testing
25 records
Fuller dataset for realistic demos
Custom
Let the user specify a number
3.3 Determine Insertion Order
Analyze relationships between selected tables. Parent/referenced tables must be inserted first so their IDs are available for child/referencing table lookups.
Build the insertion order:
Tables with no lookup dependencies (parent tables) -- insert first
Tables that reference already-inserted tables -- insert next
Continue until all tables are ordered
Output: Confirmed table selection, record count, and insertion order
Phase 4: Generate & Review Sample Data
Goal: Generate contextually appropriate sample records and get user approval before inserting
Actions:
4.1 Generate Contextual Sample Data
For each selected table, generate sample records with contextually appropriate values based on column names and types:
Use the actual Value integers from the option set in your sample data.
5.3 Insert Parent Tables First
Insert records into parent/referenced tables first to capture their IDs:
$body = @{
cr123_name = "Sample Record"
cr123_description = "A sample record for testing"
} | ConvertTo-Json
$response = Invoke-RestMethod -Method Post -Uri "$envUrl/api/data/v9.2/<EntitySetName>" -Headers $headers -Body $body -ContentType "application/json"
Capture the returned record ID from the OData-EntityId response header or by querying back:
# The ID is in the response headers
# Or query: GET {envUrl}/api/data/v9.2/<EntitySetName>?$filter=cr123_name eq 'Sample Record'&$select=cr123_<table>id
Store parent record IDs for use in child table lookups.
5.4 Insert Child Tables with Lookups
For child/referencing tables, use @odata.bind syntax to set lookup fields:
Read .datamodel-manifest.json or query OData API for custom tables
Select tables and configure
Configuring tables
User picks tables, record count, and determine insertion order
Generate and review sample data
Generating sample data
Generate contextual sample records, present preview, get user approval
Insert sample data
Inserting records
Execute OData POST calls with relationship handling and token refresh
Verify and summarize
Verifying results
Confirm record counts, present summary, suggest next steps
Mark each task in_progress when starting it and completed when done via TaskUpdate. This gives the user visibility into progress and keeps the workflow deterministic.