Skip to content

Commit e069665

Browse files
Add wizard input experience for canvas app generation (#110)
1 parent cf58298 commit e069665

2 files changed

Lines changed: 56 additions & 9 deletions

File tree

plugins/canvas-apps/agents/canvas-app-planner.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ each screen in parallel without needing to call MCP tools themselves.
3434
You will be invoked by the `generate-canvas-app` skill with a prompt that includes:
3535

3636
- The user's app requirements (`$ARGUMENTS`)
37+
- User preferences collected by the skill's wizard (target users, aesthetic direction, features, reference image observations)
3738
- The working directory where `.pa.yaml` files should be written
3839
- The plugin root directory (`${CLAUDE_PLUGIN_ROOT}`), from which you must read `references/TechnicalGuide.md` and `references/DesignGuide.md`
3940

@@ -76,12 +77,13 @@ Call `TaskCreate` once per task:
7677

7778
## Step 4 — Design and Present Plan for Approval
7879

79-
Based on discovery and the user's requirements, reason through:
80+
Based on discovery, the user preferences passed in the prompt, and the user's requirements, reason through:
8081

8182
- How many screens are needed and what each does
8283
- Which controls will drive each screen's layout
8384
- What aesthetic direction fits the app's purpose
8485
- How data will flow (data sources, collections, or mock data)
86+
- **Layout strategy** — default to **AutoLayout** (responsive) using `GroupContainer` with `Variant: Horizontal` or `Variant: Vertical`. Only use ManualLayout if the user explicitly requests pixel-perfect positioning or the app is a fixed-size desktop dashboard. Mobile and cross-device apps MUST use AutoLayout.
8587

8688
Enter plan mode (`EnterPlanMode`) and present the following to the user:
8789

@@ -234,7 +236,7 @@ App file written: [working directory]/App.pa.yaml
234236

235237
## Critical Constraints
236238

237-
- **Do NOT ask questions.** The one user interaction is the plan mode approval in Step 4.
239+
- **Do NOT ask questions.** The one user interaction is the plan mode approval in Step 4. User preferences are passed to you in the prompt — do not re-ask them.
238240
- **Do NOT write any screen `.pa.yaml` files.** Screen builders own all screen-level files.
239241
- **Do NOT call `compile_canvas` or instruct any other agent to call it.** Compilation/validation is performed exclusively by the orchestrating `generate-canvas-app` skill after all screens have been generated.
240242
- **Embed full `describe_control` output** in the plan document — never summarize property names.

plugins/canvas-apps/skills/generate-canvas-app/SKILL.md

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2.0.0
44
description: Generate a complete, visually distinctive Power Apps canvas app with YAML. USE WHEN the user wants to create, build, or generate a Canvas App or pa.yaml files.
55
author: Microsoft Corporation
66
user-invocable: true
7-
allowed-tools: Read, Write, Edit, Bash, Task, TaskCreate, TaskUpdate, TaskList, mcp__canvas-authoring__compile_canvas
7+
allowed-tools: Read, Write, Edit, Bash, AskUserQuestion, Task, TaskCreate, TaskUpdate, TaskList, mcp__canvas-authoring__compile_canvas
88
---
99

1010
# Generate a Canvas App
@@ -40,13 +40,52 @@ Pass this absolute path as the working directory in every agent prompt below.
4040

4141
---
4242

43-
## Phase 1 — Plan
43+
## Phase 1 — Gather Preferences (Wizard)
44+
45+
Before invoking the planner, use `AskUserQuestion` to collect design preferences that cannot
46+
be reliably inferred from `$ARGUMENTS`. **Parse `$ARGUMENTS` first** to determine which
47+
questions to skip — but a short request like "visitor check-in app" or "expense tracker"
48+
leaves most preferences unspecified and you MUST ask.
49+
50+
Call `AskUserQuestion` with the applicable questions from the table below (include only the
51+
ones that need answers):
52+
53+
| Question | Header | When to Ask | Options |
54+
|----------|--------|-------------|---------|
55+
| Who will primarily use this app, and on what device? | Target Users & Device | Only if not clear from `$ARGUMENTS` | *(3–4 dynamically inferred options that combine the user role with their likely device, e.g., for "visitor check-in": Front desk staff on desktop/tablet, Security team on tablet, Self-service kiosk on tablet, Visitors on their phone)* |
56+
| Do you have a screenshot or mockup for reference? (paste an image or provide a file path) | Reference | Only if user has NOT already attached/pasted an image with their request | Yes I'll share one now, No just pick a direction for me |
57+
| What aesthetic direction? | Aesthetic | Only if not clear from `$ARGUMENTS` (skip if user already described a visual direction like "dark themed", "minimal", "corporate style", or provided a reference image) | Clean & Professional (Recommended), Bold & High-Contrast, Soft & Approachable, Dense & Utilitarian |
58+
| Which features do you need? (multi-select) | Features | Only if `$ARGUMENTS` is vague on features | *(3–4 dynamically inferred options based on app purpose + target users)* |
59+
60+
**Rules:**
61+
62+
1. If the user provides a screenshot (either attached with their original request or via the
63+
wizard), examine it to extract structural cues (layout, navigation pattern) and visual cues
64+
(color palette, density, typography). Use these to inform the aesthetic direction — do not
65+
ask the aesthetic question separately.
66+
2. **If all questions are already answered by `$ARGUMENTS` and any attached images, skip the
67+
wizard entirely** and proceed directly to Phase 2.
68+
3. Ask all applicable questions in a single `AskUserQuestion` call — do not ask them one at a time.
69+
4. Store all answers for use in the planner prompt below.
70+
71+
**Target users & device influence design decisions:**
72+
- **Desktop users** → data-dense layouts, tables, keyboard-friendly, multi-column. ManualLayout acceptable for pixel-perfect dashboards.
73+
- **Tablet users** → touch-friendly targets, medium density, AutoLayout (responsive) so the app adapts to landscape/portrait.
74+
- **Phone users** → large touch targets, single-column, simplified navigation, AutoLayout (responsive), minimal typing.
75+
- **Multi-device / unknown** → AutoLayout (responsive) required.
76+
77+
**Layout strategy rule of thumb:** Default to **AutoLayout** (responsive) unless the user explicitly chose desktop-only or requested pixel-perfect positioning. AutoLayout uses `GroupContainer` with `Variant: Horizontal` or `Variant: Vertical` and `LayoutDirection`, which adapts to different screen sizes. ManualLayout uses fixed `X`/`Y`/`Width`/`Height` values that do not reflow.
78+
79+
---
80+
81+
## Phase 2 — Plan
4482

4583
Invoke the `canvas-app-planner` agent using the `Task` tool.
4684

4785
Pass a prompt that includes:
4886

4987
- The user's requirements: `$ARGUMENTS`
88+
- The wizard answers collected in Phase 1 (target users & device, aesthetic direction, features, and any screenshot observations)
5089
- The working directory (the absolute path resolved in Phase 0)
5190
- The plugin root path: `${CLAUDE_PLUGIN_ROOT}`
5291

@@ -56,19 +95,25 @@ Example prompt:
5695
>
5796
> [paste $ARGUMENTS here]
5897
>
98+
> User preferences (from wizard):
99+
> - Target users & device: [answer or "not specified" — e.g., "Front desk staff on desktop/tablet"]
100+
> - Aesthetic direction: [answer or "not specified"]
101+
> - Features: [answer or "not specified"]
102+
> - Reference image: [observations from screenshot, or "none provided"]
103+
>
59104
> Working directory: [absolute path from Phase 0]
60105
> Plugin root: ${CLAUDE_PLUGIN_ROOT}
61106
>
62107
> Follow the instructions in your agent file. Write canvas-app-plan.md and App.pa.yaml to
63108
> the working directory. Return the screen list and plan document path when complete.
64109
65110
**Wait for the planner to finish.** The planner will present the screen plan to the user via
66-
plan mode and wait for approval before returning. Do not proceed to Phase 2 until the planner
111+
plan mode and wait for approval before returning. Do not proceed to Phase 3 until the planner
67112
task completes successfully.
68113

69114
---
70115

71-
## Phase 2 — Build
116+
## Phase 3 — Build
72117

73118
After the planner completes, read `canvas-app-plan.md` from the working directory.
74119

@@ -100,12 +145,12 @@ Wait for all screen-builder tasks to complete before proceeding.
100145

101146
---
102147

103-
## Phase 3 — Validate and Fix
148+
## Phase 4 — Validate and Fix
104149

105150
After all screen-builders have finished writing their files, call `compile_canvas` on the
106151
working directory.
107152

108-
**On success:** Proceed to Phase 4.
153+
**On success:** Proceed to Phase 5.
109154

110155
**On failure:** Read every error in the output. Errors will reference specific files and
111156
line numbers. For each error:
@@ -121,7 +166,7 @@ Track how many `compile_canvas` passes were needed.
121166

122167
---
123168

124-
## Phase 4 — Summary
169+
## Phase 5 — Summary
125170

126171
Delete `canvas-app-plan.md` from the working directory using `Bash`:
127172
`rm <working-directory>/canvas-app-plan.md`

0 commit comments

Comments
 (0)