Logo Power Apps Code Apps

Power Apps Code Apps

Cộng đồng
DanielKerridge
power-apps-code-apps

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".

Tổng quan

Nhà phát hànhDanielKerridge
Kho mãclaude-code-power-platform-skills
Tên kỹ năngpower-apps-code-apps
Sao
63
Bản fork
16
Tệp đi kèm
8
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 8 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được DanielKerridge công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Power Apps Code Apps trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/DanielKerridge/claude-code-power-platform-skills/tree/master/power-apps-code-apps
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/DanielKerridge/claude-code-power-platform-skills.git /tmp/claude-code-power-platform-skills
mkdir -p .claude/skills
cp -r /tmp/claude-code-power-platform-skills/power-apps-code-apps .claude/skills/power-apps-code-apps
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Power Apps Code Apps trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Power Apps Code Apps ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Power Apps Code Apps không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Power Apps Code Apps Developer Skill

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.

CRITICAL RULES -- Read These First

  1. 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.

  2. 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.

  3. 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.

  4. SDK v1.0.0 is deprecated. Always use @microsoft/power-apps version ^1.0.3.

  5. No mobile support. Code Apps do not run on Power Apps mobile or Power Apps for Windows.

  6. 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).

  7. 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.

Workflow: Building a New Code App

Step 1 -- Plan (Act as Plan Designer)

Before writing code, propose a plan to the user:

  • User personas -- Who uses this app?
  • Data entities -- What Dataverse tables or connectors are needed?
  • Key screens/flows -- What does the user navigate through?
  • Components -- What reusable UI components are needed?

Do NOT generate code until the plan is approved.

Step 2 -- Scaffold

Use the starter template (includes React, Tailwind, TanStack Query, React Router, Zustand, Radix UI):

bash
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:

bash
npx degit github:microsoft/PowerAppsCodeApps/templates/vite my-app

For full CLI reference, read resources/cli-ref.md.

Step 3 -- Configure Vite

The vite.config.ts must include the Power Apps plugin:

typescript
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)

Step 4 -- Access Context

typescript
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.

Step 5 -- Add Data Sources

bash
pac code add-data-source --dataset <dataset-name>

This generates typed service and model files:

  • generated/services/<Name>Service.ts -- CRUD methods
  • generated/models/<Name>Model.ts -- TypeScript types

Tabular services expose: create(), get(), getAll(), update(), delete() Dataverse services additionally expose: getMetadata()

Query example:

typescript
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.

Step 6 -- Configure Telemetry (Optional)

typescript
import { setConfig } from "@microsoft/power-apps/app";

setConfig({
  logger: {
    logMetric: (value) => {
      appInsights.trackEvent({ name: value.type }, value.data);
    },
  },
});

Step 7 -- Build and Deploy

bash
npm run build | pac code push

The build script in package.json should be: "build": "tsc -b && vite build"

For solution-targeted deployment:

bash
npm run build | pac code push --solutionName MySolution

For full deployment and ALM patterns, read resources/cli-ref.md.

Known Limitations

Read resources/overview.md for the full list. Key ones:

  • No mobile (Power Apps mobile / Windows app)
  • No Power BI PowerBIIntegration function
  • No SharePoint Forms integration
  • No FetchXML for Dataverse queries (use OData $filter)
  • No polymorphic lookups
  • No Dataverse actions/functions
  • No alternate key support
  • No option set metadata retrieval
  • No environment variables access
  • No Solution Packager
  • No Git integration for ALM (yet)
  • Excel Online connectors (Business and OneDrive) unsupported

When Debugging

  1. Check that @microsoft/power-apps is version ^1.0.3 (not 1.0.0)
  2. Verify power.config.json exists and has valid appId -- read resources/config-schema.md
  3. Ensure the Vite config includes powerApps() plugin
  4. Check browser compatibility (Chrome/Edge may block local network access since Dec 2025)
  5. Verify pac auth is connected to the correct environment
  6. Do NOT add authentication code -- the host handles it

When Migrating from Canvas Apps

If the user wants to port Canvas App logic to a Code App:

  1. Read resources/yaml-syntax.md for the .pa.yaml source format
  2. Identify Power Fx formulas and translate to TypeScript equivalents
  3. Map Canvas App data sources to Code App generated services
  4. Recreate the UI using React components

Vibe Coding Mode

When the user gives a high-level natural language description:

  1. Act as the Plan Designer -- decompose into data model + user flows
  2. Propose Dataverse table structure
  3. Generate component hierarchy
  4. Scaffold the project
  5. Implement iteratively, screen by screen

Read resources/vibe-coding.md for prompt patterns and AI integration.

Web Resource Fallback Deployment

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.

Setup

bash
npm install -D vite-plugin-singlefile

Vite Config

typescript
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,
  },
});

Build and Deploy

bash
npm run build
# Produces a single index.html with all JS/CSS inlined

Then upload via the Dataverse Web API:

powershell
$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:

xml
<SubArea Id="Home" Title="My App" Url="/WebResources/prefix_/html/myapp.html" Client="All" />

Context Differences

When running as a web resource instead of a Code App:

  • @microsoft/power-apps SDK is NOT available — use Xrm.WebApi or direct fetch instead
  • Xrm may not be injected — try parent.Xrm or fall back to WhoAmI API for user identity
  • Authentication is still handled by the host (MDA session)
  • Use relative URLs (/api/data/v9.2/...) for Dataverse calls

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Power Apps Code Apps làm được gì?

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".

Vì sao nên dùng Power Apps Code Apps trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Power Apps Code Apps là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Power Apps Code Apps trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/DanielKerridge/claude-code-power-platform-skills/tree/master/power-apps-code-apps. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Power Apps Code Apps?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Power Apps Code Apps với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Power Apps Code Apps với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Power Apps Code Apps có miễn phí không?

Có. Kỹ năng này được DanielKerridge phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇