npx skills add ...
npx skills add microsoft/power-platform-skills --skill integrate-backend
Analyzes the user's business problem and recommends the right backend integration approach — Web API, AI Web API (generative summaries / grounded search), Server Logic, Cloud Flows, or a combination — for a Power Pages site, then routes to the appropriate specialized skill. Use when the user wants to add backend integration, connect to data, add AI summaries, or needs help deciding which backend approach to use.
npx skills add microsoft/power-platform-skills --skill integrate-backend
Plugin check: Run
node "${PLUGIN_ROOT}/scripts/check-version.js"— if it outputs a message, show it to the user before proceeding.
Analyze the user's business problem and recommend the right backend integration approach — Web API, AI Web API, Server Logic, Cloud Flows, or a combination — then route to the appropriate skill(s) to implement the solution.
_api layer as regular Web API, so they inherit the same table permissions, column permissions, and Webapi/<table>/* site settings. When a plan has both a Web API item and an AI Web API item for the same table, the AI item depends on (and goes in a later phase than) the Web API item. Search Summary has no per-table prereqs and can stand alone.Initial request: $ARGUMENTS
Goal: Locate the Power Pages project root and confirm prerequisites
Actions:
Look for powerpages.config.json in the current directory or immediate subdirectories.
If not found: Tell the user to create a site first with /create-site.
Use the Explore agent to quickly scan the site for existing backend integrations:
"Analyze this Power Pages code site for existing backend integrations:
- Check
.powerpages-site/server-logic/— list any existing server logic endpoints- Check
.powerpages-site/cloud-flow-consumer/— list any registered cloud flows- Search frontend code (
src/**/*.{ts,tsx,js,jsx,vue,astro}) for calls to/_api/(Web API) and/_api/serverlogics/(Server Logic) and/_api/cloudflow/(Cloud Flows)- Check for existing service layers or API utilities in
src/services/,src/shared/, or similar- List available web roles from
.powerpages-site/web-roles/*.webrole.ymlReport what backend integrations already exist so we can build on them."
Check whether the user's Dataverse environment has existing custom actions that could be leveraged in the integration:
The script returns Custom APIs (modern) and Custom Process Actions (legacy) with their names, descriptions, binding types, and parameters. If custom actions are found, note them — they will be factored into the recommendation in Phase 3.
Output: Project root confirmed, existing backend integrations identified, Dataverse custom actions discovered
Goal: Analyze the user's request to understand the underlying business problem, not just the technical ask
Actions:
From the user's request and the existing site state, determine:
InvokeCustomApi instead of building equivalent logic from scratchIf the request could map to multiple approaches and the right choice isn't clear, use AskUserQuestion to clarify:
| Question | When to ask |
|---|---|
| Does the user need to see the result immediately, or can it happen in the background? | When the request involves processing that could be sync or async |
| Are external APIs or services involved (e.g., Stripe, SendGrid, SharePoint)? | When the request mentions "integration" without specifics |
| Does this involve sensitive credentials that shouldn't be in the browser? | When external service integration is mentioned |
| Is this a one-time action or a multi-step workflow? | When the request could be a simple call or an orchestration |
Output: Clear understanding of the business problem and technical requirements
Goal: Present a recommendation with clear reasoning
Actions:
Reference:
${PLUGIN_ROOT}/skills/integrate-backend/references/decision-framework.md
Use the decision matrix, intent mapping, and Secure Action Principle from the reference to determine the right approach. Consider:
Can Web API alone handle this? If it's straightforward Dataverse CRUD with no external calls, no secrets, no server-side logic, and no business rules governing the write — recommend Web API. It's the simplest option.
Does it need AI Web API? If any of these apply, AI Web API is the right fit:
AI Web API is read-only — the Secure Action Principle does not apply. If an AI item covers a Dataverse table that is also covered by a Web API item, put the AI item in a later phase (it depends on the Web API Layer 1/2 prereqs being in place). Search Summary items have no per-table prereqs and can stand alone.
Does it need Server Logic? If any of these apply, Server Logic is needed:
Does it need Cloud Flows? If any of these apply, Cloud Flows are the right fit:
Does it need a combination? Common combinations:
Before finalizing the plan, review every item assigned to Web API and ask: "If a user skipped any preceding server logic validation and called this Web API endpoint directly, could they violate a business rule?"
If the answer is yes, that write does not belong in a Web API item. Move the write into the server logic item that validates it. The server logic should validate AND execute the write using Server.Connector.Dataverse.
Common patterns that must use validate-and-execute server logic (not Web API):
| Pattern | Why it must be server-side |
|---|---|
| Status/state transitions (Draft → Submitted → Approved) | Client could jump to any status by sending a direct PATCH |
| Conditional writes (only allowed before a deadline, only for certain roles) | Client could write after deadline or from wrong role context |
| Computed field writes (server calculates a score, price, or derived value) | Client could submit any value if it writes the field directly |
| Multi-table atomic operations (award bid + reject others + update event) | Partial execution from client could leave data inconsistent |
| Writes that depend on the current state of other records | Client's stale view of data could lead to invalid writes |
Correct plan structure for state transitions:
Incorrect plan structure (anti-pattern):
Build the plan data and render an HTML plan before asking for approval. The plan visualizes:
Prepare a JSON object with these keys:
| Key | Description |
|---|---|
SITE_NAME | Site name from powerpages.config.json |
PLAN_TITLE | Short title (e.g., "Backend Integration Plan") |
SUMMARY | 1-3 sentence summary of the integration strategy |
ITEMS_DATA | Array of integration items (see format below) |
DATA_FLOWS_DATA | Array of data flow diagrams (see format below) |
RATIONALE_DATA | Array of design rationale entries (icon, title, desc) |
ITEMS_DATA format:
Phase assignment rules — assign a phase number to each item based on dependencies:
Webapi/<table>/* site settings). Search Summary items have no per-table prereqs and can go in any phase.DATA_FLOWS_DATA format (each step's approach is one of webapi, aiwebapi, serverlogic, cloudflow):
Important: In data flow diagrams, when a server logic step validates a business rule, the next step should NOT be a Web API write for the same field. The server logic step should validate AND execute. For example:
Write the plan to <PROJECT_ROOT>/docs/backend-plan.html (create docs/ if needed). Use the render script:
The render script refuses to overwrite existing files. If the default path exists, choose a new descriptive filename (e.g., backend-plan-payments.html).
After rendering, open the HTML plan in the user's default browser:
Do not restate the full plan in the CLI. The HTML file is the single detailed plan artifact.
In the CLI, give only a brief summary:
🚦 Gate (plan · integrate-backend:3.4.plan-approval): Approve the integration plan before invoking the appropriate child skill (
integrate-webapi/add-server-logic/add-cloud-flow). The plan HTML stays on disk regardless of choice — Cancel just stops the dispatch.Trigger: Phase 3.3 has rendered the HTML plan and surfaced a brief CLI summary. Why we ask: Wrong child skill gets dispatched —
add-server-logicfor a Web API task wastes minutes;add-cloud-flowfor a Web API task creates orphaned flow YAML. Cancel leaves: Nothing — no child skill invoked, HTML plan stays at its saved path.
Use AskUserQuestion:
| Question | Options |
|---|---|
| Here's the integration plan. The HTML plan is open in your browser with data flow diagrams and per-item reasoning. Does this approach look right? | Yes, proceed (Recommended), Change approach, Cancel |
If "Change approach": Ask what they'd prefer and why, update the plan, and present again.
If "Cancel": Stop the workflow.
Output: User-approved integration approach
Goal: Invoke the appropriate skill(s) to implement the approved approach, respecting phase ordering and building in parallel within each phase
Actions:
Group the approved items by their phase number from the plan. Each phase is a batch of independent items — items within a phase have no dependencies on each other and can be built in parallel.
| Approach | Skill to invoke | What to pass |
|---|---|---|
| Web API | /integrate-webapi | The user's request + tables for this phase + existing patterns |
| AI Web API | /add-ai-webapi | The user's request + target pages/tables for this phase + which of the two APIs to use (Search Summary or Data Summarization) + any trigger preferences (auto-on-mount vs manual button for list summaries). If Web API prereqs for the target table were set up in an earlier phase, mention that so the AI skill skips its Layer 1/2 delegation. |
| Server Logic | /add-server-logic | The user's request + endpoints for this phase + SDK features needed + secrets identified + any matching Dataverse custom actions from Phase 1.3 |
| Cloud Flow | /add-cloud-flow | The user's request + async operations for this phase |
Process phases in order (Phase 1, then Phase 2, etc.). Complete all items in a phase before moving to the next — later phases depend on earlier phases.
Within each phase, maximize parallelism:
Example — a plan with 4 phases:
| Phase | Items | Skill(s) | Parallelism |
|---|---|---|---|
| 1 | Validate Transition (serverlogic), Dashboard Metrics (serverlogic) | /add-server-logic | Both items passed together — skill builds them in parallel |
| 2 | Supplier Updates (webapi), Bid CRUD (webapi), PR Creation (webapi) | /integrate-webapi | All 3 items passed together — skill builds them in parallel |
| 3 | Award Bid (serverlogic) | /add-server-logic | Single item — sequential |
| 4 | Approval Notification (cloudflow), Expiry Alerts (cloudflow) | /add-cloud-flow | Both items passed together — skill builds them in parallel |
When invoking each skill, include:
After all phases complete, present a brief summary of everything that was created:
| Phase | Approach | What was created |
|---|---|---|
| 1 | Server Logic | [endpoints created, SDK features used] |
| 2 | Web API | [files created, tables integrated] |
| 3 | Server Logic | [endpoints created] |
| 4 | Cloud Flow | [flows registered, triggers wired] |
Remind the user to deploy with /deploy-site if they haven't already.
Reference:
${PLUGIN_ROOT}/references/skill-tracking-reference.md
Follow the skill tracking instructions in the reference to record this skill's usage. Use --skillName "IntegrateBackend".
Output: All recommended backend integrations implemented
If the user's request clearly and unambiguously maps to a single approach, skip this skill and go directly to the implementation skill:
/add-server-logic/integrate-webapi/add-cloud-flow/add-ai-webapiThis skill is for ambiguous requests where the user describes a business problem and needs help choosing the right approach.
Example 1: Simple Dataverse CRUD → Web API
Example 2: External API with credentials → Server Logic
Example 3: Background email → Cloud Flow
Example 4: Server-side validation → Server Logic (validate-and-execute)
Example 5: Dashboard performance → Server Logic
Example 6: CRUD + background processing → Web API + Cloud Flow
Example 7: Validate + process + notify → Server Logic + Cloud Flow
Example 8: State transitions + CRUD → Server Logic (validate-and-execute) + Web API
Example 9: AI summary on detail page → AI Web API (Data Summarization, support-case recipe)
Example 10: Related KB articles on detail page → AI Web API (search summary)
Example 11: List summary + browsable records → Web API + AI Web API
Before starting Phase 1, create a task list with all phases using TaskCreate:
| Task subject | activeForm | Description |
|---|---|---|
| Verify site exists | Verifying site prerequisites | Locate project root, scan for existing backend integrations |
| Understand business problem | Analyzing requirements | Determine what the user needs, clarify ambiguities |
| Recommend integration approach | Evaluating approaches | Apply decision framework, present recommendation |
| Route to implementation skill(s) | Implementing backend integration | Invoke the approved skill(s) and summarize results |
Mark each task in_progress when starting and completed when done via TaskUpdate.
Begin with Phase 1: Verify Site Exists