create-code-app
Creates Power Apps code apps using React and Vite. Use when building code apps, scaffolding projects, or deploying to Power Platform.
microsoft · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add microsoft/power-platform-skills --skill create-code-app技能说明
name: create-code-app description: Creates Power Apps code apps using React and Vite. Use when building code apps, scaffolding projects, or deploying to Power Platform. user-invocable: true allowed-tools: Read, Edit, Write, Grep, Glob, Bash, LSP, TaskCreate, TaskUpdate, TaskList, TaskGet, AskUserQuestion, Skill, EnterPlanMode, ExitPlanMode model: opus
📋 Shared Instructions: shared-instructions.md - Cross-cutting concerns.
References:
- prerequisites-reference.md - Prerequisites and required permissions
- troubleshooting.md - Common issues, npm scripts, resources
Create Power Apps Code App
Workflow
- Prerequisites → 2. Gather Requirements → 3. Plan → 4. Scaffold → 5. Initialize → 6. Build & Deploy (baseline) → 7. Add Data Sources → 8. Implement App → 9. Final Build & Deploy → 10. Summary
Step 0: Check Memory Bank
Check for memory-bank.md per shared-instructions.md. Skip completed steps.
Step 1: Validate Prerequisites
Run prerequisite checks first -- no point gathering requirements if the environment isn't ready. See prerequisites-reference.md for details.
Check Node.js and Git (runs natively in bash):
node --version # Must be v22+
git --version # Optional but recommended
- Missing Node.js: Report "Install Node.js v22+ from https://nodejs.org/" and STOP.
- Node.js below v22: Report "Node.js 22+ is required. Please upgrade or switch with
nvm use 22." and STOP. - Missing Git: Report "Recommended but optional." Continue if approved.
- All present: Report versions and proceed.
Step 2: Gather Requirements
Skip questions the user already answered in their initial instruction.
If the user has not described what they want to build (i.e., /create-code-app was invoked with no arguments or a vague prompt), start with a single open-ended question before asking anything else:
"What would you like to build? Describe it in your own words — what it does, who uses it, and what problem it solves."
Wait for their answer. Use it to frame all follow-up questions. Do NOT present a multiple-choice list of app types before the user has described their idea.
Once you have their description:
- Confirm the app name and clarify the purpose if needed
- Ask about data -- focus on what the app needs to do, not specific technologies:
- "What data does your app need to work with?" (e.g., company emails, project tasks, custom business records)
- "Does your app need to search existing information, manage its own data, or both?"
- Based on their answers, recommend the best approach:
- Store and manage custom business data (tables, forms, CRUD) → Dataverse (
/add-dataverse) - Interact with specific services (send emails, post messages, manage files) → the appropriate connector
- Search M365 data or get AI-powered answers (emails, files, people, company knowledge) → Work IQ (
/add-workiq)
- Store and manage custom business data (tables, forms, CRUD) → Dataverse (
- If they mention existing Dataverse tables, SharePoint lists, or connectors by name, use those directly
- Ask about UI requirements: key screens, layout, interactions, theme preference
- Ask any clarifying questions now -- resolve all ambiguity before entering plan mode
Step 3: Plan
- Enter plan mode with
EnterPlanMode - Design the full implementation approach:
- Which
/add-*skills to run for data sources - App architecture: components, pages, state management
- Feature list with priority order
- Which
- Present plan for approval, include
allowedPromptsfrom prerequisites-reference.md - Exit plan mode with
ExitPlanModewhen approved
Step 4: Scaffold
Ask the user for a folder name. Default to powerapps-{app-name-slugified}-{timestamp} if they don't have a preference.
IMPORTANT: Use npx degit to download the template. Do NOT use git clone, do NOT manually create files, do NOT download from GitHub UI. degit downloads the template without git history.
npx degit microsoft/PowerAppsCodeApps/templates/vite {folder} --force
cd {folder}
npm install
Notes:
- Use
--forceto overwrite if the directory already has files (e.g.,.claudefrom a planning session) - If targeting an existing directory, use
.as the folder name:npx degit microsoft/PowerAppsCodeApps/templates/vite . --force - If
npx degitfails (network issues, npm not found), retry once, then ask the user to run manually
Verify: package.json exists, node_modules/ created.
Step 5: Initialize
Resolve the CLI first (see cli-binary.md): run as
$PA app init …(npx --no-install pa …), never a barepa. Onpower-apps-only projects, translate topower-apps init …(theinitverb and its-n/-eflags are unchanged on both binaries).
pa app init -n '{user-provided-app-name}' -e <environment-id>
Finding the environment ID: It's the GUID in the make.powerapps.com URL: https://make.powerapps.com/environments/<env-id>/home. If you don't pass -e, the CLI will prompt for it interactively.
Authentication: On first run, a browser window opens for Microsoft sign-in. Complete the login and the command continues. No separate auth setup is needed.
See preferred-environment.md for environment selection details.
pa app init failure:
- Non-zero exit: Report the exact output and STOP. Do not continue to Step 6.
- "environmentId not found" or environment validation error: Verify the environment ID is correct and the user has maker permissions in that environment, then retry.
- Example: _"The
pa app initcommand failed:[error text]. Please check that environment ID32a51012-...is cor