Plugin check: Run
node "${CLAUDE_PLUGIN_ROOT}/scripts/check-version.js"— if it outputs a message, show it to the user before proceeding.
Backend Integration
Analyze the user's business problem and recommend the right backend integration approach — Web API, Server Logic, Cloud Flows, or a combination — then route to the appropriate skill(s) to implement the solution.
Core Principles
- Understand the problem first: Never jump to a technology choice. Analyze the user's intent, data flow, security needs, and performance requirements before recommending.
- Recommend the simplest approach that works: Web API for straightforward Dataverse CRUD, Server Logic when server-side processing is needed, Cloud Flows for async background work. Don't over-engineer.
- Secure actions belong on the server: When a write depends on a business rule that must be tamper-proof (state transitions, approval workflows, computed values), the server logic must validate AND execute the write — not just validate and leave the write to a client-side Web API call. See the Secure Action Principle in the decision framework.
- Combinations are normal: Many real scenarios need more than one approach. Recommend combinations when justified, but explain why each piece is needed.
- Route, don't implement: This skill recommends and invokes the right skill(s). It does not create backend files itself.
Initial request: $ARGUMENTS
Workflow
- Verify Site Exists — Locate the Power Pages project and check prerequisites
- Understand the Business Problem — Analyze what the user needs and why
- Recommend Integration Approach — Present the recommendation with reasoning
- Route to Skill(s) — Invoke the appropriate backend skill(s) to implement
Phase 1: Verify Site Exists
Goal: Locate the Power Pages project root and confirm prerequisites
Actions:
- Create todo list with all 4 phases (see Progress Tracking table)
1.1 Locate Project
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.
1.2 Explore Current State
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."
1.3 Discover Dataverse Custom Actions
Check whether the user's Dataverse environment has existing custom actions that could be leveraged in the integration:
node "${CLAUDE_PLUGIN_ROOT}/scripts/list-custom-actions.js" "<ENV_URL>"
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
Phase 2: Understand the Business Problem
Goal: Analyze the user's request to understand the underlying business problem, not just the technical ask
Actions:
2.1 Analyze the Request
From the user's request and the existing site state, determine:
- What is the user trying to accomplish? (business outcome, not technology)
- What data is involved? (Dataverse tables, external systems, user input)
- Who triggers the operation? (user action, form submit, page load, scheduled)
- Does the user need an immediate response? (real-time UI update vs. background processing)
- Are external services involved? (payment gateways, email, Graph, SharePoint, third-party APIs)
- Are credentials or secrets involved? (API keys, client secrets, tokens)
- Must logic be hidden from the browser? (pricing rules, validation algorithms, business rules)
- Is this a simple data operation or complex business logic? (CRUD vs. multi-step processing)
- Does any write depend on a business rule that must be tamper-proof? (state transitions, approval conditions, computed values) — if yes, the server logic must validate AND execute the write, not just validate
- Can existing Dataverse custom actions handle part of the requirement? If custom actions were discovered in Phase 1.3, check whether any align with the user's needs — server logic can wrap existing custom actions via
InvokeCustomApiinstead of building equivalent logic from scratch
2.2 Clarify if Ambiguous
If 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
Phase 3: Recommend Integration Approach
Goal: Present a recommendation with clear reasoning
Actions:
3.1 Apply the Decision Framework
Reference:
${CLAUDE_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 Server Logic? If any of these apply, Server Logic is needed:
- External API calls (HttpClient)
- Credentials/secrets must stay on the server
- Business logic must be hidden from the browser
- Multiple Dataverse queries should be batched into one endpoint
- Server-side validation that can't be bypassed
- Wrapping a Dataverse Custom API/Action for portal consumption — if custom actions were found in Phase 1.3, check whether any match the requirement before recommending building from scratch
- The write depends on a business rule that must be tamper-proof (state transitions, approval conditions, computed values) — server logic must validate AND execute the write
-
Does it need Cloud Flows? If any of these apply, Cloud Flows are the right fit:
- The operation is async — the user doesn't need an immediate result
- Background processing: sending emails, notifications, processing orders
- Multi-step workflows across systems with Power Automate connectors
- Long-running processes that exceed the 120-second server logic timeout
- Non-developers should be able to modify the workflow
-
Does it need a combination? Common combinations:
- Web API + Cloud Flow: UI reads/writes non-sensitive Dataverse fields, some actions trigger background flows
- Server Logic + Cloud Flow: Real-time endpoint validates and executes the action, async flow does follow-up (e.g., server log