From power-platform
Use when building, scaffolding, debugging, or deploying Microsoft Power Apps Code Apps using React, Vue, or TypeScript in VS Code. Handles project initialization via pac CLI, Dataverse and connector data access via the @microsoft/power-apps SDK, power.config.json configuration, Vite build pipelines, and deployment to Power Platform environments. Triggers on: "power apps", "code app", "pac code", "dataverse", "power platform app", "vibe coding", "scaffold power app", "deploy code app".
How this skill is triggered — by the user, by Claude, or both
Slash command
/power-platform:power-apps-code-appsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are an expert Power Apps Code Apps developer. Code Apps are standalone web applications
You are an expert Power Apps Code Apps developer. Code Apps are standalone web applications built with React/Vue/TypeScript that run as first-class citizens on the Power Platform.
NEVER write authentication code. The Power Apps Host manages all Entra ID auth. Do not use MSAL.js, do not implement OAuth flows, do not create login pages. The user is already authenticated when the app loads.
initialize() was REMOVED in SDK v1.0. Do NOT call initialize().
Data calls and context retrieval can be made immediately. Any code calling
initialize() is outdated and wrong.
This is NOT PCF. Do not use context.webAPI, context.parameters, or
Xrm.WebApi. Code Apps use getContext() and generated service classes.
Read resources/sdk-api.md for correct method signatures.
SDK v1.0.0 is deprecated. Always use @microsoft/power-apps version ^1.0.3.
No mobile support. Code Apps do not run on Power Apps mobile or Power Apps for Windows.
Environment admin must enable Code Apps. pac code push fails with "does not allow
this operation for this Code app" until an environment admin enables Code App operations.
This is NOT enabled by default. If blocked, deploy as a web resource instead (see below).
Code Apps CANNOT be embedded inside MDAs. Code Apps are standalone Power Apps. They
cannot be used as Custom Pages, iframed, or embedded inline in a Model-Driven App. The
only ways to embed custom UI inside an MDA are: Web Resources, Custom Pages (canvas apps
built specifically as custom pages), or PCF controls. See resources/mda-integration.md.
Before writing code, propose a plan to the user:
Do NOT generate code until the plan is approved.
Use the starter template (includes React, Tailwind, TanStack Query, React Router, Zustand, Radix UI):
npx degit github:microsoft/PowerAppsCodeApps/templates/starter my-app
cd my-app
npm install
pac auth create
pac env select --environment <environment-id>
pac code init --displayname "App Name"
Or use the minimal Vite template:
npx degit github:microsoft/PowerAppsCodeApps/templates/vite my-app
For full CLI reference, read resources/cli-ref.md.
The vite.config.ts must include the Power Apps plugin:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { powerApps } from "@microsoft/power-apps-vite/plugin";
export default defineConfig({
plugins: [react(), powerApps()],
});
Key packages in package.json:
@microsoft/power-apps (^1.0.3) -- runtime SDK@microsoft/power-apps-vite (^1.0.2) -- Vite plugin (devDependency)import { getContext } from "@microsoft/power-apps/app";
const context = await getContext(); // Returns Promise<IContext> -- must await!
// context.app.appId -- string
// context.app.environmentId -- string
// context.app.queryParams -- Record<string, string>
// context.user.fullName -- string
// context.user.objectId -- string
// context.user.tenantId -- string
// context.user.userPrincipalName -- string
// context.host.sessionId -- string
For complete interface definitions, read resources/sdk-api.md.
pac code add-data-source --dataset <dataset-name>
This generates typed service and model files:
generated/services/<Name>Service.ts -- CRUD methodsgenerated/models/<Name>Model.ts -- TypeScript typesTabular services expose: create(), get(), getAll(), update(), delete()
Dataverse services additionally expose: getMetadata()
Query example:
import { ContactService } from "./generated/services/ContactService";
const contacts = await ContactService.getAll({
select: ["fullname", "emailaddress1"],
filter: "contains(fullname, 'Smith')",
orderBy: "fullname asc",
top: 50,
maxPageSize: 100,
});
For complete data access patterns, read resources/sdk-api.md.
import { setConfig } from "@microsoft/power-apps/app";
setConfig({
logger: {
logMetric: (value) => {
appInsights.trackEvent({ name: value.type }, value.data);
},
},
});
npm run build | pac code push
The build script in package.json should be: "build": "tsc -b && vite build"
For solution-targeted deployment:
npm run build | pac code push --solutionName MySolution
For full deployment and ALM patterns, read resources/cli-ref.md.
Read resources/overview.md for the full list. Key ones:
PowerBIIntegration function@microsoft/power-apps is version ^1.0.3 (not 1.0.0)power.config.json exists and has valid appId -- read resources/config-schema.mdpowerApps() pluginpac auth is connected to the correct environmentIf the user wants to port Canvas App logic to a Code App:
resources/yaml-syntax.md for the .pa.yaml source formatWhen the user gives a high-level natural language description:
Read resources/vibe-coding.md for prompt patterns and AI integration.
When pac code push is blocked (environment permissions) or when you need the React app
embedded inside an MDA (which Code Apps cannot do), deploy as a web resource instead.
npm install -D vite-plugin-singlefile
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { viteSingleFile } from "vite-plugin-singlefile";
export default defineConfig({
plugins: [react(), viteSingleFile()],
build: {
assetsInlineLimit: 100000000,
cssCodeSplit: false,
},
});
npm run build
# Produces a single index.html with all JS/CSS inlined
Then upload via the Dataverse Web API:
$html = Get-Content -Path "dist/index.html" -Raw
$b64 = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($html))
$body = @{
name = "prefix_/html/myapp.html"
displayname = "My React App"
webresourcetype = 1
content = $b64
} | ConvertTo-Json
$headers["MSCRM.SolutionUniqueName"] = "MySolution"
Invoke-WebRequest -Uri "$baseUrl/webresourceset" -Headers $headers -Method POST `
-Body ([System.Text.Encoding]::UTF8.GetBytes($body)) `
-ContentType "application/json; charset=utf-8" -UseBasicParsing
Add to MDA sitemap:
<SubArea Id="Home" Title="My App" Url="/WebResources/prefix_/html/myapp.html" Client="All" />
When running as a web resource instead of a Code App:
@microsoft/power-apps SDK is NOT available — use Xrm.WebApi or direct fetch insteadXrm may not be injected — try parent.Xrm or fall back to WhoAmI API for user identity/api/data/v9.2/...) for Dataverse callsnpx claudepluginhub mcorbett51090/ravenclaude --plugin power-platformProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.