Skip to content

Commit c5ce267

Browse files
sparrow1303claude
andcommitted
[Pages] SDM-to-EDM: augmented prompts for plugin + DME remediation
The skill should not modify customer-owned code directly. Plugins live in the customer's plugin source repo, and Dataverse schema changes should go through a reviewable solution package — not direct API calls. For both, the script now generates paste-ready augmented prompts that the user takes to a fresh Claude Code session, which then does the work and surfaces a diff or artifact for review before applying. Plugin remediation prompt: - Static template at scripts/prompts/plugin-remediation.template.txt with a {{PLUGIN_FINDINGS_BLOCK}} placeholder - Filled at runtime with the customer's actual plugin findings (name, target entity, step name) — categorized as Microsoft (no action) / Adxstudio (verify V2) / custom (refactor) - Instructs the receiving session to locate plugin source, refactor entity references to powerpagecomponent + inject powerpagecomponenttype filter on queries, preserve adx_* attribute references (still valid logical names on EDM), update step registration metadata, and show a diff before saving - Explicit constraints: no production push, no guessing file locations, no rewriting GetAttributeValue<T>('adx_name') calls DME remediation prompt (solution-package approach): - Static template at scripts/prompts/dme-remediation.template.txt with a {{DME_TABLE_GROUPS_BLOCK}} placeholder - Filled with per-table groupings already produced by buildDataModelExtensionChecklists() - Instructs the receiving session to ask for a publisher prefix, build a Dataverse solution package with new custom tables and lookups to powerpagecomponent, and produce a .zip ready for pac solution import - Documents the data-migration step (Power Automate flow OR C# console app with batched ExecuteMultipleRequest) — outside solution scope, user runs separately - Explicit constraints: no direct Dataverse API calls, all schema decisions reviewed before pack, default to Unmanaged solutions, ask before using existing publishers Surfacing to user (three places): - Standalone .txt files in <OUTPUT_DIR>/ (plugin-remediation-prompt.txt and dme-remediation-prompt.txt) so offline users can access - Embedded in skill-execution-report.html under collapsible <details> blocks with copy-to-clipboard buttons (self-contained navigator.clipboard.writeText — no external JS) - Terminal banner at end of script run with file paths and copy-paste instructions Bug fix in categorizePlugin(): - Old regex (Step name\s*:\s*([^\n]*?)(?:\s\s+Entity Name|$)) mis-handled the empty-step case (e.g., Microsoft.Crm.* plugins with no step name), greedily capturing 'Entity Name : <entity>' as the step - Replaced with split-by-2+-whitespace parser + per-field label matching, which correctly returns null for empty fields SKILL.md step 2.2 section 7: - Replaced the generic 'user must, in the Data workspace...' manual remediation with paste-ready augmented-prompt callouts pointing to the .txt files and explaining how to use each DESIGN.md additions: - New 'Augmented Prompts for Customer-Owned Code' section documenting the design rationale (why prompts beat direct execution), template storage (scripts/prompts/), runtime substitution, three surfacing locations, and coverage table (plugin/DME yes; custom workflows still doc-text-only until per-workflow Dataverse queries are added) Sample reports regenerated against comprehensive-sample.csv (51 findings) to demonstrate the new augmented-prompt sections end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4877781 commit c5ce267

7 files changed

Lines changed: 994 additions & 69 deletions

File tree

plugins/power-pages/skills/migrate-sdm-to-edm/DESIGN.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,64 @@ The skill executes local-only analysis (no Dataverse API) for every customizatio
246246
- **`categorizePlugin(snippet)`** — name-prefix match on `Microsoft.*` / `Adxstudio.*` / custom; emits per-finding action including original entity and step name.
247247
- **`buildDataModelExtensionChecklists(items)`** — groups column findings by source `adx_*` table; produces one checklist per source table with suggested new-table name and step-by-step guidance from the migration doc.
248248

249-
Output is rendered in `skill-execution-report.html` under the "Liquid Findings — Categorized", "Plugin Findings — Categorized", "Auto-applied Rewrites", and "Data Model Extensions — Per-table Remediation Checklists" sections.
249+
Output is rendered in `skill-execution-report.html` under the "Liquid Findings — Categorized", "Plugin Findings — Categorized", "Auto-applied Rewrites", "Data Model Extensions — Per-table Remediation Checklists", and the augmented-prompts sections.
250250

251251
See `assets/skill-execution-report.html` for the rendered remediation guidance shown to users.
252252

253253
---
254254

255+
## Augmented Prompts for Customer-Owned Code
256+
257+
Two customization categories — **custom plugins** and **Data Model Extensions** — involve modifying code or schema that the skill does NOT own:
258+
259+
- **Plugins** live in the customer's plugin source repo (often a separate code repository)
260+
- **DME (custom columns on adx_* tables)** require Dataverse schema changes that should land via a reviewable solution package, not direct API calls
261+
262+
For both, the skill follows a **paste-ready augmented-prompt** pattern:
263+
264+
1. The script generates a complete, self-contained prompt tailored to the user's actual findings
265+
2. The prompt is written to a `.txt` file in `<OUTPUT_DIR>/` and embedded in `skill-execution-report.html`
266+
3. The user opens a fresh Claude Code session pointed at the relevant working directory (their plugin repo for plugins; any working dir for DME)
267+
4. The user pastes the prompt as the first message
268+
5. The receiving session performs the work — refactoring plugin code OR building a Dataverse solution package — and surfaces a diff or artifact for the user to review before applying
269+
270+
### Why this design
271+
272+
| Concern | Direct execution from this skill | Augmented prompt approach |
273+
| --- | --- | --- |
274+
| Customer-owned plugin source | Skill would need access to the plugin repo — not available | User runs the prompt where the repo is — clean separation |
275+
| Dataverse schema changes | Direct API calls are hard to undo, hard to review, bypass ALM | Solution package is a reviewable artifact; user imports it themselves |
276+
| Decision-making (publisher prefix, column types, on-delete behavior) | Lots of interactive prompts in our skill | Batched in the receiving session |
277+
| Source control | Changes hit Dataverse / customer repo invisibly | All artifacts version-controllable as files |
278+
279+
### Template storage
280+
281+
Prompt templates live as static text files under `scripts/prompts/`:
282+
283+
- `plugin-remediation.template.txt` — placeholder: `{{PLUGIN_FINDINGS_BLOCK}}`
284+
- `dme-remediation.template.txt` — placeholder: `{{DME_TABLE_GROUPS_BLOCK}}`
285+
286+
The script's `loadPromptTemplate()` reads the file and substitutes the placeholder with the actual findings (markdown-formatted tables / groupings) before writing to `<OUTPUT_DIR>/plugin-remediation-prompt.txt` and `<OUTPUT_DIR>/dme-remediation-prompt.txt`.
287+
288+
### Surfacing to the user
289+
290+
All three locations cover different user contexts:
291+
292+
1. **Terminal output** at the end of script run — visual separator banner with file paths and copy-paste instructions
293+
2. **Standalone `.txt` files** in `<OUTPUT_DIR>/` — for users who want the prompts without keeping the HTML open
294+
3. **HTML execution report** — embedded inside collapsible `<details>` blocks with copy-to-clipboard buttons (uses `navigator.clipboard.writeText` — self-contained, no external JS)
295+
296+
### What's covered today
297+
298+
| Category | Prompt? | Notes |
299+
| --- | --- | --- |
300+
| Custom plugins | ✅ Yes | Refactor pattern, build/test/deploy guidance, no production push |
301+
| Data Model Extensions | ✅ Yes | Solution-package output; data-migration step documented but not packaged |
302+
| Custom-to-adx relationships | ✅ (within DME prompt) | Receiving session can add relationships to the same solution |
303+
| Custom workflows | ❌ No (yet) | Would require per-workflow Dataverse queries to be useful; generic doc guidance in HTML report for now |
304+
305+
---
306+
255307
## Component Type Reference Table
256308

257309
For FetchXML and Liquid rewrites, map `adx_*` entity → `powerpagecomponenttype` value:

plugins/power-pages/skills/migrate-sdm-to-edm/SKILL.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -604,19 +604,29 @@ This pushes the rewritten source files back to the SDM site's Dataverse records,
604604

605605
### 7. Manual remediation reminders (for non-automatable categories)
606606

607-
Show user the following before proceeding to step 3.1:
607+
Two customization categories are NOT modified directly by this skill — instead the script generates **paste-ready augmented prompts** that the user takes to a fresh Claude Code session. This is intentional: customer-owned plugin source and Dataverse schema changes should be reviewed and approved before execution.
608608

609-
**Data Model Extensions**for each custom column found on `adx_*` tables, the user must, in the Data workspace:
609+
**Plugins on `adx_*` tables**augmented prompt at `<OUTPUT_DIR>/plugin-remediation-prompt.txt` (and embedded in `skill-execution-report.html`). The prompt:
610610

611-
1. Create a new custom table (e.g., `contoso_webpage`)
612-
2. Add the custom column (e.g., `contoso_pagetype`) to the new table
613-
3. Add a lookup column on the new table pointing to `powerpagecomponent`
614-
4. Migrate data from the old column to the new table
615-
5. Update any Liquid/FetchXML to reference the new table
611+
- Includes the verbatim plugin findings from the report (name, target entity, step name)
612+
- Categorizes each as Microsoft / Adxstudio / custom and includes the refactor pattern only for custom plugins
613+
- Instructs the receiving Claude session to locate plugin source, refactor to target `powerpagecomponent`, generate a diff for review, get user approval, and only then build
614+
- Explicit guardrails: no production push, no guessing at file locations, no rewriting `adx_*` attribute references
616615

617-
**Custom-to-adx relationships** — create a new relationship between the custom table and `powerpagecomponent` (e.g., `powerpagecomponent_contoso_pagelogs`).
616+
To use: tell the user to open a new Claude Code session in their plugin source repo (`claude` command) and paste the contents of the prompt file as the first message.
618617

619-
**Plugins/Workflows on `adx_*` tables** — refactor code to target `powerpagecomponent`, update attribute references, re-register on the new table.
618+
**Data Model Extensions** — augmented prompt at `<OUTPUT_DIR>/dme-remediation-prompt.txt`. The prompt:
619+
620+
- Includes the per-table groupings from the customization report
621+
- Instructs the receiving Claude session to ask for a publisher prefix, build a Dataverse **solution package** containing new custom tables, columns, and lookups to `powerpagecomponent`
622+
- Documents the import + data-migration steps the user runs separately
623+
- Explicit guardrails: NO direct Dataverse API calls, user must approve schema before pack
624+
625+
To use: tell the user to open a new Claude Code session in any working directory (`claude` command) and paste the contents of the prompt file as the first message. The session produces a reviewable `.zip` for `pac solution import`.
626+
627+
**Custom-to-adx relationships** — currently bundled into the DME prompt. The receiving session can be asked to add the relationship to the same solution package.
628+
629+
**Custom workflows** — no augmented prompt today (would need Dataverse queries to fetch per-workflow primary-entity info). For now, generic guidance shown in the execution report: refactor the workflow to target `powerpagecomponent` and re-register.
620630

621631
Reference: <https://learn.microsoft.com/en-us/power-pages/admin/migrate-enhanced-data-model#considerations-for-site-customization-when-migrating-sites-from-standard-to-enhanced-data-model>
622632

0 commit comments

Comments
 (0)