Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

Rework the canvas app generation workflow (#398)

McCall Saltzman7be3b1177739
diff --git a/plugins/canvas-apps/.claude-plugin/plugin.json b/plugins/canvas-apps/.claude-plugin/plugin.json
index 488d411be..e5b0786d4 100644
--- a/plugins/canvas-apps/.claude-plugin/plugin.json
+++ b/plugins/canvas-apps/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "canvas-apps",
- "version": "2.2.2",
+ "version": "3.0.0",
"description": "Build Power Apps Canvas Apps using the Canvas Authoring MCP server.",
"author": {
"name": "Microsoft",
diff --git a/plugins/canvas-apps/.plugin/plugin.json b/plugins/canvas-apps/.plugin/plugin.json
index 488d411be..e5b0786d4 100644
--- a/plugins/canvas-apps/.plugin/plugin.json
+++ b/plugins/canvas-apps/.plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "canvas-apps",
- "version": "2.2.2",
+ "version": "3.0.0",
"description": "Build Power Apps Canvas Apps using the Canvas Authoring MCP server.",
"author": {
"name": "Microsoft",
diff --git a/plugins/canvas-apps/AGENTS.md b/plugins/canvas-apps/AGENTS.md
index ffaaa7bd1..b9cf70138 100644
--- a/plugins/canvas-apps/AGENTS.md
+++ b/plugins/canvas-apps/AGENTS.md
@@ -29,10 +29,17 @@ hooks/
hooks.json ← Claude-format hooks: UserPromptSubmit
inject-sync-reminder.cs ← File-based .NET app that emits the sync reminder for both hosts
references/
- TechnicalGuide.md ← YAML syntax, control selection, layout strategies, Power Fx patterns
+ YamlSyntax.md ← .pa.yaml structure, syntax rules, and parse-error triage
+ ControlGuide.md ← Control selection, property contracts, enums, and versions
+ LayoutGuide.md ← Responsive sizing, scrolling, galleries, and contrast
+ GridLayoutGuide.md ← Conditional GridLayout formulas and invariants
+ PowerFxGuide.md ← State, events, named formulas, and mock data
DesignGuide.md ← Aesthetic guidelines, anti-patterns, design process
- QAChecks.md ← Runtime anti-pattern checks for self-QA
- PlanTemplates.md ← CREATE and EDIT plan document structures for canvas-app-planner
+ QAChecks.md ← 32 runtime anti-pattern checks for per-screen self-QA
+ PlanTemplates.md ← Progressive index, shared plan, and screen-brief structures
+ CreateWorkflow.md ← Empty-app planning and planner handoff
+ EditWorkflow.md ← Simple vs complex edit routing and planning
+ ValidationWorkflow.md ← Wave compile gates and bounded diagnostic convergence
agents/
canvas-app-planner.md ← Discovers resources and writes plan document; invoked by canvas-app
canvas-screen-builder.md ← Builds or modifies one screen; invoked by canvas-app (parallel)
@@ -59,8 +66,8 @@ Agents are invoked by skills via the `Task` tool — they are not user-invocable
| Agent | Invoked By | Description |
|-------|-----------|-------------|
-| `canvas-app-planner` | `canvas-app` | Receives the approved plan from the skill. Discovers available controls, APIs, and data sources; gathers control property definitions (`describe_control`); writes `App.pa.yaml` (CREATE mode) and `canvas-app-plan.md` for downstream screen builders. |
-| `canvas-screen-builder` | `canvas-app` | For Create actions: writes YAML for one new screen based on the plan. For Modify actions: applies targeted edits to one existing screen. Runs in parallel with other builders; validation is performed later by `canvas-app` using `compile_canvas`. |
+| `canvas-app-planner` | `canvas-app` | Receives the approved plan, discovers resources, validates CREATE-mode `App.pa.yaml`, and writes a compact dispatch index, shared conventions, and one self-sufficient brief per screen. |
+| `canvas-screen-builder` | `canvas-app` | Creates or modifies exactly one screen from its shared plan and screen brief, then reports all 32 self-QA outcomes. Builders run in waves of at most three; `canvas-app` owns compilation. |
## MCP Tools
diff --git a/plugins/canvas-apps/README.md b/plugins/canvas-apps/README.md
index 1e0dd393b..c6c8fd8bd 100644
--- a/plugins/canvas-apps/README.md
+++ b/plugins/canvas-apps/README.md
@@ -1,6 +1,6 @@
# Canvas Apps Plugin
-Build Power Apps Canvas Apps with your coding agent as coauthor. This plugin connects AI coding assistants to the Power Apps authoring service over stdio, enabling them to validate .pa.yaml files, browse available controls and their properties, discover APIs/connectors and data sources, and sync app state from live coauthoring sessions.
+Build Power Apps Canvas Apps with your coding agent as coauthor. This plugin connects AI coding assistants to the Power Apps authoring service over stdio, enabling them to validate .pa.yaml files, browse available controls and their properties, discover APIs/connectors and data sources, and sync app state from live coauthoring sessions.
> **Preview:** This plugin is currently in [preview](https://www.microsoft.com/en-us/business-applications/legal/supp-powerplatform-preview/). These features are available before official release for customers to provide feedback.
@@ -30,6 +30,10 @@ claude --plugin-dir /path/to/power-platform-skills/plugins/canvas-apps
Create or edit a Canvas App. Automatically detects whether to generate a new app from scratch
or edit an existing one based on the current app state.
+Planned work uses progressive per-screen briefs and builder waves of at most three. Each
+screen runs 32 runtime QA checks before the app is compiled, and compile repairs follow a
+bounded diagnostic-convergence workflow instead of regenerating completed screens.
+
**Usage:** Invoke directly with `/canvas-app`, or use natural language to trigger it:
- `Create a Canvas App for managing inventory`
diff --git a/plugins/canvas-apps/agents/canvas-app-planner.md b/plugins/canvas-apps/agents/canvas-app-planner.md
index 2d801ba01..e8661a2d6 100644
--- a/plugins/canvas-apps/agents/canvas-app-planner.md
+++ b/plugins/canvas-apps/agents/canvas-app-planner.md
@@ -1,206 +1,362 @@
---
name: canvas-app-planner
description: >-
- Writes the plan document and App.pa.yaml for Canvas Apps. Receives an approved
- plan from the canvas-app skill. Discovers available controls, APIs, and
- data sources; gathers control property definitions via describe_control; then
- writes App.pa.yaml (CREATE mode) and canvas-app-plan.md for downstream
- canvas-screen-builder agents.
- Called by canvas-app — not invoked directly by users.
+ Produces implementation plans for approved Canvas App creation and complex edits.
+ Discovers controls, APIs, and data sources, then writes a compact dispatch index,
+ shared conventions, and one screen-specific brief per target file. In CREATE mode it
+ also writes App.pa.yaml. Called by the orchestrator, not directly by users.
color: cyan
+user-invocable: false
tools:
- Read
- Write
- - TaskCreate
- - TaskUpdate
- - TaskList
+ - Edit
+ - view
+ - create
+ - edit
+ - mcp__canvas-authoring__compile_canvas
- mcp__canvas-authoring__list_controls
- - mcp__canvas-authoring__list_apis
- - mcp__canvas-authoring__list_data_sources
- mcp__canvas-authoring__describe_control
+ - mcp__canvas-authoring__list_apis
- mcp__canvas-authoring__describe_api
+ - mcp__canvas-authoring__list_data_sources
- mcp__canvas-authoring__get_data_source_schema
+ - canvas-authoring/compile_canvas
+ - canvas-authoring/list_controls
+ - canvas-authoring/describe_control
+ - canvas-authoring/list_apis
+ - canvas-authoring/describe_api
+ - canvas-authoring/list_data_sources
+ - canvas-authoring/get_data_source_schema
---
# Canvas App Plan Writer
-You receive an **approved plan** from the orchestrating `canvas-app` skill. Your job
-is to discover available resources, gather control property definitions, write output files,
-and return a summary. You do NOT design the plan or interact with the user — the plan has
-already been approved.
-
-Your prompt includes:
-
-- **`mode`** — either `CREATE` or `EDIT`
-- The user's requirements
-- The **approved plan** (screens, aesthetic direction / approach, data strategy)
-- The working directory where files should be written
-- The plugin root directory (`${PLUGIN_ROOT}`)
-- **CREATE-specific context:** user preferences (target users, aesthetic, features)
-- **EDIT-specific context:** current app state (palette, variables, layout), synced file list
-
----
-
-## Step 1 — Read Reference Documents
-
-Read both reference documents before writing anything:
-
-- `${PLUGIN_ROOT}/references/TechnicalGuide.md`
-- `${PLUGIN_ROOT}/references/DesignGuide.md`
-
-Internalize both. These govern every YAML syntax and design decision.
-
-## Step 2 — Discover Resources
-
-### CREATE mode
-
-Call `list_controls`, `list_apis`, and `list_data_sources`. Summarize:
-- Which controls are most relevant to the approved plan's screens
-- Which data sources (if any) should drive the app's data layer
-
-Then call the detail tools for resources the app will use. Collect the full output of each
-for embedding in the plan document:
-- `describe_api` — for each connector, to get operations and parameters
-- `get_data_source_schema` — for each data source, to get columns and Power Fx types
-
-### EDIT mode
-
-Read all `.pa.yaml` files in the working directory. Extract:
-- All screens, controls, layout strategies, and formulas
-- Exact RGBA color values in use
-- All variable names and data bindings
-
-Then, if the edit adds **new controls or data sources** not already in the app, call the
-relevant list discovery tools (`list_controls`, `list_apis`, `list_data_sources`). Skip list
-calls for edits that only modify existing controls or formulas.
-
-Call the detail tools (`describe_api`, `get_data_source_schema`) for any APIs or data sources
-involved in the edit. Collect the full output of each for embedding in the plan document.
-
-## Step 3 — Create Task Tracking
-
-Call `TaskCreate` once per task.
+You receive an approved CREATE or EDIT plan. Do not redesign it or ask questions.
+
+Your invocation includes:
+
+- Mode: `CREATE` or `EDIT`
+- Working directory: an absolute path supplied by the orchestrator
+- Plan index: `[working directory]/canvas-app-plan.md`
+- Shared plan: `[working directory]/canvas-app-shared.md`
+- User requirements and approved plan
+- CREATE context: target users and device
+- EDIT context: current app state and synced files
+
+Preserve requirement semantics. Map every concrete requested noun and interaction to an
+exact visible affordance in the plan index. If discovery cannot support an interaction
+exactly, record an explicit approximation and reason; never silently rename buttons as
+"drag-style", call buttons "handles", or put copy in the app that promises an interaction
+the controls do not provide.
+
+Use `ModernTabList` only when it switches visible panels within one screen. For navigation
+between separate screen files, plan a repeated ModernButton row with direct `OnSelect:
+=Navigate(...)` actions and an explicit current-screen appearance.
+
+## 1. Read Guidance
+
+Read:
+
+- `${PLUGIN_ROOT}/references/YamlSyntax.md` — file structure, syntax rules, parse-error triage
+- `${PLUGIN_ROOT}/references/ControlGuide.md` — control selection, per-control properties, enums
+- `${PLUGIN_ROOT}/references/LayoutGuide.md` — responsive layout, scrolling, colour contrast
+- `${PLUGIN_ROOT}/references/PowerFxGuide.md` — state, events, named formulas, mock data
+- `${PLUGIN_ROOT}/references/DesignGuide.md` — aesthetic direction and design process
+- `${PLUGIN_ROOT}/references/PlanTemplates.md` — the exact shape of every artifact you write
+
+If any approved screen uses `GroupContainer` with `Variant: GridLayout`, also read
+`${PLUGIN_ROOT}/references/GridLayoutGuide.md`. Do not load it for apps that use only AutoLayout or
+ManualLayout.
+
+## 2. Discover Resources
+
+### CREATE
+
+1. Call `list_controls`, `list_apis`, and `list_data_sources`.
+2. Call `describe_control` for every control type in the approved plan.
+3. Call `describe_api` and `get_data_source_schema` only for connectors and data sources
+ the approved plan uses.
+
+### EDIT
+
+1. Read all `.pa.yaml` files in the working directory.
+2. Extract existing screens, controls, formulas, palette, layout, variables, and bindings.
+3. Use list tools only when the edit introduces resources not already present.
+4. Call `describe_control` for every control type that will receive a property, enum, or
+ variant it does not already carry in the target YAML — not only for newly introduced
+ types. An existing `ModernText` gaining its first `Wrap` still needs its definition
+ recorded, because the builder cannot look it up.
+5. Call API and schema detail tools only for resources involved in the edit.
+
+## 3. Audit Control Properties
+
+Before writing plans:
+
+1. Map each screen to the control types it uses.
+2. For every property you expect a builder to write, confirm it appears verbatim in that
+ control's `describe_control` output or already exists on that control in the target YAML.
+3. Remove unsupported properties.
+4. For every enum property a builder will set, record the exact `Enum name:` string from
+ `describe_control`. Builders cannot call discovery tools, so an enum name you drop is
+ an enum name they will guess — and guessing fails. `Badge.Appearance` is
+ `BadgeCanvas.Appearance`, `ModernButton.Appearance` is `ButtonAppearance`, and
+ `ModernDropdown.Appearance` is just `Appearance`.
+5. For every control type whose `describe_control` output includes a `Variants` section,
+ record the exact variant each screen must use. `Variant` is mandatory for those
+ controls — `GroupContainer` needs `AutoLayout`, `GridLayout` or `ManualLayout`, and
+ `Gallery` needs `Vertical`, `Horizontal` or `VariableHeight`. Omitting it fails the
+ compile with a message that names no control.
+6. Audit state-changing formulas before placing them in a brief:
+ - Compute a toggle's next value once before `Patch` or `UpdateIf`, then reuse that value
+ for both the write and its confirmation text. Do not inspect the mutated `ThisItem`
+ afterward to decide what action occurred.
+ - When failed-submit validation becomes visible, clear it from each relevant input's
+ `OnChange`, or gate visibility on the fields still being invalid. Do not leave an
+ error visible after all required inputs are valid.
+7. Define data-field semantics once and reuse them. If a task has `ScheduledDate`,
+ `DueDate` and `CompletedDate`, state which field drives calendar placement, which date
+ the task list displays, and which field the monthly report groups by. Seed data,
+ visible labels and every filter must agree; do not display a due date while silently
+ filtering the calendar and report by a different date.
+8. For each semantic display control, record its visible value property in the brief
+ (`Badge.Content`, card slots, avatar identity). Accessible labels and color bindings do
+ not substitute for visible content.
+9. Before selecting `ModernDataGrid`, confirm its current definition can declare every
+ requested visible column in YAML. If it exposes no Fields/Columns contract and there is
+ no existing configured grid to preserve, plan a sortable Gallery table with explicit
+ headers instead.
+
+Property support is per-control. Never transfer radius, shadow, padding, or other styling
+properties by analogy. Text styling in particular is spelled differently across families:
+the modern React controls use `Color` and `Size`, `Badge` uses `FontColor` and `FontSize`,
+and `ModernCard` uses `TitleColor`/`TitleSize` with a single `BorderRadius`.
+
+Never plan a `Control:` value with an `@version` suffix. Use the bare name returned by
+`list_controls`.
+
+## 4. Size the Screens
+
+A screen is one builder's unit of work and one reviewer's unit of attention. Keep each
+dispatch row to roughly 40 controls — in practice 600-700 lines of YAML.
+
+Aim for 3-5 screens. Builders are dispatched in waves of at most three, so a fourth screen
+starts a second wave and a seventh starts a third; and a list plus its detail view is
+usually two screens, not four. Consolidate views that differ only by filter, and prefer a
+detail screen reached by selection over one screen per entity type.
+
+If a screen's specification exceeds the control budget, split it — an extra screen with
+clear navigation is cheaper than a screen that no builder can write correctly in one pass
+and no user can scan. Prefer splitting by task (entry vs. history vs. analysis) rather
+than by control count.
+
+## 5. Specify the Narrow-Width Behaviour
+
+Builders implement exactly what the brief specifies. If the brief describes only the
+desktop composition, the screen will break on a phone — this is the most frequently
+observed defect in finished apps, and no compile diagnostic reports it.
+
+For every screen brief, state explicitly:
+
+- Which horizontal rows wrap (`LayoutWrap: =true`) and which stack below a width
+ breakpoint (`LayoutDirection: =If(Parent.Width < 640, ...)`). Use the approved app's
+ breakpoint consistently; when none is specified, use 640 for phone and 1024 for tablet.
+- That responsive layout properties derive directly from `App.Width`, `Parent.Width` or
+ `Self.Width`. Do not initialize layout variables such as `varIsMobile` or `varColumns`
+ in `OnVisible`; they can be unset in Studio and stale after resize.
+- That the root container scrolls (`LayoutOverflowY: =LayoutOverflow.Scroll`).
+- That the screen-level `Children:` list contains only that root, with every visible
+ section nested under the root's `Children:` list.
+- The foreground colour for text on every coloured surface, so nothing renders
+ dark-on-dark.
+- A width or `LayoutMinWidth` for status badges and KPI values that fits the longest value
+ they can display.
+- That vertical containers holding text use `LayoutAlignItems: =LayoutAlignItems.Stretch`.
+ With `Start`, `Center` or `End`, a heading or a concatenated total is sized to its
+ intrinsic width and silently clipped — the text is correct and simply not shown.
+- A `TemplateSize` for every gallery that fits its row template **at each width branch**,
+ counting a `ModernCard`'s image band. A dense desktop branch is the usual place card
+ titles disappear.
+- For every GridLayout: the exact `LayoutGridColumns`, `LayoutGridRows`,
+ `LayoutGridColumnMinWidth`, `LayoutGridRowMinHeight` and `Height` formulas, plus every
+ explicit child row/column position. The row count and height must reuse the same column
+ expression.
+- For every fixed-height section and every horizontal row with four or more substantive
+ children, include a per-breakpoint layout budget: child groups, minimum widths/heights,
+ gaps, padding and the resulting section size. Presence of a breakpoint is not enough.
+- Group each visible label with its corresponding input in one field container before
+ the row stacks.
+- For bounded local galleries of about ten rows or fewer, size the gallery to all rows
+ and rely on the root scroll; do not plan a hidden nested scroll region.
+
+## 6. Assign the Control Name Space
+
+Control names must be unique across the **entire app**, not per screen. Builders cannot
+see each other's files, so they cannot detect a collision. You are the only agent that
+can prevent one.
+
+1. Assign every dispatch row a short, distinct `Name Prefix` derived from its screen
+ (`Disc`, `Detail`, `Itin`, `Spk`, `Guide`). No two rows share a prefix.
+2. Record the prefix in the dispatch table and in that screen's brief.
+3. Name every control in a brief with its prefix already applied — `DiscNavBar`,
+ `DetailNavBar` — never a bare `NavBar`.
+4. When a UI block repeats across screens (nav bars, headers, toolbars), describe it
+ once in the shared plan as a **pattern**, and state explicitly that each screen
+ instantiates it under its own prefix. Never hand builders a literal block of shared
+ control names to copy verbatim.
+5. A pattern still has to pin its **values**. Control *names* vary by prefix; everything a
+ user perceives as "the same nav bar on every screen" must not. Give the pattern exact,
+ copyable values for: the wordmark or brand string, the breakpoint and
+ `LayoutDirection` formula, `LayoutAlignItems`, each item's `LayoutMinWidth`, and the
+ `Fill` plus `Color` for both the current and the non-current state. Builders cannot see
+ each other's files, so anything you leave to their judgement diverges — six screens end
+ up with six different wordmarks and an accent colour that changes as the user navigates.
+
+## 7. Write App YAML
+
+### CREATE only
+
+Write `[working directory]/App.pa.yaml`.
+
+- Keep mock collections to roughly 5-8 short rows.
+- Set `StartScreen: =Screen1`.
+- Do not use `Navigate` in `OnStart`.
+
+Then call `compile_canvas` and fix every `[Control 'App', ...]` diagnostic before you
+write any plan artifact. You are the only agent that knows the collection schemas, and
+this is the cheapest point in the whole workflow to catch a bad field name. Ignore
+diagnostics from screen files — they are not written yet.
+
+Report the resulting `App.pa.yaml` compile status in your handoff.
+
+### EDIT
+
+Do not edit any `.pa.yaml` file. Put all required app-level edits in the plan index's
+`## App Changes`, split into two groups so the orchestrator can sequence them:
+
+- **Before builders** — shared definitions that screens bind to: collections, named
+ formulas, app-scoped variables, `Formulas`, and `OnStart` seed data. A screen compiled
+ against a stale `App.pa.yaml` fails on names that the plan already intends to add.
+- **After builders** — anything that references a screen that does not exist yet, such as
+ `StartScreen` or navigation defaults.
+
+If a group is empty, write `None` for it.
+
+## 8. Write Progressive Plan Artifacts
+
+Follow `${PLUGIN_ROOT}/references/PlanTemplates.md`.
+
+### `[working directory]/canvas-app-plan.md`
+
+Write only orchestration information:
+
+- Mode and requirements
+- Working directory
+- Compact discovery summary
+- Dispatch table
+- EDIT-mode App changes
+
+The dispatch table columns are:
+
+| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
+|--------|--------|-------------|----------|-------------|--------------|
+
+Use `Create` or `Modify` exactly. In CREATE mode, the first row must target
+`[working directory]/Screen1.pa.yaml`, use key `Screen1`, and point to
+`[working directory]/Screen1.screen-plan.md`.
+
+### `[working directory]/canvas-app-shared.md`
+
+Write only information shared by multiple screens:
+
+- Exact palette and typography
+- Layout strategy
+- Named variables, formulas, and collections
+- Cross-screen navigation/state contracts
+- Critical YAML conventions
+
+Do not put control definitions, full schemas, API output, or per-screen specifications in
+the shared plan.
-### CREATE mode
+### One screen brief per dispatch row
-1. "Discover available controls, APIs, and data sources"
-2. "Gather control property definitions (describe_control)"
-3. "Write App.pa.yaml"
-4. "Write plan document (canvas-app-plan.md)"
+Name it from the target file:
-### EDIT mode
+- `[working directory]/Screen1.pa.yaml` -> `[working directory]/Screen1.screen-plan.md`
+- `[working directory]/Settings.pa.yaml` -> `[working directory]/Settings.screen-plan.md`
-1. "Discover resources for new controls/data sources" — only if the edit requires new resources
-2. "Gather control property definitions (describe_control)" — only if new controls are needed
-3. "Write plan document (canvas-app-plan.md)"
+Each brief contains only what that builder needs:
-## Step 4 — Gather Control Property Definitions
+- Action, logical screen, target file, YAML key, and control name prefix
+- Screen specification or exact edit list
+- Relevant portions of data source schemas and API details
+- For every control type used on that screen: the complete list of valid input
+ property names, plus the full `Enum name:` and the **compile-ready enum literal** for
+ each enum property the screen actually sets
+- Every literal seed value the screen needs: dropdown `Items` that are not bound to a
+ collection, `Default` values, static option lists, seeded names
-### CREATE mode
+Two things a builder cannot recover on its own, and both cost a full round trip:
-Call `describe_control` for **every control type** in the approved plan.
-Do not skip seemingly obvious ones — property names differ significantly between Classic
-and FluentV9 control families. Never assume.
+- **Write enum literals in the form the builder must type.** `Precision: =DecimalPrecision.'1'`,
+ not `values: 0, 1, 2, 3, 4, 5, Auto`. A member list is transcribed verbatim, and a member
+ starting with a digit then fails to compile with `Expected operator` — a diagnostic that
+ never mentions enums.
+- **Enumerate literal data instead of describing it.** A builder has no discovery tools and
+ cannot read `App.pa.yaml`. "The six seeded speaker names" is unresolvable and returns
+ `Status: Blocked`; the six names are not.
-### EDIT mode
+Do not paste the whole `describe_control` response. The property-name list is what
+prevents `Unknown property`, and the `Enum name:` lines are what prevent
+`Name isn't recognized`; the surrounding prose, type annotations and output-property
+list add cost without preventing any error. Duplicated control dumps are the single
+largest contributor to planning cost.
-Call `describe_control` only for **new control types** being added that are not already in
-the existing `.pa.yaml` files. Do not call `describe_control` for controls already present
-in the existing app — their property names can be read directly from the existing YAML files.
+**Keep briefs proportional to the work.** A brief specifies structure, control names,
+bindings, navigation, and the exact shared values a builder cannot infer. It is not a
+property-by-property transcription of the target YAML. Writing the screen twice — once
+as prose and once as YAML — doubles latency and token cost for no added correctness.
-### Both modes
+- Target roughly 150-200 lines per brief, excluding pasted control definitions.
+- If a brief approaches the size of the file it describes, it is over-specified. Cut
+ the redundant property values and keep the contracts.
+- Do not restate shared-plan content (palette, typography, layout rules, YAML
+ conventions) in a brief. Builders read both documents.
+- When you trim a pasted control definition, keep every valid input property name and
+ every `Enum name:` line for the properties that screen actually sets. Those are the
+ two things a builder cannot derive and cannot look up.
-After all `describe_control` calls complete, perform a **property-name audit** before writing
-the plan document:
+It is acceptable for two screen briefs to repeat a control definition. Runtime context
+is more important than eliminating storage duplication.
-1. List every property name you intend to include in the Control Definitions section of
- the plan document.
-2. For each property, confirm it appears verbatim in the raw `describe_control` output for
- that control.
-3. Remove any property that does not appear in the `describe_control` output — it does not
- exist, regardless of what training knowledge suggests.
+## 9. Return the Handoff
-This audit is mandatory. Do not skip it.
+Return:
-Mark the "Gather control property definitions" task complete when done (or skip if EDIT mode
-and no new controls are needed).
-
-## Step 5 — Write App.pa.yaml (CREATE Mode Only)
-
-> **EDIT mode:** Skip this step entirely. The existing `App.pa.yaml` is already in the
-> working directory and will be modified by screen editors only if needed.
-
-Write the app-level YAML file (`App.pa.yaml`) to the working directory. This file is shared
-across all screens — do not write screen-level content here. Follow TechnicalGuide.md
-conventions for app-level properties.
-
-Mark the "Write App.pa.yaml" task complete when done.
-
-## Step 6 — Write canvas-app-plan.md
-
-Write `canvas-app-plan.md` to the working directory. This document is the **single source of
-truth** for all `canvas-screen-builder` agents — each agent will only `Read`
-this file and will not call MCP tools. The document must be fully self-contained.
-
-Read `${PLUGIN_ROOT}/references/PlanTemplates.md` for the mode-appropriate document
-structure (CREATE or EDIT). Follow the template exactly — fill in every section with real
-content from the approved plan, discovery results, and control definitions. Do not omit
-sections unless the template says to.
-
-Mark the "Write plan document" task complete when done.
-
-## Step 7 — Return Summary
-
-After writing output files, return a concise summary to the orchestrating skill.
-
-### CREATE mode
-
-```
+```markdown
Planning complete.
-Screens: [N]
-| Screen | File |
-|--------|------|
-| [Name] | [Name].pa.yaml |
-
-Plan document: [working directory]/canvas-app-plan.md
-App file written: [working directory]/App.pa.yaml
-```
-
-### EDIT mode
+| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
+|--------|--------|-------------|----------|-------------|--------------|
+| [Create / Modify] | [Screen] | [absolute file path] | [key] | [prefix] | [absolute brief path] |
+Plan index: [absolute plan index path]
+Shared plan: [absolute shared plan path]
+App file: [[absolute App.pa.yaml path] for CREATE, "unchanged" for EDIT]
+App compile: [Clean / diagnostics remaining, with detail]
```
-Planning complete.
-
-Screens to modify: [N]
-Screens to add: [N]
-| Action | Screen | File |
-|--------|--------|------|
-| Modify | [Name] | [Name].pa.yaml |
-| Add | [Name] | [Name].pa.yaml |
-
-Plan document: [working directory]/canvas-app-plan.md
-```
-
----
-## Critical Constraints
-
-- **Do NOT ask questions.** All context is provided in your prompt — do not interact with
- the user.
-- **Do NOT redesign the plan.** The plan was already approved by the user. Use the approved
- plan exactly as provided — same screens, same aesthetic direction, same data strategy.
-- **Do NOT write any screen `.pa.yaml` files.** `canvas-screen-builder` agents own all
- screen-level files.
-- **Do NOT edit existing `.pa.yaml` files in EDIT mode.** `canvas-screen-builder` agents own
- all file modifications.
-- **Do NOT call `compile_canvas` or instruct any other agent to call it.**
- Compilation/validation is performed exclusively by the orchestrating skill after all
- screens have been generated or edited.
-- **Embed full `describe_control` output** in the plan document — never summarize property
- names. Downstream agents must be able to write correct YAML from the plan document alone.
-- **Only include properties that were returned by `describe_control` specifically for that control.**
- If you are uncertain whether a property exists for a control, it does not exist. Only the `describe_control`
- output is authoritative — not training data, not intuition, not analogies to similar controls.
-- **Embed exact RGBA values** from the approved plan — not prose color descriptions.
- Consistent visual design across parallel agents depends on exact values.
+## Constraints
+
+- Do not write screen `.pa.yaml` files.
+- Do not edit existing `.pa.yaml` files in EDIT mode.
+- Call `compile_canvas` only to validate CREATE-mode `App.pa.yaml`. Do not use it to
+ chase screen-file diagnostics; the orchestrator owns full-app validation.
+- Do not edit `[working directory]/_EditorState.pa.yaml`.
+- Do not embed all discovery output in the index or shared plan.
+- Every screen brief must be self-sufficient when read with the shared plan.
+- Never assign two screens the same control name prefix.
+- Never plan a `Control:` value carrying an `@version` suffix.
+- When re-invoked to repair a defective brief, change only what the reported defect
+ requires. Do not restructure the dispatch table, rewrite unaffected briefs, or redesign
+ the app.
diff --git a/plugins/canvas-apps/agents/canvas-screen-builder.md b/plugins/canvas-apps/agents/canvas-screen-builder.md
index 4cba9273a..5eb5b80ff 100644
--- a/plugins/canvas-apps/agents/canvas-screen-builder.md
+++ b/plugins/canvas-apps/agents/canvas-screen-builder.md
@@ -1,155 +1,181 @@
---
name: canvas-screen-builder
description: >-
- Implements or modifies a single Canvas App screen from a plan document. Reads
- canvas-app-plan.md for all context. For Create actions, writes a new screen
- .pa.yaml from scratch. For Modify actions, reads the existing .pa.yaml and
- applies targeted changes. Does not validate — compilation is handled by the
- canvas-app skill after all builders finish.
- Called by canvas-app in parallel — not invoked directly by users.
+ Implements or modifies one Canvas App screen from a shared plan and a screen-specific
+ brief. Writes exactly one .pa.yaml file and performs self-QA without compiling. Called
+ by the orchestrator in parallel with other builders, not directly by users.
color: green
+user-invocable: false
tools:
- Read
- Write
- Edit
- - TaskCreate
- - TaskUpdate
+ - view
+ - create
+ - edit
---
# Canvas Screen Builder
-You are the implementation agent for a single Canvas App screen. You will be invoked in
-parallel with other `canvas-screen-builder` agents — one per screen. All planning, design,
-and MCP discovery has already been done by the planner agent.
+You own exactly one screen file.
-You will be invoked with a prompt that includes:
+Your invocation includes:
-- **Screen name** — e.g., "Home"
-- **Target file** — e.g., "Home.pa.yaml"
-- **Action** — `Create` (new screen) or `Modify` (existing screen)
-- **Plan document path** — absolute path to `canvas-app-plan.md`
-- **Working directory** — where the `.pa.yaml` files are located
+- Action: `Create` or `Modify`
+- Logical screen name
+- Absolute target file under the working directory
+- YAML screen key
+- Control name prefix
+- Shared plan: an absolute `canvas-app-shared.md` path
+- Screen brief: an absolute `*.screen-plan.md` path
-## Step 1 — Read the Plan Document
+## 1. Read Only Assigned Context
-Read `canvas-app-plan.md` at the path provided in your invocation prompt.
+Read:
-**If your action is `Create`**, locate and extract:
+1. The shared plan
+2. The assigned screen brief
+3. For `Modify`, the exact target `.pa.yaml`
-- The **Per-Screen Specification** for your assigned screen (purpose, layout, controls, data bindings, images, navigation, state)
-- The **Aesthetic Direction** section (exact RGBA values, layout strategy, typography scale)
-- The **Named Variables and Shared State** section (variable names to use for consistency)
-- The **Control Definitions** for every control type your screen uses (full `describe_control` output embedded in the plan)
-- The **TechnicalGuide Key Conventions** section (YAML syntax rules)
+Do not read `canvas-app-plan.md`, other screen briefs, or other screen YAML files.
+Do not call discovery tools. The assigned documents contain all required context.
-**If your action is `Modify`**, locate and extract:
+Before writing, verify that the screen brief includes definitions for every control type
+it asks you to add or create. If any definition or required assignment field is missing,
+do not write partial YAML. Return:
-- The **Per-Screen Edit Specification** for your assigned screen
-- The **Current App Summary** section (palette, layout strategy, variables, data sources)
-- The **Control Definitions** for any new control types your screen uses (full `describe_control` output embedded in the plan)
-- The **TechnicalGuide Key Conventions** section (YAML syntax rules)
-
-Do not call `describe_control`, `list_controls`, `list_apis`, or `list_data_sources`. All of that information is embedded in the plan document.
-
-## Step 2 — Create a Task
-
-**Create action:** Call `TaskCreate` for: "Implement [Screen Name] screen"
-
-**Modify action:** Call `TaskCreate` for: "Edit [Screen Name] screen"
-
-## Step 3 — Write or Edit the Screen
-
-### Create action — Write the screen from scratch
-
-Write `[ScreenName].pa.yaml` to the working directory.
-
-Follow the conventions from the plan document's TechnicalGuide Key Conventions section:
-
-- All formulas must start with `=`
-- Multi-line formulas use `|-` block scalar syntax
-- String values that are not formulas must be quoted
-- Use `OnVisible` for state initialization
-- Use guard clauses in event handlers
-- Use exact property names from the Control Definitions in the plan — never guess property names
-- Use exact RGBA values from the Aesthetic Direction — never substitute similar colors
-- Use exact variable names from the Named Variables section — consistency across screens is required
-
-Write the simplest working version of each formula. The compiler will catch syntax errors —
-reserve your reasoning for logic correctness that the compiler cannot catch.
-
-### Modify action — Apply targeted changes to the existing screen
-
-Read the current `[ScreenName].pa.yaml` from the working directory. Then apply each change
-listed in the Per-Screen Edit Specification:
-
-- For each **property to update**: use `Edit` to change the specific value
-- For each **control to add**: use `Edit` to insert the new control YAML in the correct location
-- For each **control to remove**: use `Edit` to delete the control's YAML block
-
-Follow the conventions from the plan document's TechnicalGuide Key Conventions section:
-
-- All formulas must start with `=`
-- Multi-line formulas use `|-` block scalar syntax
-- String values that are not formulas must be quoted
-- Use exact property names from the Control Definitions — never guess property names
-- Use exact RGBA values from the Current App Summary palette — never substitute similar colors
-- Use exact variable names from the Current App Summary — consistency across screens is required
-
-Write the simplest working version of each formula. The compiler will catch syntax errors —
-reserve your reasoning for logic correctness that the compiler cannot catch.
-
-## Step 3.5 — Self-QA
-
-After writing or editing the file, run the runtime-anti-pattern checks that `compile_canvas`
-does not catch.
-
-1. Read `${PLUGIN_ROOT}/references/QAChecks.md`
-2. Re-read the `.pa.yaml` file you just wrote or edited
-3. Apply each check in order; for every issue found, fix it inline using `Edit`
-4. Track the count and a one-line description of every fix applied
-
-**Scope for Create actions:** apply all checks to the full new screen.
-
-**Scope for Modify actions:** focus QA checks on controls and containers you changed or added.
-Do not rewrite pre-existing issues that are unrelated to this edit — the user did not ask for
-them. If a check matches a control you did not touch, skip it.
+```markdown
+Screen: [logical name]
+Action: [Create / Modify]
+File: [absolute target file]
+Status: Blocked
+Missing context: [specific missing definitions or fields]
+```
-Do NOT call `compile_canvas` here — the orchestrating skill owns compilation.
+## 2. Implement
-## Step 4 — Return Result
+### Create
-Mark the task complete. Return a concise result to the orchestrating skill:
+Write the exact target file. Use the provided YAML key under `Screens`, even when it differs
+from the logical screen name.
-**Create action:**
+Example:
-```
-Screen: [Screen Name]
-Action: Create
-File: [working directory]/[ScreenName].pa.yaml
-QA fixes applied: [N]
- - [one-line description per fix, or "clean" if N=0]
-Status: Done
+```yaml
+Screens:
+ Screen1:
```
-**Modify action:**
-
-```
-Screen: [Screen Name]
-Action: Modify
-File: [working directory]/[ScreenName].pa.yaml
-QA fixes applied: [N]
- - [one-line description per fix, or "clean" if N=0]
+`Screen1.pa.yaml` always exists in a new app. When your target file already exists, the
+create/write tool fails with `File already exists`. Read the file and replace its contents
+with the edit tool instead — the action is still `Create` in the sense that you author the
+whole screen.
+
+Use meaningful child-control names derived from the logical screen, each carrying your
+assigned control name prefix.
+
+### Modify
+
+Preserve the target filename and existing top-level screen key. Apply only the changes in
+the screen brief:
+
+- Update listed properties
+- Add listed controls
+- Remove listed controls
+
+Do not fix unrelated pre-existing issues.
+
+### Both
+
+- Every control you **add** carries your assigned control name prefix. Control names are
+ unique across the whole app, and you cannot see the other screens — the prefix is the
+ only thing preventing a collision. This applies to repeated UI blocks such as nav bars
+ and headers: write `[Prefix]NavBar`, never a bare `NavBar`, even when the shared plan
+ shows the pattern without a prefix. In `Modify`, preserve the existing names of controls
+ you are not adding, even when they do not carry the prefix; renaming them breaks every
+ formula that references them.
+- Use exact properties from the screen brief's control definitions.
+- Write the bare control name: `Control: ModernText`, never `Control: [email protected]`.
+ A version suffix on one control makes every property of every other version report as
+ `Unknown property` across the whole app.
+- Copy enum type names verbatim from the `Enum name:` line of the control definition in
+ your brief. They are not derivable from the control name — `Badge.Appearance` is
+ `'BadgeCanvas.Appearance'`, `ModernButton.Appearance` is `ButtonAppearance`, and
+ `ModernDropdown.Appearance` is just `Appearance`. An enum member is never bare:
+ `ThemeColor: =Subtle` fails.
+- Inside a `Gallery` template, `Parent.TemplateWidth` and `Parent.TemplateHeight` resolve
+ only on the gallery's direct child. Use them on the row shell and nowhere else; deeper
+ controls use `FillPortions`, `Parent.Width` or `Parent.Height`.
+- Use exact RGBA values and shared state names from the shared plan.
+- Prefix every property value with `=`. A value without it fails the whole file at parse
+ time and suppresses every other diagnostic in the screen.
+- Quote any value containing a colon followed by a space — `Text: '="Votes: " & n'`, not
+ `Text: ="Votes: " & n`. Caption formatting is the most common cause of
+ `While scanning a plain scalar value, found invalid mapping`.
+- Never write the same property key twice in one `Properties:` block.
+- Use `|-` for multi-line formulas, with the `=` on the first content line.
+- Quote non-formula strings and YAML-sensitive formula values.
+- Prefer the simplest correct formula.
+- Write the file in as few tool calls as possible. Compose the complete screen, then write
+ it with one `Write` or one whole-file `Edit`. Dozens of incremental edits against a
+ file you keep re-reading is the dominant cost in this workflow and does not improve the
+ result.
+- Keep the screen proportionate: roughly 40 controls is the practical ceiling for one
+ screen. If the brief demands substantially more, implement the specification faithfully
+ but say so in your result so the orchestrator can decide whether to split it.
+- Set `AccessibleLabel` on every content and input control as you write it — text,
+ cards, badges, images, icons, buttons and inputs — and `TabIndex: =0` on any gallery a
+ user interacts with. Leave purely decorative controls unlabelled: spacers, background
+ rectangles, divider lines. Nothing downstream adds them for you, and retrofitting them
+ across a screen you have already finished is far more work than writing them in place.
+ Derive the label from the content: `AccessibleLabel: ="Filtered inventory list"`,
+ `AccessibleLabel: '="Quantity on hand for " & ThisItem.Name'`.
+
+## 3. Self-QA
+
+1. Read `${PLUGIN_ROOT}/references/QAChecks.md` **once** and keep it in context. It is a
+ long document; re-reading it between fixes is the largest avoidable cost in this role.
+2. Re-read the target file.
+3. Apply **every** check in order and fix issues inline. Checks are not optional and not
+ sampled: a check you skipped is a defect you shipped, and most of them have no compile
+ diagnostic behind them, so nothing downstream will catch it.
+4. For Modify, scope checks to changed or added content.
+5. Record an outcome for every check by number — `PASS`, `FIXED(n)` or `N/A` — as the
+ "Reporting" section in `${PLUGIN_ROOT}/references/QAChecks.md` describes. Report the
+ line; do not summarise it as a total.
+
+Do not call `compile_canvas`; the orchestrator owns compilation. It compiles as soon as
+the first builder returns, so return promptly rather than polishing indefinitely.
+
+## 4. Return
+
+```markdown
+Screen: [logical name]
+Action: [Create / Modify]
+File: [absolute target file]
+QA: 1 [outcome] · 2 [outcome] · … · 32 [outcome]
+- [fix summary, or "clean"]
Status: Done
-Changes applied: [brief list of what was changed/added]
```
-## Critical Constraints
-
-- **Do NOT call** `describe_control`, `list_controls`, `list_apis`, `list_data_sources`,
- or `compile_canvas`. All context is in the plan document; compilation
- is handled by the orchestrating skill after all builders finish.
-- **Do NOT modify other screens' YAML files.** You own exactly one file.
-- **Use exact values from the plan document** — RGBA values, variable names, control
- property names. Consistency across parallel builders produces a cohesive result.
-- **Do NOT ask questions.** Resolve all ambiguities from the plan document and,
- for Modify actions, the existing YAML file.
+The `QA:` line must list all 32 checks. A return without it is incomplete, and the
+orchestrator will send the screen back.
+
+## Constraints
+
+- Modify exactly one screen file.
+- Never edit `App.pa.yaml` or `_EditorState.pa.yaml`.
+- Never substitute a filename, YAML key, or control name prefix.
+- Never use a property absent from that control's definition.
+- Never write a version suffix on a `Control:` value.
+- Never invent an enum type name, and never write an enum member that starts with a digit
+ unquoted — `DecimalPrecision.'1'`, not `DecimalPrecision.1`.
+- Never leave a `ModernCard` slot unset. For text-only cards set `Image: =Blank()` and,
+ when supported by the control definition, `HeaderImage: =Blank()`.
+- Every multiword ModernButton or link that is a direct child of a vertical AutoLayout
+ container sets `Width: =Parent.Width`; `LayoutMinWidth` and stretch alignment alone do
+ not make the rendered control fill the row.
+- Never pair a light `Color`/`FontColor` with a surface supplied by an `Appearance` or
+ `ThemeColor` enum — set `Fill` or `BasePaletteColor` too.
+- Never write a **new** control name that does not start with your assigned prefix.
+- Do not ask questions; resolve details from the assigned plans.
diff --git a/plugins/canvas-apps/references/ControlGuide.md b/plugins/canvas-apps/references/ControlGuide.md
new file mode 100644
index 000000000..9c8b18713
--- /dev/null
+++ b/plugins/canvas-apps/references/ControlGuide.md
@@ -0,0 +1,402 @@
+# Canvas App YAML — Controls, Properties and Enums
+
+Choosing a control type, and writing properties and enum values that the compiler accepts.
+`describe_control` output is the only authority on which properties a control has.
+
+## Contents
+
+- Discover before you choose
+- Layout containers
+- Data display
+- Selection controls — `ItemDisplayText` is a per-item formula
+- Properties are per-control — never transfer them by analogy
+- Control template versions
+- Enum type names
+- Enum member values
+- Option set values
+- Colour and button-state patterns
+- Timer lifecycle
+- Common property reference
+- Troubleshooting
+
+## Discover before you choose
+
+**⚠️ Required — not optional:** run `list_controls` before planning your layout. Controls
+you don't know exist can't influence your design, and the catalog includes high-level
+controls (`ModernTabList`, `ModernCard`, and others) that are easy to miss and expensive
+to reinvent with primitives. Then run `describe_control` on every type you plan to use.
+
+## Layout containers
+
+| Use Case | Control Type | Variant |
+|----------|--------------|---------|
+| Precise positioning | `GroupContainer` | `ManualLayout` |
+| Horizontal responsive layout | `GroupContainer` | `AutoLayout` with `LayoutDirection: =LayoutDirection.Horizontal` |
+| Vertical responsive layout | `GroupContainer` | `AutoLayout` with `LayoutDirection: =LayoutDirection.Vertical` |
+
+Default to AutoLayout. Use ManualLayout only when the user explicitly requests
+pixel-perfect positioning or the app is a fixed-size desktop dashboard. Mobile and
+cross-device apps MUST use AutoLayout. See `${PLUGIN_ROOT}/references/LayoutGuide.md` for
+the patterns.
+
+⚠️ **`GroupContainer` has no `OnSelect` — it cannot be clicked.** This is a common dead
+end when building card UI: the container lays out perfectly but tapping it does nothing.
+
+- **Clickable cards:** use `ModernCard` instead — it has `OnSelect` and is designed for it.
+- **Clickable non-card areas:** overlay a transparent `Button` or `Rectangle` (both have
+ `OnSelect`) at the same position and size. Set the `Appearance` property to transparent
+ where available; otherwise `Fill: =RGBA(0,0,0,0)` and `BorderThickness: =0`.
+
+⚠️ **`ModernCard` fills unset slots with placeholder content.** It is not an empty
+surface. A card that sets only `Title` renders a large stock photograph above it and the
+literal words `Subtitle` and `Description` below it, and the photo consumes most of the
+card's height — so the value you did set ends up clipped. Nothing about this reaches
+`compile_canvas`.
+
+Set every slot the card displays, and blank the ones you do not want:
+
+```yaml
+- KpiOpenCard:
+ Control: ModernCard
+ Properties:
+ Image: =Blank() # required — otherwise a stock photo appears
+ HeaderImage: =Blank() # when supported — otherwise header artwork can remain
+ Title: =CountRows(colTasks) & ""
+ Subtitle: ="Open tasks"
+ Description: ="Across all projects"
+```
+
+Use only properties returned by `describe_control`; some card versions expose
+`HeaderImage`, `ImageAccessibleLabel` and `HeaderImageAccessibleLabel`. When present,
+blank both image slots for a text-only card and set their accessible labels explicitly.
+Do not compress Title, Subtitle and Description into a short fixed-height KPI card; let
+the card size naturally, reduce the displayed slots, or choose a height that fits them.
+
+When you do want the image, give the card enough `Height` for the image band **plus** the
+text, and remember that a card used as a gallery row template needs the gallery's
+`TemplateSize` to match.
+
+## Data display
+
+| Use Case | Control Type | Key Properties |
+|----------|--------------|----------------|
+| List of items | `Gallery` | Items, TemplateSize, OnSelect |
+| Modern tabular data | `ModernDataGrid` only when its definition can configure columns; otherwise Gallery + header row | Items, Searchable, Sortable, OnChange |
+| Forms | `Form` | DataSource, Item, OnSuccess |
+
+### ModernDataGrid does not need a second search box
+
+`ModernDataGrid.Searchable` renders its own search input. When the screen already has a
+separate search field or filter bar, leave `Searchable` false or unset and bind the grid's
+`Items` to the external filter formula. Two independent search affordances make it
+unclear which filter is active.
+
+`ModernDataGridColumn` properties are version-specific. Copy the current
+`describe_control` definition into the screen brief.
+
+If the current `ModernDataGrid` definition exposes no `Fields`, `Columns`, or supported
+child-column contract, do not create a new grid for a local collection. It can compile
+and still render "There are no fields in this data table." Use an explicit header row
+plus a Gallery row shell and implement sorting through the Gallery `Items` formula.
+
+## Selection controls — `ItemDisplayText` is a per-item formula
+
+`ItemDisplayText` and `ItemKey` on `ModernDropdown`, `ModernCombobox` and similar controls
+are evaluated once per row with `ThisItem` in scope. They take an expression, not a column
+name in quotes:
+
+```yaml
+# WRONG — every option renders the constant string, or renders blank
+Items: =colWorkTypes
+ItemDisplayText: ="Value"
+
+# RIGHT — the option shows that row's Value field
+Items: =colWorkTypes
+ItemDisplayText: =ThisItem.Value
+```
+
+A dropdown whose options all appear empty is almost always this mistake. When `Items` is
+already a single-column table you can omit `ItemDisplayText` entirely.
+
+## Properties are per-control — never transfer them by analogy
+
+Three traps produce most `Unknown property` errors.
+
+### Trap 1 — assuming a styling property is universal
+
+Corner-radius, shadow, and padding properties are **not** available on every control.
+`Rectangle` in particular has **no** radius properties:
+
+```text
+Unknown property 'RadiusTopLeft' for control type 'Rectangle'.
+```
+
+`ModernCard` does not have them either — it exposes a single numeric `BorderRadius`
+instead. For a rounded, filled surface with independent corners use a `GroupContainer`,
+which supports all four `Radius*` properties plus `DropShadow` and the four `Padding*`
+properties.
+
+### Trap 2 — assuming text styling is spelled the same everywhere
+
+The modern React controls and the FluentV9 controls disagree about basic names. This is
+the most common single-property mistake:
+
+| Intent | `ModernText`, `ModernButton`, `ModernDropdown`, `ModernTextInput`, `ModernNumberInput`, `PieChart` | `Badge` | `ModernCard` |
+|--------|---------------------------------------------------------------------------------------------------|---------|--------------|
+| Text color | `Color` | `FontColor` | `TitleColor` / `SubtitleColor` / `DescriptionColor` |
+| Font size | `Size` | `FontSize` | `TitleSize` / `SubtitleSize` / `DescriptionSize` |
+| Displayed string | `Text` | `Content` | `Title` / `Subtitle` / `Description` |
+| Corner rounding | `RadiusTopLeft` … `RadiusBottomRight` | none | `BorderRadius` |
+
+`Progress` is narrower still: no `Fill`, no `Color`, no `Font*`. It is styled through
+`BasePaletteColor` and its three `Progress.*` enums.
+
+`Gallery` has `Fill` but no text properties at all — style the labels inside it, not the
+container.
+
+### Trap 3 — writing a template version on `Control:`
+
+Never write `Control: [email protected]`. Use the bare name that `list_controls` returned.
+
+## Control template versions
+
+Every control type resolves to exactly one template version per app. You do not choose it
+and you do not need to: write the bare control name everywhere and the app stays
+consistent.
+
+Writing an explicit `@version` on even one control breaks that:
+
+```text
+Another instance of control type 'ModernText' has already been referenced using a
+different version '1.0.0'. All control instances for the same type must currently
+reference the same version.
+Control type '[email protected]' has a version that is newer than the current version
+of '1.0.0'. Using the current version, which may produce errors.
+```
+
+"may produce errors" means the app now binds the *older* template, and every property that
+exists only in the newer one is reported as unknown — naming the internal control type,
+not the one you wrote:
+
+```text
+Unknown property 'Color' for control type 'Text'.
+```
+
+Those properties are valid on `ModernText`. Nothing is wrong with them. The only defect is
+the version suffix, and removing every suffix clears the entire cascade in one compile.
+
+- ✅ `Control: ModernText`
+- ❌ `Control: [email protected]`
+- ❌ mixing `Control: Badge` in one file with `Control: [email protected]` in another
+
+## Enum type names
+
+**Never construct an enum type name. Copy it.** `describe_control` prints the exact type
+name on the `Enum name:` line under every enum property. That name is the only correct
+one, and it cannot be derived from the control name:
+
+| Control | Property | `Enum name:` reported by `describe_control` |
+|---------|----------|---------------------------------------------|
+| `ModernDropdown` | `Appearance` | `Appearance` |
+| `ModernTextInput` | `Appearance` | `Appearance` |
+| `ModernNumberInput` | `Appearance` | `Appearance` |
+| `ModernButton` | `Appearance` | `ButtonAppearance` |
+| `Badge` | `Appearance` | `BadgeCanvas.Appearance` |
+| `Badge` | `Shape` | `BadgeCanvas.Shape` |
+| `Badge` | `ThemeColor` | `BadgeCanvas.ThemeColor` |
+| `Progress` | `Shape` | `Progress.Shape` |
+| `Progress` | `Thickness` | `Progress.Thickness` |
+| `ModernNumberInput` | `Precision` | `DecimalPrecision` |
+
+Five controls, one property name, four different enum types. Guessed names like
+`BadgeAppearance`, `DropdownAppearance` or `ProgressBar.ProgressColor` all fail with
+`Name isn't recognized`.
+
+Wrap the enum **name** in `'` whenever it contains a dot, a space, or a special
+character. Then append `.Member`:
+
+```yaml
+# Enum name contains a dot -> quote the name, not the member
+- StatusBadge:
+ Control: Badge
+ Properties:
+ Appearance: ='BadgeCanvas.Appearance'.Tint
+ Shape: ='BadgeCanvas.Shape'.Rounded
+ ThemeColor: ='BadgeCanvas.ThemeColor'.Success
+
+# Plain enum name -> no quoting needed
+- ProjectPicker:
+ Control: ModernDropdown
+ Properties:
+ Appearance: =Appearance.Underline
+```
+
+⚠️ An enum member is never a bare identifier. `ThemeColor: =Subtle` fails with
+`Name isn't recognized` exactly like a wrong type name does. Removing the qualifier is
+never the fix — correcting the qualifier is.
+
+## Enum member values
+
+The **member** obeys a separate quoting rule from the type name, and it is the rule that
+is missed most often.
+
+**A member that starts with a digit must be wrapped in `'`.** `describe_control` reports
+these members bare — `values: 0, 1, 2, 3, 4, 5, Auto` — but that listing is not the
+literal you write:
+
+```yaml
+# WRONG — Power Fx parses `DecimalPrecision`, then hits `.1` and stops
+Precision: =DecimalPrecision.1
+
+# RIGHT
+Precision: =DecimalPrecision.'1'
+```
+
+This is not a `Name isn't recognized` failure. The parser reads the digit as the start of
+a new number, so the property emits **`Expected operator` and `Expected an operand`
+together** — two messages on one property, naming no enum at all. Seven such properties
+produce twenty-one errors that never mention the word "enum".
+
+Every enum whose members are numeric is affected; `DecimalPrecision` is the one you will
+meet most. Whenever a control definition lists members that begin with a digit, write the
+quoted form.
+
+## Option set values
+
+Escape an option set name or value with `'` when it contains spaces or special characters,
+or starts with a number:
+
+```yaml
+# Option set name with a space
+- galItemsGallery:
+ Control: Gallery
+ Properties:
+ Items: =Filter(Accounts, 'Account Status' = 'Account Status'.Active)
+
+# Option set with special characters
+- lblDueDate:
+ Control: ModernText
+ Properties:
+ Text: =ThisItem.DueDate
+ Visible: =ThisItem.Status = 'Status (Assignments)'.Active
+```
+
+## Colour and button-state patterns
+
+```yaml
+# Colour constants
+Fill: =Color.White
+BasePaletteColor: =Color.Blue
+
+# RGBA
+Fill: =RGBA(240, 240, 240, 1)
+FontColor: =RGBA(0, 0, 0, 1)
+
+# Conditional colour
+BasePaletteColor: =If(isActive, Color.Blue, Color.Gray)
+```
+
+Fluent appearances own their surface. `ButtonAppearance.Secondary`, `Outline`, `Subtle`
+and `Transparent` can remain light even when `Fill` is set. Pair those appearances with a
+dark `Color`, or switch to `Primary` and set `BasePaletteColor` for a dark surface. Do not
+assume `Fill` overrides the variant.
+
+```yaml
+Properties:
+ DisplayMode: =If(isDisabled, DisplayMode.Disabled, DisplayMode.Edit)
+ Text: =buttonText
+ OnSelect: |-
+ =If(condition,
+ false, # Guard clause - do nothing
+ Set(variable, value); # Execute logic
+ Set(anotherVar, anotherValue)
+ )
+```
+
+## Timer lifecycle
+
+An automatic Timer needs a start edge after the control exists. If `AutoStart: =false`
+and the `Start` variable is set true before navigation, the timer can remain at its
+initial value until the user clicks it. For timers that gate a workflow:
+
+- Prefer `AutoStart: =true`.
+- On screen entry and on each next-item action, set the running variable false, toggle
+ `Reset`, then set running true.
+- Use `AutoPause: =false` unless manual pause is explicitly required.
+- Display remaining time, not elapsed time:
+ `Text: =If(varTimerFinished, "00:00", Text(Time(0, 0, Max(0, RoundUp((Self.Duration - Self.Value) / 1000, 0))), "mm:ss"))`.
+- Do not use the timer surface as an unlabeled pause button. Add a separate labelled
+ control when pause/resume is required.
+
+`DisplayMode` is inherited. Do not put row action buttons inside a Gallery or container
+set to `DisplayMode.View`; the descendants become disabled even when they look enabled.
+Use `Selectable: =false` to prevent Gallery selection while leaving the Gallery in
+`DisplayMode.Edit`.
+
+`ModernTabList` is for tabs that switch panels within one screen. Do not use its
+`OnChange` to navigate between screens: the selected tab can update while `Navigate`
+does not, leaving the highlight and visible screen out of sync. For cross-screen primary
+navigation, use a row of ModernButtons whose `OnSelect` performs the navigation and whose
+appearance is derived from the current screen.
+
+Semantic controls need their visible value property. `Badge.AccessibleLabel` does not
+replace `Badge.Content`; omitting Content can render placeholder text such as `AB`.
+
+## Common property reference
+
+**Positioning:**
+
+- `X`, `Y` — position (absolute in ManualLayout)
+- `Width`, `Height` — size
+- `Align` — text alignment (horizontal)
+- `VerticalAlign` — text alignment (vertical)
+
+**Styling:**
+
+- `Fill` — background colour (absent on `Badge` and `Progress`)
+- `Color` — text colour on the modern React controls; `Badge` spells it `FontColor`
+- `BasePaletteColor` — theme colour for `Badge`, `Progress`, and the modern inputs
+- `Size` — font size on the modern React controls; `Badge` spells it `FontSize`
+- `FontWeight` — Bold, Semibold, Normal, Lighter
+
+**Behaviour:**
+
+- `DisplayMode` — Edit, View, Disabled
+- `Visible` — boolean visibility
+- `OnSelect` — click handler
+- `OnVisible` — screen load handler
+
+**Layout (AutoLayout):**
+
+- `LayoutDirection` — Horizontal or Vertical
+- `LayoutAlignItems` — Center, Start, End, Stretch
+- `LayoutJustifyContent` — Center, SpaceBetween, Start, End
+- `LayoutGap` — spacing between items
+- `LayoutOverflowY` — vertical overflow (`Scroll` for scrollable containers)
+- `FillPortions` — proportional sizing
+- `PaddingTop/Bottom/Left/Right` — container padding
+
+## Troubleshooting
+
+- **`Unknown property`:** run `describe_control` and use only the properties it returns
+ for that exact control type.
+- **Many `Unknown property` errors naming a control type you never wrote** (e.g. `'Text'`
+ when your YAML says `ModernText`): a template version conflict. Strip every `@version`
+ suffix from every `Control:` value and re-compile.
+- **A property works on one control but not a similar one:** property support is per
+ control type, and the modern React, FluentV9 and Classic families disagree. Check the
+ per-control table above rather than reasoning by analogy.
+- **`Name isn't recognized` on an enum:** the enum type name is wrong. Copy the
+ `Enum name:` line from `describe_control` verbatim; quote it with `'` if it contains a
+ dot. Deleting the qualifier is not a fix.
+- **`Expected operator` AND `Expected an operand` on the same property:** an enum member
+ that starts with a digit was written unquoted. `Precision: =DecimalPrecision.1` must be
+ `Precision: =DecimalPrecision.'1'`. Note that this pair of messages names no enum and is
+ *not* `Name isn't recognized` — see "Enum member values" above.
+- **A `ModernCard` renders a large stock photograph, or the words "Title" / "Subtitle" /
+ "Description":** those slots were left unset. `ModernCard` fills unset slots with
+ placeholder content rather than collapsing them. Set `Image`, `Title`, `Subtitle` and
+ `Description` for every slot the card shows, and set `Image: =Blank()` when the card is
+ meant to be text-only.
+- **Button text is too small:** set `Size` on `ModernButton` — but confirm the font
+ property exists on that control first.
diff --git a/plugins/canvas-apps/references/CreateWorkflow.md b/plugins/canvas-apps/references/CreateWorkflow.md
new file mode 100644
index 000000000..6f7b596c9
--- /dev/null
+++ b/plugins/canvas-apps/references/CreateWorkflow.md
@@ -0,0 +1,72 @@
+# Create Workflow
+
+Use this workflow only when the working directory has no meaningful screen content.
+
+## 1. Read Guidance
+
+Read:
+
+- `${PLUGIN_ROOT}/references/YamlSyntax.md` — file structure, syntax rules, parse-error triage
+- `${PLUGIN_ROOT}/references/ControlGuide.md` — control selection, per-control properties, enums
+- `${PLUGIN_ROOT}/references/LayoutGuide.md` — responsive layout, scrolling, colour contrast
+- `${PLUGIN_ROOT}/references/PowerFxGuide.md` — state, events, named formulas, mock data
+- `${PLUGIN_ROOT}/references/DesignGuide.md` — aesthetic direction and design process
+
+## 2. Design the App
+
+Determine:
+
+- Screen count, purpose, and navigation
+- Controls and layout strategy for each screen
+- Data sources, connectors, collections, or mock data
+- Aesthetic direction with exact RGBA values
+- Target device and users
+
+Use AutoLayout for phone, tablet, multi-device, or unknown targets. ManualLayout is
+acceptable for desktop-only, fixed dashboards.
+
+The landing screen must reuse `[working directory]/Screen1.pa.yaml`; every additional
+screen gets a new file.
+
+## 3. Present the Plan
+
+Use this format:
+
+```markdown
+## Canvas App Plan
+
+### Screens
+| Action | Screen | File | Purpose | Key Controls |
+|--------|--------|------|---------|--------------|
+| Create | [Landing] | Screen1.pa.yaml | [purpose] | [controls] |
+| Create | [Additional] | [Name].pa.yaml | [purpose] | [controls] |
+
+### Data Strategy
+[Data sources, connectors, collections, or mock data]
+
+### Aesthetic Direction
+[Direction and exact RGBA palette]
+```
+
+Wait for user approval. Revise and re-present if requested.
+
+## 4. Invoke the Planner
+
+Invoke the `canvas-app-planner` agent with `Task` and:
+
+```text
+Mode: CREATE
+Working directory: [absolute working directory]
+Plan index: [working directory]/canvas-app-plan.md
+Shared plan: [working directory]/canvas-app-shared.md
+Requirements: [user requirements]
+Approved plan: [full approved plan]
+Target users and device: [stated or inferred]
+```
+
+The planner discovers resources, writes `[working directory]/App.pa.yaml`, the plan index,
+shared plan, and one screen brief per dispatch row. It does not redesign the approved
+plan.
+
+Wait for the planner to finish, then return to **Planned Build Handoff** in the
+`canvas-app` skill.
diff --git a/plugins/canvas-apps/references/DesignGuide.md b/plugins/canvas-apps/references/DesignGuide.md
index f6c099c38..3318cda74 100644
--- a/plugins/canvas-apps/references/DesignGuide.md
+++ b/plugins/canvas-apps/references/DesignGuide.md
@@ -2,6 +2,24 @@
This guide helps create distinctive, production-grade Canvas App screens that avoid generic "AI slop" aesthetics.
+**Who does what.** Discovery tools (`list_controls`, `describe_control`, the data and API
+tools) belong to the orchestrator and the `canvas-app-planner`. A `canvas-screen-builder`
+cannot call them and works from the control definitions recorded in its screen brief.
+Where this guide says "run list_controls", that instruction is addressed to the
+orchestrator and planner.
+
+## Contents
+
+- Design Thinking Process
+- Control, Data Source, and API Discovery
+- Typography and Color
+- Spatial Composition and Layout
+- Interactive States
+- Visual Polish
+- Aesthetic Anti-Patterns
+- Creative Interpretation
+- Design Process Summary
+
## Design Thinking Process
Before generating YAML, understand the context and commit to a BOLD aesthetic direction:
@@ -20,11 +38,11 @@ Key controls that directly expand your design vocabulary:
| Control | What it enables |
|---------|----------------|
-| `ModernCard` | Ready-made card with Title, Subtitle, Description hierarchy, built-in shadow, and `OnSelect` — use this as your card primitive, not `GroupContainer` |
+| `ModernCard` | Ready-made card with Title, Subtitle, Description hierarchy, built-in shadow, and `OnSelect` — use this as your card primitive, not `GroupContainer`. **Set `Image` (or `Image: =Blank()`) and every text slot you display: unset slots render a stock photo and the literal words "Subtitle"/"Description".** |
| `Avatar` | User/entity representation with image, initials fallback, and size variants — no need to fake it with a circle and a label |
| `Badge` | Status indicators, counts, and labels with semantic color variants — replaces ad-hoc colored rectangles with text |
| `Progress` | Linear and circular progress display — replaces manual progress bar constructions |
-| `ModernTabList` | Tab navigation with selection state built in — replaces button rows with manual highlight logic |
+| `ModernTabList` | In-screen tab/panel navigation with selection state built in. Use ModernButtons for navigation between separate screens. |
**The pattern to avoid:** Choosing an aesthetic direction, then reaching for `GroupContainer` + `Label` + `Rectangle` to assemble something that already exists. The controls above are not conveniences — they are fundamentally better starting points with richer built-in behavior and visual consistency.
@@ -40,11 +58,11 @@ the real user experience.
### Typography & Text Hierarchy
- **Control Selection**: When there are multiple controls for the same purpose, and one of them is a "Classic" control, favor the modern controls:
- - Favor `ModernText` over `Label`, `ModernCombobox` over `Classic/ComboBox`, `ModernRadio` over `Classic/Radio`, `Button` or `ModernButton` over `Classic/Button`, `ModernTabList` over building tabs with `Button` or `Toggle`, `ModernTextInput` over `Classic/TextInput`, and so on.
+ - Favor `ModernText` over `Label`, `ModernCombobox` over `Classic/ComboBox`, `ModernRadio` over `Classic/Radio`, `Button` or `ModernButton` over `Classic/Button`, `ModernTabList` for in-screen tabs, `ModernButton` rows for cross-screen navigation, `ModernTextInput` over `Classic/TextInput`, and so on.
- **Font Weight**: Use `ModernText` for headlines with `FontWeight: =FontWeight.Bold` and a large font size. Use `ModernText` with `FontWeight: =FontWeight.Normal` for body content.
- **Size Contrast**: Create dramatic hierarchy with size differences. Headers at 24-32, subheaders at 18-20, body at 14-16.
- **Alignment as Statement**: Mix `Align.Left`, `Align.Center`, `Align.Right` intentionally. Centered text for impact, left-aligned for readability.
-- **Font Properties**: Leverage `Size` / `FontSize`, `FontWeight`, `Align`, `VerticalAlign`, and `FontColor` to create visual interest.
+- **Font Properties**: Leverage `Size`, `FontWeight`, `Align`, `VerticalAlign`, and `Color` to create visual interest. On the modern React controls the text colour property is `Color` and the font size property is `Size` — `FontColor` and `FontSize` exist only on `Badge`. Confirm with `describe_control` rather than assuming.
### Color & Visual Theme
@@ -59,11 +77,16 @@ the real user experience.
- **Layout Strategy Choice**:
- Use `ManualLayout` for precise, pixel-perfect designs
- Use `AutoLayout` for responsive, flexible layouts
+- **Design for the narrowest width you claim to support**: A layout composed at 1440px and never re-checked will clip at 1024px and collapse on a phone. Size layout containers with `Parent.Width` or `FillPortions`, never a literal like `Width: =1120`. Reserve fixed pixel sizes for icons, avatars, and steppers — and keep interactive ones at 44px or larger.
+- **Every horizontal row of more than two controls needs a reflow strategy**: Set `LayoutWrap: =true`, or drive `LayoutDirection` from a width breakpoint, so rows stack instead of squeezing. This is the single most common defect in generated apps and it is invisible at the width you designed at.
+- **The screen root must scroll** whenever it holds a gallery, a form, or more than about three stacked sections: canvas screens do not scroll on their own, so give the root container `LayoutOverflowY: =LayoutOverflow.Scroll` and content below the fold stays reachable on short viewports.
+- **Set foreground wherever you set background**: Text does not inherit a contrasting colour. Every time you choose a container `Fill`, set `Color` on the text inside it — dark-on-dark passes every automated check and is unreadable.
+- **Rows inside a `Gallery` need their own container**: `Gallery` is a Classic control and positions its template children absolutely, so a row authored at desktop width stays at desktop width everywhere. Put one AutoLayout `GroupContainer` in the template and build the row inside it. See `${PLUGIN_ROOT}/references/LayoutGuide.md`.
- **Asymmetry & Breaking Grid**: Don't center everything. Offset elements. Use unexpected positioning.
- **Spacing as Design**: Generous padding creates breathing room. Dense layouts create energy.
- **Layering**: Use multiple `GroupContainer` controls to create visual depth.
- **Scale Variation**: Mix large and small controls. A massive header with tiny supporting text creates drama.
-- **Card UI — use `ModernCard` as the starting point**: For anything that functions as a card, `ModernCard` is the right primitive. `GroupContainer` cannot be clicked and requires workarounds to match what `ModernCard` provides natively — see the Technical Guide for details.
+- **Card UI — use `ModernCard` as the starting point**: For anything that functions as a card, `ModernCard` is the right primitive. `GroupContainer` cannot be clicked and requires workarounds to match what `ModernCard` provides natively — see `${PLUGIN_ROOT}/references/ControlGuide.md` for details.
### Interactive States & Behavior
@@ -75,10 +98,11 @@ the real user experience.
### Visual Details & Polish
-- **DropShadow**: Use `DropShadow.Semilight`, `DropShadow.Regular`, `DropShadow.Heavy` for elevation and depth.
-- **Border Radius**: Use `RadiusTopLeft`, `RadiusTopRight`, `RadiusBottomLeft`, `RadiusBottomRight` intentionally.
+- **DropShadow**: Use `DropShadow.Semilight`, `DropShadow.Regular`, `DropShadow.Heavy` for elevation and depth. Available on `GroupContainer` and `ModernCard`.
+- **Border Radius**: Rounding is spelled differently per control. `GroupContainer` and the modern text/input/button controls use the four corner properties `RadiusTopLeft`, `RadiusTopRight`, `RadiusBottomLeft`, `RadiusBottomRight`. `ModernCard` uses a single numeric `BorderRadius`. `Rectangle` has no rounding at all — use a `GroupContainer` when you need a rounded filled surface. Confirm with `describe_control` before styling.
- **Transparency**: Use RGBA with alpha < 1 for overlays, subtle backgrounds, and layering.
-- **Touch Targets**: Make interactive elements at least 44-48px for mobile.
+- **Touch Targets**: Make interactive elements at least 44px, preferably 48px, for mobile.
+- **Accessible by construction**: Give every content and input control an `AccessibleLabel`, and every interactive gallery a `TabIndex`, while you are designing it. Nothing downstream adds them for you, and retrofitting labels across a finished screen is far more work than writing them in place.
- **Data Visualization**: Use appropriate controls with thoughtful `TemplateSize` and spacing.
## NEVER Use Generic Canvas App Aesthetics
diff --git a/plugins/canvas-apps/references/EditWorkflow.md b/plugins/canvas-apps/references/EditWorkflow.md
new file mode 100644
index 000000000..51e2db65e
--- /dev/null
+++ b/plugins/canvas-apps/references/EditWorkflow.md
@@ -0,0 +1,90 @@
+# Edit Workflow
+
+Use this workflow only when the working directory already has meaningful content.
+
+## 1. Assess Complexity
+
+Read all `.pa.yaml` files in the working directory.
+
+Treat the edit as **simple** only when all are true:
+
+- At most two property mutations in total, across at most two existing controls
+- At most one screen changes
+- No new screen, data source, or connector
+- No structural layout change
+
+Anything else is **complex**.
+
+## 2. Simple Edit
+
+1. Read `${PLUGIN_ROOT}/references/YamlSyntax.md`. Also read
+ `${PLUGIN_ROOT}/references/ControlGuide.md` when the edit touches control properties or
+ enums, and `${PLUGIN_ROOT}/references/LayoutGuide.md` when it touches sizing, scrolling,
+ or colour.
+2. Use `describe_control` before adding a property not already present on that control.
+3. Apply targeted edits directly to the absolute working-directory path.
+4. Read `${PLUGIN_ROOT}/references/ValidationWorkflow.md` and follow it.
+5. Stop after the final summary; do not invoke planner or builder agents.
+
+## 3. Complex Edit Planning
+
+Read:
+
+- `${PLUGIN_ROOT}/references/YamlSyntax.md` — file structure, syntax rules, parse-error triage
+- `${PLUGIN_ROOT}/references/ControlGuide.md` — control selection, per-control properties, enums
+- `${PLUGIN_ROOT}/references/LayoutGuide.md` — responsive layout, scrolling, colour contrast
+- `${PLUGIN_ROOT}/references/PowerFxGuide.md` — state, events, named formulas, mock data
+- `${PLUGIN_ROOT}/references/DesignGuide.md` — aesthetic direction and design process
+
+Determine:
+
+- Screens to modify and exact changes
+- Screens to create
+- Existing palette, layout strategy, variables, and data bindings to preserve
+- New controls, data sources, connectors, or shared state
+- Required changes to `[working directory]/App.pa.yaml`
+
+Present:
+
+```markdown
+## Canvas Edit Plan
+
+### Screens to Modify
+| Action | Screen | File | Summary |
+|--------|--------|------|---------|
+| Modify | [Name] | [Name].pa.yaml | [changes] |
+
+### Screens to Add
+| Action | Screen | File | Purpose |
+|--------|--------|------|---------|
+| Create | [Name] | [Name].pa.yaml | [purpose] |
+
+### App Changes
+[Exact App.pa.yaml changes, or "None"]
+
+### Approach
+[How the edit preserves and extends the current app]
+```
+
+Wait for user approval. Revise and re-present if requested.
+
+## 4. Invoke the Planner
+
+Invoke the `canvas-app-planner` agent with `Task` and:
+
+```text
+Mode: EDIT
+Working directory: [absolute working directory]
+Plan index: [working directory]/canvas-app-plan.md
+Shared plan: [working directory]/canvas-app-shared.md
+Edit requirements: [user requirements]
+Approved plan: [full approved plan]
+Current app state: [palette, variables, layout, screens, controls]
+Synced files: [absolute working-directory paths]
+```
+
+The planner writes the plan index, shared plan, and one screen brief per dispatch row. It
+does not edit any `.pa.yaml` file in EDIT mode.
+
+Wait for the planner to finish, then return to **Planned Build Handoff** in the
+`canvas-app` skill.
diff --git a/plugins/canvas-apps/references/GridLayoutGuide.md b/plugins/canvas-apps/references/GridLayoutGuide.md
new file mode 100644
index 000000000..8f4df824b
--- /dev/null
+++ b/plugins/canvas-apps/references/GridLayoutGuide.md
@@ -0,0 +1,117 @@
+# Canvas App YAML - Responsive GridLayout
+
+Read this guide only when a screen uses `GroupContainer` with
+`Variant: GridLayout`. The planner turns these rules into exact formulas in the screen
+brief; the builder does not read this file.
+
+## Contents
+
+- Core invariants
+- Responsive defaults
+- Cards-only grid pattern
+- Mixed section grid pattern
+- Grid troubleshooting
+
+## Core invariants
+
+1. **Derive layout from size, not state.** Grid columns, rows, gaps and heights must read
+ `App.Width`, `Parent.Width` or `Self.Width` directly. Do not set `varIsMobile`,
+ `varColumns` or similar values in `OnVisible`; Studio and preview can evaluate the
+ layout before that event runs, and the values become stale after a resize.
+2. **Set both axes.** Every GridLayout sets `LayoutGridColumns`,
+ `LayoutGridRows`, `LayoutGridColumnMinWidth` and `LayoutGridRowMinHeight`. A stale or
+ omitted row count can silently force the wrong placement.
+3. **Use one column expression.** Reuse the same breakpoint expression in
+ `LayoutGridColumns`, row-count math, child positions and `Height`. Two almost-identical
+ expressions drift into different layouts.
+4. **Derive height from rows.** For `rows`, row height `h`, gap `g`, and vertical padding
+ `pt`/`pb`, use `Height: =rows * h + Max(rows - 1, 0) * g + pt + pb`.
+5. **Keep grids focused.** Put cards and their section labels in GridLayout. Keep nav,
+ breadcrumb, filters, search and data grids in AutoLayout sections unless the approved
+ design explicitly requires one flat grid.
+6. **Use semantic card controls.** Use `ModernCard` for card cells, not a stretched
+ `GroupContainer`. Set `Image: =Blank()` for text-only cards and set every visible text
+ slot.
+7. **Protect shadows.** Give card grids at least 8px padding on every side where a shadow
+ can render.
+8. **Position consistently.** Auto-flow is fine for a uniform card set. If any child uses
+ `LayoutGridColumnStart`, `LayoutGridColumnEnd`, `LayoutGridRowStart` or
+ `LayoutGridRowEnd`, position every child explicitly; mixing positioned and auto-flow
+ children is unreliable.
+
+## Responsive defaults
+
+Use the approved plan's breakpoints. When none are specified, use these app-level
+defaults:
+
+```powerfx
+cols = If(App.Width < 640, 1, If(App.Width < 1024, 2, 3))
+pad = If(App.Width < 640, 16, 40)
+cardHeight = If(App.Width < 640, 160, 180)
+gap = 16
+```
+
+`640` separates phone layouts from larger widths; `1024` separates tablet from desktop.
+For a reusable nested component, use its available `Parent.Width` instead of `App.Width`.
+
+## Cards-only grid pattern
+
+For three cards:
+
+```yaml
+- [Prefix]CardGrid:
+ Control: GroupContainer
+ Variant: GridLayout
+ Properties:
+ DropShadow: =DropShadow.None
+ FillPortions: =0
+ LayoutGap: =16
+ LayoutGridColumns: =If(App.Width < 640, 1, If(App.Width < 1024, 2, 3))
+ LayoutGridRows: =RoundUp(3 / If(App.Width < 640, 1, If(App.Width < 1024, 2, 3)), 0)
+ LayoutGridRowMinHeight: =If(App.Width < 640, 160, 180)
+ LayoutGridColumnMinWidth: =(Parent.Width - 2 * If(App.Width < 640, 16, 40) - (If(App.Width < 640, 1, If(App.Width < 1024, 2, 3)) - 1) * 16) / If(App.Width < 640, 1, If(App.Width < 1024, 2, 3))
+ PaddingTop: =8
+ PaddingBottom: =48
+ PaddingLeft: =If(App.Width < 640, 16, 40)
+ PaddingRight: =If(App.Width < 640, 16, 40)
+ Height: =RoundUp(3 / If(App.Width < 640, 1, If(App.Width < 1024, 2, 3)), 0) * If(App.Width < 640, 160, 180) + Max(RoundUp(3 / If(App.Width < 640, 1, If(App.Width < 1024, 2, 3)), 0) - 1, 0) * 16 + 8 + 48
+ Width: =Parent.Width
+```
+
+Replace every `3` with the actual card count. Do not change only
+`LayoutGridColumns`; rows and height must change with it.
+
+## Mixed section grid pattern
+
+Use one flat grid only when the approved design requires labelled sections in a single
+GridLayout. Direct children are section-label `ModernText` controls and `ModernCard`
+controls.
+
+- Give every child explicit responsive column and row start/end formulas.
+- Make a section label span the full grid:
+ `LayoutGridColumnStart: =1` and
+ `LayoutGridColumnEnd: =If(App.Width < 640, 2, If(App.Width < 1024, 3, 4))`
+ for a 1/2/3-column grid.
+- For variable visual heights, use fine row tracks. With track height `8` and gap `16`,
+ a child of desired height `height` spans
+ `Round((height + 16) / 24, 0)` tracks. The rendered height is
+ `tracks * 8 + (tracks - 1) * 16`.
+- Walk the fixed child sequence separately at phone, tablet and desktop widths, then
+ write responsive start/end formulas from those positions.
+- Compute `LayoutGridRows` from the last occupied track and derive `Height` from that
+ same value.
+
+This pattern is fragile. The brief must provide the exact positions and formulas; do not
+ask the builder to invent the track map.
+
+## Grid troubleshooting
+
+- **Cards overlap or jump columns:** `LayoutGridRows` does not match the row-count
+ expression, or positioned and auto-flow children were mixed.
+- **Large empty area below the grid:** `Height` uses a larger per-row multiplier than
+ `LayoutGridRowMinHeight`, or adds padding twice.
+- **Card shadows are clipped:** add at least 8px padding on the clipped sides.
+- **Text clips inside a card:** use `AutoHeight: =true`, or set zero vertical text padding
+ and make fixed text height at least `Size * 1.5`.
+- **Grid responds only after navigation:** a layout property depends on a variable set in
+ `OnVisible`; replace it with a direct width expression.
diff --git a/plugins/canvas-apps/references/LayoutGuide.md b/plugins/canvas-apps/references/LayoutGuide.md
new file mode 100644
index 000000000..f65805e22
--- /dev/null
+++ b/plugins/canvas-apps/references/LayoutGuide.md
@@ -0,0 +1,309 @@
+# Canvas App YAML — Layout and Responsive Behaviour
+
+Sizing, positioning, scrolling, and the narrow-width behaviour that decides whether a
+screen works on a phone. The defects in this guide are invisible at the width you author
+and are reported by no compile diagnostic.
+
+## Contents
+
+- Manual layout
+- Auto layout
+- Keep responsive layout out of state
+- Grid layout
+- Galleries are Classic — their rows do not reflow
+- Horizontal rows must reflow at narrow widths
+- Give labelled controls room for their longest value
+- Text colour must be set wherever you set a background
+- Never hard-code a layout width
+- The screen root must be able to scroll
+- Layout rules of thumb
+- Troubleshooting
+
+## Manual layout
+
+For precise control (game boards, fixed dashboards):
+
+```yaml
+- Container:
+ Control: GroupContainer
+ Variant: ManualLayout
+ Properties:
+ X: =100
+ Y: =100
+ Width: =300
+ Height: =300
+ Children:
+ - Button1:
+ Control: Button
+ Properties:
+ X: =0
+ Y: =0
+ Width: =90
+ Height: =90
+```
+
+**Pattern:** calculate positions as `(size * index) + (spacing * index)`.
+
+Responsive expressions work in ManualLayout too:
+
+```yaml
+X: =(Parent.Width - Self.Width) / 2 # Center horizontally
+Width: =Parent.Width # Full width
+Height: =Parent.Height - Self.Y # Fill remaining height
+```
+
+## Auto layout
+
+For flexible, responsive designs:
+
+```yaml
+- Container:
+ Control: GroupContainer
+ Variant: AutoLayout
+ Properties:
+ LayoutDirection: =LayoutDirection.Horizontal
+ LayoutAlignItems: =LayoutAlignItems.Center
+ LayoutJustifyContent: =LayoutJustifyContent.SpaceBetween
+ LayoutGap: =16
+ PaddingTop: =8
+ PaddingBottom: =8
+ Children:
+ - Button1:
+ Properties:
+ FillPortions: =1 # Proportional share of the remaining space
+```
+
+1. **Dynamic gallery height:** `Height: =CountRows(Self.AllItems) * Self.TemplateHeight`
+2. **Container scrolling:** `LayoutOverflowY: =LayoutOverflow.Scroll`
+3. **AutoLayout child properties:** `AlignInContainer`, `FillPortions`,
+ `LayoutMinWidth/Height`, `LayoutMaxWidth/Height`
+4. **Pure AutoLayout:** don't mix ManualLayout inside AutoLayout containers
+5. **`FillPortions` is required for fixed-size children:** every child of an AutoLayout
+ container must set `FillPortions: =0` if it has a fixed `Width`/`Height`. Without it,
+ the container silently overrides the size you set.
+
+## Keep responsive layout out of state
+
+Layout must react to the current size, not to a variable captured during navigation.
+Write breakpoints directly in layout properties:
+
+```yaml
+LayoutDirection: =If(Parent.Width < 640, LayoutDirection.Vertical, LayoutDirection.Horizontal)
+```
+
+Do not set `varIsMobile`, `varColumns`, `varPageWidth` or similar values in `OnVisible`
+and then read them from `Width`, `Height`, grid, visibility or direction properties.
+Studio can render before `OnVisible` runs, and resizing does not re-run the event. Use
+`App.Width` for app-level breakpoints and `Parent.Width` or `Self.Width` for nested
+layout scopes.
+
+## Grid layout
+
+GridLayout needs coordinated column, row and height math; a stale row count can produce a
+valid but visibly wrong screen. When planning a `GroupContainer` with
+`Variant: GridLayout`, use `${PLUGIN_ROOT}/references/GridLayoutGuide.md` and put its exact
+formulas in the screen brief. Builders do not read that conditional reference.
+
+## Galleries are Classic — their rows do not reflow
+
+`Gallery` belongs to the Classic control family. It has no AutoLayout variant, so every
+control placed directly in its template is positioned absolutely with `X`, `Y`, `Width`
+and `Height`. Those coordinates are frozen: the row renders identically at 1440px and at
+390px, so columns run off-screen and controls shrink to unusable sizes on phones.
+
+Give the gallery exactly one child — an AutoLayout `GroupContainer` filling the template —
+and build the row inside it:
+
+```yaml
+- RowGallery:
+ Control: Gallery
+ Variant: Vertical
+ Properties:
+ Items: =colDraftRows
+ TemplateSize: =68
+ Width: =Parent.Width
+ Children:
+ - RowShell:
+ Control: GroupContainer
+ Variant: AutoLayout
+ Properties:
+ LayoutDirection: =LayoutDirection.Horizontal
+ LayoutGap: =8
+ LayoutMinWidth: =0
+ LayoutMinHeight: =0
+ Width: =Parent.TemplateWidth
+ Height: =Parent.TemplateHeight
+ Children:
+ # Row content: size with FillPortions, never with X/Y.
+```
+
+`Parent.TemplateWidth` and `Parent.TemplateHeight` are gallery output properties, so they
+resolve only on a **direct child of the gallery** — the shell container itself. `Parent`
+always means the immediate parent, so deeper inside the row it refers to the shell, not
+the gallery, and `Parent.TemplateWidth` fails with:
+
+```text
+[Control 'X', Property 'Width'] Name isn't recognized: 'TemplateWidth'.
+```
+
+Inside the shell, size children with `FillPortions`, or with `Parent.Width` and
+`Parent.Height`. Use `Parent.TemplateWidth` exactly once per gallery.
+
+## Horizontal rows must reflow at narrow widths
+
+A horizontal AutoLayout row that looks correct at 1440px will, at 390px, either squeeze
+its children to a few pixels, push them off the right edge, or collapse them to zero
+height.
+
+Every horizontal container holding more than two substantive children needs an explicit
+reflow strategy. Pick one:
+
+```yaml
+# 1. Wrap: children flow onto additional lines when they no longer fit.
+LayoutDirection: =LayoutDirection.Horizontal
+LayoutWrap: =true
+
+# 2. Stack: the row becomes a column below a breakpoint.
+LayoutDirection: =If(Parent.Width < 640, LayoutDirection.Vertical, LayoutDirection.Horizontal)
+```
+
+Every property is a formula, so a breakpoint can drive sizing and visibility too:
+
+```yaml
+Width: =If(Parent.Width < 640, Parent.Width, 320)
+Visible: =Parent.Width >= 640
+```
+
+Whichever you choose, keep interactive controls at 44px or larger in both states — a
+stepper that becomes 14x9px is not usable, and a status badge narrower than its own text
+is not readable.
+
+Give multiword actions an explicit width budget. A ModernButton with only
+`AlignInContainer.Stretch` can still render at its small default width. In a vertical
+parent, set `Width: =Parent.Width`; otherwise set a `LayoutMinWidth` that fits the longest
+label. Four-item phone navigation must remain one row or intentionally switch to a
+different mobile navigation pattern—do not wrap one tab onto a second row.
+
+A breakpoint formula is only the start of the check. Evaluate both branches:
+
+- In the horizontal branch, fixed widths/minimum widths plus gaps and padding must fit
+ the available width. If they do not, group label/input pairs or wrap.
+- In the vertical branch, the container height must be the sum of child content, gaps and
+ padding. Do not use `2 * Max(child heights)` for two stacked panels or leave
+ content-sized panels at `FillPortions: =1`; both create large blank regions and can
+ push the next panel far below the expected scroll position.
+- For a row that changes axis inside a gallery, include the minimum content height of
+ nested `FillPortions` children when choosing `TemplateSize`.
+- Keep each visible label and its input/dropdown inside one vertical field container
+ before stacking the row. Separate label and control siblings can reorder visually at a
+ breakpoint and make a Facility label appear beside the Status dropdown.
+
+For fixed-height sections, calculate the complete content budget at every breakpoint:
+child heights, wrapped text lines, gaps and padding. `AutoHeight` does not make its fixed
+parent grow. Avoid parent `Height` formulas that read descendant `.Height` values when
+those descendants also size from the parent; use collection counts and constants
+directly.
+
+Small bounded lists should not create a second hidden scroll region. For a local roster
+of roughly ten or fewer rows inside a scrollable root, set gallery height from
+`CountRows(Self.AllItems) * Self.TemplateSize` and let the root scroll.
+
+## Give labelled controls room for their longest value
+
+A `Badge`, status pill, or KPI value sized for `"New"` clips `"Implemented"`. When such a
+control sits in a horizontal row, set `FillPortions: =0` plus a `Width` (or
+`LayoutMinWidth`) that fits the longest value it can display, and set `Wrap: =false` on
+single-line text so it cannot silently become two lines.
+
+## Text colour must be set wherever you set a background
+
+Text controls do not inherit a contrasting colour from their container. A dark `Fill` with
+an unset `Color` renders near-black text on a near-black surface — technically valid and
+completely unreadable:
+
+```yaml
+# WRONG — dark row, default (dark) text
+Fill: =RGBA(20, 45, 61, 1)
+# ...child ModernText with no Color
+
+# RIGHT — set both together
+Fill: =RGBA(20, 45, 61, 1)
+# ...child ModernText:
+Color: =RGBA(239, 246, 250, 1)
+```
+
+Whenever you choose a container `Fill`, set `Color` explicitly on every text control
+inside it. Do this for gallery rows especially — they are the easiest place to forget and
+the most damaging place to get wrong.
+
+## Never hard-code a layout width
+
+`Width: =1120` on a container renders 1120px wide in a 1024px viewport and clips whatever
+sits on the right. Size layout containers with `=Parent.Width`, or with `FillPortions`
+inside an AutoLayout parent. Reserve fixed pixel sizes for genuinely fixed things: icon
+boxes, avatars, and stepper buttons — and keep those at 44px or larger so they stay
+tappable.
+
+## The screen root must be able to scroll
+
+A canvas screen does not scroll by itself. Content taller than the viewport is simply
+unreachable — there is no browser scrollbar, the wheel does nothing, and the user never
+learns the rest of the screen exists. A layout that fits at 900px tall silently loses its
+gallery and its action buttons on a 390x844 phone.
+
+Give the screen one root AutoLayout container that scrolls:
+
+```yaml
+- [Prefix]Root:
+ Control: GroupContainer
+ Variant: AutoLayout
+ Properties:
+ LayoutDirection: =LayoutDirection.Vertical
+ LayoutOverflowY: =LayoutOverflow.Scroll
+ LayoutMinWidth: =0
+ LayoutMinHeight: =0
+ Width: =Parent.Width
+ Height: =Parent.Height
+```
+
+For a responsive screen, that root must contain every visible section. The screen's
+top-level `Children:` list contains the root and nothing else; a header or panel aligned
+as the root's sibling is outside AutoLayout and can overlap or cover the rest of the
+screen while still compiling cleanly.
+
+A **direct** child of a scroll container must use `FillPortions: =0`, or it is pinned to
+the viewport height and the content is clipped rather than scrolled. Give stacked sections
+explicit heights, or let them size to content.
+
+## Layout rules of thumb
+
+- ✅ AutoLayout for responsive and scrollable screens; ManualLayout only for fixed layouts
+- ✅ `LayoutOverflowY: =LayoutOverflow.Scroll` on scrollable containers
+- ✅ `AutoHeight: =true` on most text labels so they expand with content — or, for
+ deliberately single-line text, so they don't show scrollbars
+- ✅ When text must have a fixed height, set `PaddingTop: =0`, `PaddingBottom: =0` and
+ `Height` to at least `Size * 1.5`; make the containing band tall enough for wrapped text
+- ✅ `LayoutMinWidth: =0` and `LayoutMinHeight: =0` on every `GroupContainer`; the
+ defaults are 250 and 100 and silently push containers wider than intended
+- ❌ Don't mix ManualLayout inside AutoLayout containers
+- ❌ Don't create nested scrollbars
+
+## Troubleshooting
+
+- **Layout doesn't look right:** check whether you are mixing ManualLayout and AutoLayout.
+- **A fixed `Width`/`Height` is ignored:** the control is an AutoLayout child without
+ `FillPortions: =0`.
+- **Content below the fold is unreachable:** the root container is not a scroll container,
+ or its direct child does not set `FillPortions: =0`.
+- **A gallery row is unreadable on a phone:** the row was built directly in the gallery
+ template with `X`/`Y` instead of inside an AutoLayout shell.
+- **`Name isn't recognized: 'LayoutGap'` — or `'PaddingTop'`, `'PaddingBottom'`,
+ `'PaddingLeft'`, `'PaddingRight'` — in a `Height`, `Width`, `X` or `Y` formula:** these
+ are container layout *properties*, not global names, and a bare reference resolves
+ against nothing. Substitute the literal number the container sets, or give the control a
+ static size. There is no `Self.LayoutGap` form to fall back on.
+- **A heading or label is cut off horizontally although its `Text` is complete:** its
+ parent is a vertical AutoLayout using `LayoutAlignItems: =LayoutAlignItems.Start` (or
+ `.Center`/`.End`), which sizes children to their intrinsic width instead of the
+ container width. Set `LayoutAlignItems: =LayoutAlignItems.Stretch` on the container, or
+ `AlignInContainer: =AlignInContainer.Stretch` on the child.
diff --git a/plugins/canvas-apps/references/PlanTemplates.md b/plugins/canvas-apps/references/PlanTemplates.md
index 755103b99..b6743d235 100644
--- a/plugins/canvas-apps/references/PlanTemplates.md
+++ b/plugins/canvas-apps/references/PlanTemplates.md
@@ -1,11 +1,20 @@
-# Canvas App Plan — Document Templates
+# Canvas App Plan Templates
-These templates define the structure for `canvas-app-plan.md`, the single source of truth
-consumed by `canvas-screen-builder` agents. Use the mode-appropriate template below.
+The planner writes three artifact types:
----
+1. `[working directory]/canvas-app-plan.md` — compact orchestration index
+2. `[working directory]/canvas-app-shared.md` — cross-screen conventions
+3. `[working directory]/[target-base].screen-plan.md` — one implementation brief per screen
-## CREATE Mode Plan Structure
+## Contents
+
+- Plan Index — CREATE
+- Plan Index — EDIT
+- Shared Plan
+- Screen Brief — CREATE
+- Screen Brief — MODIFY
+
+## Plan Index — CREATE
```markdown
# Canvas App Plan
@@ -13,172 +22,209 @@ consumed by `canvas-screen-builder` agents. Use the mode-appropriate template be
## Mode
CREATE
-## App Requirements
-[The original user requirements passed to this agent]
+## Requirements
+[Original requirements]
+
+## Requirement Coverage
+| Requirement | Planned affordance | Fidelity |
+|-------------|--------------------|----------|
+| [Concrete noun or interaction from the request] | [Visible control and exact behavior] | Exact / Approximation: [reason] |
## Working Directory
-[The absolute path where .pa.yaml files should be written]
+[absolute working directory]
## Discovery Summary
-- Controls available: [N] — notable: [list of most relevant]
-- Data sources: [names or "none connected"]
-- Connectors: [names or "none connected"]
+- Controls: [relevant controls]
+- Data sources: [used sources or none]
+- Connectors: [used connectors or none]
+
+## Dispatch
+| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
+|--------|--------|-------------|----------|-------------|--------------|
+| Create | [Landing] | [working directory]/Screen1.pa.yaml | Screen1 | [Prefix] | [working directory]/Screen1.screen-plan.md |
+| Create | [Additional] | [working directory]/[Name].pa.yaml | [Name] | [Prefix] | [working directory]/[Name].screen-plan.md |
+```
+
+## Plan Index — EDIT
+
+```markdown
+# Canvas App Plan
-## Data Source Schemas
-[For each data source used in the app, embed the FULL output of get_data_source_schema]
-[Screen builders will reference column names and Power Fx types from here]
-[Omit entirely if no data sources are used]
+## Mode
+EDIT
+
+## Requirements
+[Original edit requirements]
+
+## Requirement Coverage
+| Requirement | Planned affordance | Fidelity |
+|-------------|--------------------|----------|
+| [Concrete noun or interaction from the request] | [Visible control and exact behavior] | Exact / Approximation: [reason] |
-### [DataSourceName]
-[Full get_data_source_schema output]
+## Working Directory
+[absolute working directory]
-## API Details
-[For each connector used in the app, embed the FULL output of describe_api]
-[Screen builders will reference operation names and parameters from here]
-[Omit entirely if no connectors are used]
+## Discovery Summary
+- Existing screens: [names]
+- Layout: [ManualLayout / AutoLayout / mixed]
+- Data sources: [used sources or none]
+
+## Dispatch
+| Action | Screen | Target File | YAML Key | Name Prefix | Screen Brief |
+|--------|--------|-------------|----------|-------------|--------------|
+| Modify | [Existing] | [working directory]/[File].pa.yaml | [existing key] | [Prefix] | [working directory]/[File].screen-plan.md |
+| Create | [New] | [working directory]/[File].pa.yaml | [new key] | [Prefix] | [working directory]/[File].screen-plan.md |
+
+## App Changes
+### Before builders
+[Shared definitions screens bind to — collections, named formulas, app variables, OnStart
+seed data — or "None"]
+### After builders
+[Changes referencing screens that do not exist yet, such as StartScreen — or "None"]
+```
-### [ApiName]
-[Full describe_api output]
+## Shared Plan
-## Screens
-| Screen | File | Purpose | Key Controls |
-|--------|------|---------|--------------|
-| [Name] | [Name].pa.yaml | [description] | [controls] |
+```markdown
+# Canvas App Shared Plan
## Aesthetic Direction
- Palette: [description]
- Primary background: RGBA([...])
-- Accent color: RGBA([...])
+- Accent: RGBA([...])
- Text primary: RGBA([...])
- Text secondary: RGBA([...])
-- Layout strategy: [AutoLayout (Vertical/Horizontal) / ManualLayout + rationale]
-- Typography scale: [header size/weight, body size/weight, caption size]
+- Typography: [scale and weights]
+
+## Layout Strategy
+[Shared layout rules and target-device rationale. Record the breakpoint formulas and the
+rule that responsive properties derive from current width rather than `OnVisible`
+variables.]
+
+## Named State
+[Variables, named formulas, collections, and ownership]
+
+## Control Naming
+[Per-screen name prefixes and the rule that repeated UI blocks are instantiated under
+each screen's own prefix]
+
+## Cross-Screen Contracts
+[Navigation targets and shared state expectations. For repeated navigation blocks, list
+the exact items in order and prohibit extra screen-specific children. Use ModernButtons
+for cross-screen navigation; reserve ModernTabList for panels within one screen.]
+
+## YAML Conventions
+- Formula prefix
+- Multi-line formula syntax
+- String and record-literal quoting
+- Enum escaping
+- App-specific conventions
+```
+
+## Screen Brief — CREATE
-## Named Variables and Shared State
-[App-level variables, named formulas, collection names — so each builder uses consistent names]
-[Example: selectedItem (Record), isLoading (Boolean), appTheme (Record with color fields)]
+```markdown
+# Screen Plan: [Logical Screen]
+
+## Assignment
+- Action: Create
+- Target file: [working directory]/[File].pa.yaml
+- YAML key: [key]
+- Control name prefix: [Prefix]
+
+## Specification
+- Purpose: [description]
+- Layout: [root and child structure. For each fixed-height section and horizontal row
+ with four or more substantive children, include a desktop/narrow/phone budget with
+ child grouping, minimum widths/heights, gaps, padding and resulting section size.]
+- Grid contract: [for each GridLayout, exact columns, rows, column minimum, row minimum,
+ height and child-position formulas; omit when there is no GridLayout]
+- Controls: [prefixed control names and purpose]
+- Column headers: [for any grid or repeated row of inputs, the exact visible header
+ strings — "Mon", "Tue", … . A row of identical unlabelled inputs is unusable, and
+ `AccessibleLabel` is not a substitute for a visible header. Omit if the screen has no
+ repeated input row.]
+- Data binding: [sources, fields and variables; identify small screen-local read-only
+ tables that stay inline in `Items`, versus shared or mutable collections owned by App.
+ For entities with multiple date/status fields, define which field drives each visible
+ view and ensure displayed labels, seed data and filters use that same meaning.]
+- Navigation: [targets and triggers]
+- State: [OnVisible initialization]
+
+## Relevant Data Source Schemas
+[Only the fields this screen reads or writes; omit if none]
+
+## Relevant API Details
+[Only the operations and parameters this screen calls; omit if none]
+
+## Required Variants
+[Control type -> exact variant to use, for every control type whose definition includes a
+Variants section; omit if none]
## Control Definitions
-[For each control type used in the design, embed the FULL output of describe_control]
-[Builders will reference property names from here — do not summarize or abbreviate]
-
-### [ControlTypeName]
-[Full describe_control output]
-
-### [ControlTypeName]
-[Full describe_control output]
-
-## Per-Screen Specifications
-
-### [Screen Name]
-- **File:** [Name].pa.yaml
-- **Purpose:** [description]
-- **Layout:** [VerticalAutoLayout / ManualLayout, root container details]
-- **Key Controls:** [list with purpose of each]
-- **Data Binding:** [variable names, data source references, collection names]
-- **Navigation:** [which screen(s) this navigates to, trigger conditions]
-- **State:** [any local variables set in OnVisible]
-
-### [Screen Name]
-[repeat for each screen]
-
-## TechnicalGuide Key Conventions
-[Embed the most critical YAML syntax rules from TechnicalGuide.md that screen-builders must follow:
-- Formula prefix (= required)
-- Multi-line formula syntax (|- block scalar)
-- String quoting rules
-- Record literal syntax
-- Enum escaping patterns
-- Any patterns specific to this app's control choices]
+[For each control type used on this screen: the complete list of valid input property
+names, plus the full enum name for each enum property this screen sets. Not the whole
+describe_control response.
+
+Give each enum property the **compile-ready literal**, not a list of members. Write
+`Precision: =DecimalPrecision.'1'`, never `Enum name: DecimalPrecision; values: 0, 1, 2`.
+A member list is transcribed literally by the builder and a member starting with a digit
+then fails to compile.]
+
+## Literal Seed Data
+[Every fixed literal the builder must type out: `Items` for a dropdown that is not bound
+to a collection, `Default` values, static option lists, seeded names.
+
+Write the values themselves. The builder has no discovery tools, cannot read
+`App.pa.yaml`, and cannot resolve a description like "the six seeded speaker names" —
+it will return `Status: Blocked` and cost a full replan round-trip. Omit this section only
+when the screen binds entirely to named collections.]
```
----
-
-## EDIT Mode Plan Structure
+## Screen Brief — MODIFY
```markdown
-# Canvas App Plan
+# Screen Plan: [Logical Screen]
-## Mode
-EDIT
+## Assignment
+- Action: Modify
+- Target file: [working directory]/[File].pa.yaml
+- YAML key: [existing key]
+- Control name prefix: [Prefix]
-## Edit Requirements
-[The original user edit requirements passed to this agent]
+## Current State
+[Concise summary of relevant existing controls and layout]
-## Working Directory
-[The absolute path where .pa.yaml files are located]
-
-## Current App Summary
-- Screens: [list each screen with brief description]
-- Layout strategy: [ManualLayout / AutoLayout / mixed]
-- Current palette:
- - Background: RGBA([...])
- - Accent: RGBA([...])
- - Text primary: RGBA([...])
- - Text secondary: RGBA([...])
-- Variables in use: [list variable names and types]
-- Data sources: [names or "none connected"]
-
-## Screens to Modify
-| Screen | File | Summary of Changes |
-|--------|------|--------------------|
-| [Name] | [Name].pa.yaml | [description] |
-
-## Screens to Add
-| Screen | File | Purpose |
-|--------|------|---------|
-| [Name] | [Name].pa.yaml | [description] |
-(omit this section if no new screens)
-
-## Data Source Schemas
-[For each data source involved in the edit, embed the FULL output of get_data_source_schema]
-[Editors will reference column names and Power Fx types from here]
-[Omit entirely if no data sources are involved]
-
-### [DataSourceName]
-[Full get_data_source_schema output]
-
-## API Details
-[For each connector involved in the edit, embed the FULL output of describe_api]
-[Editors will reference operation names and parameters from here]
-[Omit entirely if no connectors are involved]
-
-### [ApiName]
-[Full describe_api output]
+## Changes
+1. [Exact required change]
-## Control Definitions
-[For each NEW control type not already in the existing app, embed the FULL output of describe_control]
-[Editors will reference property names from here — do not summarize or abbreviate]
-[Omit entirely if no new control types are being added]
-
-### [ControlTypeName]
-[Full describe_control output]
-
-## Per-Screen Edit Specifications
-
-### [Screen Name] (Existing)
-- **File:** [Name].pa.yaml
-- **Current State:** [brief summary of what the screen currently contains]
-- **Changes Required:** [specific numbered list of changes to apply]
-- **Controls to Add:** [control name, type, properties — or "none"]
-- **Controls to Remove:** [control name — or "none"]
-- **Properties to Update:** [control name → property name → new value]
-
-### [Screen Name] (New)
-- **File:** [Name].pa.yaml
-- **Purpose:** [description]
-- **Layout:** [VerticalAutoLayout / ManualLayout, root container details]
-- **Key Controls:** [list with purpose of each]
-- **Data Binding:** [variable names, data source references, collection names]
-- **Navigation:** [which screen(s) this navigates to, trigger conditions]
-- **State:** [any local variables set in OnVisible]
-
-## TechnicalGuide Key Conventions
-[Embed the most critical YAML syntax rules from TechnicalGuide.md that screen-editors must follow:
-- Formula prefix (= required)
-- Multi-line formula syntax (|- block scalar)
-- String quoting rules
-- Record literal syntax
-- Enum escaping patterns
-- Any patterns specific to controls used in this edit]
+## Controls to Add
+[Name, type, placement, properties; or "None"]
+
+## Controls to Remove
+[Names; or "None"]
+
+## Properties to Update
+[Control -> property -> exact value; or "None"]
+
+## Relevant Data Source Schemas
+[Only the fields this edit reads or writes; omit if none]
+
+## Relevant API Details
+[Only the operations this edit calls; omit if none]
+
+## Required Variants
+[Control type -> exact variant, for any control this edit adds whose definition includes a
+Variants section; omit if none]
+
+## Changed or Added Control Definitions
+[For each control type receiving a new property, enum, or variant — including types
+already present in the app: valid input property names, plus the full enum name and
+compile-ready literal for each enum property this edit sets. Write
+`Precision: =DecimalPrecision.'1'`, not a bare member list; omit if none]
+
+## Literal Seed Data
+[Every fixed literal this edit introduces or changes: dropdown `Items` not bound to a
+collection, `Default` values, static option lists, seeded names. Write the exact values,
+not a description of them; omit if none]
```
diff --git a/plugins/canvas-apps/references/PowerFxGuide.md b/plugins/canvas-apps/references/PowerFxGuide.md
new file mode 100644
index 000000000..c46d3e8cb
--- /dev/null
+++ b/plugins/canvas-apps/references/PowerFxGuide.md
@@ -0,0 +1,240 @@
+# Canvas App YAML — Power Fx Formulas, Events and Data
+
+Formula patterns for state, events, reusable logic, and mock data.
+
+## Contents
+
+- State management
+- Conditional logic
+- String operations
+- Date and time formatting
+- Event handling
+- Named formulas and user defined functions
+- Mock data collections
+- Formula rules of thumb
+- Troubleshooting
+
+## State management
+
+```yaml
+# Initialize variables on screen load
+OnVisible: |-
+ =Set(variable1, "initial value");
+ Set(variable2, 0);
+ Set(variable3, false)
+
+# Update state on interaction
+OnSelect: |-
+ =Set(counter, counter + 1);
+ Set(status, "updated")
+```
+
+`Set()` creates app-wide variables; `UpdateContext()` creates screen-scoped ones. A value
+that resets on navigation was created with `UpdateContext`; a value that unexpectedly
+persists across screens was created with `Set`.
+
+## Conditional logic
+
+```yaml
+# Simple conditional
+Text: =If(isActive, "Active", "Inactive")
+
+# Nested conditionals
+Text: =If(status = "complete",
+ "Done!",
+ If(status = "pending",
+ "In Progress",
+ "Not Started"))
+
+# Boolean expressions
+Visible: =isEnabled && !isHidden
+DisplayMode: =If(gameOver || alreadyPlayed, DisplayMode.Disabled, DisplayMode.Edit)
+```
+
+## String operations
+
+```yaml
+# Concatenation
+Text: =firstName & " " & lastName
+
+# Not equal (empty string)
+Visible: =searchText <> ""
+
+# Equal (case-sensitive)
+Visible: =selectedOption = "Option1"
+```
+
+Any value containing `: ` must be quoted at the YAML level — see
+`${PLUGIN_ROOT}/references/YamlSyntax.md`.
+
+## Date and time formatting
+
+Format specifiers are lower case (`mm` for month, not `MM`):
+
+```yaml
+# "dddd, mmmm d, yyyy" -> "Monday, January 1, 2024"
+Text: =Text(varDate, "dddd, mmmm d, yyyy")
+
+# "hh:mm:ss" -> "14:30:00"
+Text: =Text(Now(), "hh:mm:ss")
+```
+
+## Event handling
+
+### Guard clauses
+
+```yaml
+OnSelect: |-
+ =If(gameOver || pos1 <> "",
+ false, # Do nothing if condition met
+ Set(pos1, currentPlayer); # Otherwise execute logic
+ UpdateGameState()
+ )
+```
+
+### Sequential operations
+
+```yaml
+OnSelect: |-
+ =Set(pos1, currentPlayer);
+ Set(gameOver, CheckWinCondition());
+ Set(currentPlayer, If(currentPlayer = "X", "O", "X"))
+```
+
+### Confirm the action and clear the state that caused it
+
+An action that changes data must say so, and must leave the form in a clean state. Two
+defects show up constantly in generated apps: a quantity silently changes with no
+acknowledgement, and a validation message stays on screen after the record it complained
+about was successfully saved.
+
+```yaml
+OnSelect: |-
+ =Patch(colInventory, ThisItem, {Quantity: ThisItem.Quantity - varAdjustBy});
+ Notify("Issued " & varAdjustBy & " units", NotificationType.Success);
+ Set(varAdjustBy, 0);
+ Set(varShowValidation, false)
+```
+
+- Use `Notify(...)` or a transient in-screen message after every create, update, or delete.
+- Reset the inputs and the flags that drove validation in the same handler.
+- Gate validation text on a variable you clear on success, not on the raw field value.
+- After a failed submit shows validation, clear that flag from every relevant input's
+ `OnChange`, or keep the message visible only while the required fields remain invalid.
+ An error must not remain visible once the user has corrected all fields.
+
+### Toggle once, report the same next value
+
+Do not mutate a record and then inspect that same `ThisItem` to infer what happened.
+Compute the next value once and use it for both the write and the confirmation:
+
+```yaml
+OnSelect: |-
+ =Set(varNextCheckedIn, !ThisItem.CheckedIn);
+ Patch(colMembers, ThisItem, {CheckedIn: varNextCheckedIn});
+ Notify(
+ ThisItem.Name & If(varNextCheckedIn, " checked in", " marked not ready"),
+ NotificationType.Success
+ )
+```
+
+## Named formulas and user defined functions
+
+Define reusable logic in `App.Formulas` — constants, complex calculations, and anything
+shared across controls or screens.
+
+```yaml
+App:
+ Properties:
+ Formulas: |-
+ =// Named constants
+ MaxItems = 100;
+ ColorPrimary = RGBA(52, 120, 246, 1);
+
+ // Functions with parameters
+ GetStatusColor(status: Text): Color =
+ If(
+ status = "complete", Color.Green,
+ status = "pending", Color.Yellow,
+ Color.Gray
+ );
+
+ TogglePlayer(current: Text): Text =
+ If(current = "X", "O", "X");
+```
+
+## Mock data collections
+
+When an app references external data that is not yet connected, populate collections with
+`ClearCollect` in `App.OnStart`.
+
+For a small, read-only table used by only one control, keep it local instead:
+
+```yaml
+Items: |-
+ =Table(
+ {Title: "Draft"},
+ {Title: "Review"},
+ {Title: "Publish"}
+ )
+```
+
+Use an `App.OnStart` collection when several screens share the records or interactions
+add, edit or remove rows. Never `ClearCollect` fixed display data in a screen's
+`OnVisible`; that couples rendering to navigation and reruns the seed every visit.
+
+**Keep mock data compact.** `App.OnStart` runs before the first screen paints and its
+entire text is serialized into the saved app, so oversized seed data slows startup and
+bloats the document.
+
+- ✅ 5–8 rows per collection — enough to make galleries, filters, and empty states look real
+- ✅ Descriptions of one short sentence (roughly 60–100 characters)
+- ❌ Paragraph-length prose per row
+- ❌ Dozens of rows to "look full" — a gallery reads the same with 6 rows
+
+If a screen needs more variety, vary the field values, not the row count.
+
+The collection schemas defined here resolve app-wide, so a single wrong field name in
+`App.pa.yaml` fails every screen that binds to it. Compile `App.pa.yaml` on its own before
+any screen is written.
+
+## Formula rules of thumb
+
+- ✅ Initialize screen interaction state in `OnVisible` and app-wide state in
+ `App.OnStart`
+- ✅ Derive responsive layout directly from current width
+- ✅ Use descriptive variable names
+- ✅ Keep state updates sequential with semicolons
+- ✅ Use guard clauses to prevent invalid operations
+- ✅ Keep formulas readable with proper indentation
+- ❌ Don't create deeply nested `If` statements
+- ❌ Don't store breakpoints, column counts or page widths in variables
+- ❌ Never call `Navigate` from `App.OnStart` or the start screen's `OnVisible`
+
+## Troubleshooting
+
+- **Formula doesn't update the UI:** the value is not stored in a variable — use `Set()`.
+- **A variable resets when you navigate:** it was created with `UpdateContext` where you
+ needed `Set`. A value that unexpectedly persists is the reverse.
+- **Dozens of unrelated `Name isn't valid` or `'.' operator cannot be used on Error
+ values` errors:** almost always cascading from an `App.pa.yaml` failure. Fix `App`
+ first, then re-compile.
+- **`Navigate is not permitted in OnStart`:** set `App.StartScreen` instead.
+- **`No type found for variable 'x'. Ensure that it is Set to a non-Blank value
+ somewhere in the app.`:** you wrote `Set(x, Blank())` — or seeded a mock collection
+ column with `Blank()` and nothing else. Power Fx infers a variable's type from the
+ values assigned to it, and `Blank()` carries no type. An empty string (`""`) is a
+ typed Text value and does not cause this error. Seed the variable with a typed literal,
+ or set it from real data after the collection exists:
+
+ ```powerfx
+ // WRONG — no type to infer
+ Set(varSelectedTask, Blank());
+
+ // RIGHT — the record type comes from the collection
+ ClearCollect(colTasks, {Id: 1, Title: "Draft agenda", Hours: 2});
+ Set(varSelectedTask, First(colTasks));
+ ```
+
+ When the variable genuinely starts empty, still type it first and clear it after:
+ `Set(varSelectedTask, First(colTasks)); Set(varSelectedTask, Blank());`
diff --git a/plugins/canvas-apps/references/QAChecks.md b/plugins/canvas-apps/references/QAChecks.md
index 7669a6595..fff80befe 100644
--- a/plugins/canvas-apps/references/QAChecks.md
+++ b/plugins/canvas-apps/references/QAChecks.md
@@ -2,36 +2,303 @@
This guide lists runtime layout issues that `compile_canvas` does NOT catch. The
compiler validates syntax and property names. It cannot tell you that your
-scrollable container will never scroll, or that a transparent overlay button
-will collapse its siblings to zero height.
+scrollable container will never scroll, that a transparent overlay button
+will collapse its siblings to zero height, that a gallery row is frozen at desktop
+width, or that a dropdown will render every option blank.
+
+## Contents
+
+- How to run the checks
+
+**Run first — these invalidate the whole file or the whole compile:**
+
+- Check 1 — `@version` suffix on a `Control:` value
+- Check 2 — property value without the `=` prefix
+- Check 3 — same property key twice in one `Properties:` block
+- Check 4 — enum qualifier or member written incorrectly
+- Check 5 — control that declares variants written without one
+
+**Then, in order:**
+
+- Check 6 — `LayoutMinWidth` / `LayoutMinHeight` on every `GroupContainer`
+- Check 7 — container `LayoutAlignItems` and child `AlignInContainer`
+- Check 8 — missing `FillPortions` on an AutoLayout child
+- Check 9 — `FillPortions: =1` inside a scroll container
+- Check 10 — single-line label without `Wrap: =false`
+- Check 11 — `FillPortions: =0` without an explicit `Height`
+- Check 12 — `ModernText` / `Label` padding defaults to 5
+- Check 13 — `FillPortions` and `Height` both set
+- Check 14 — `FillPortions` and `Width` both set
+- Check 15 — absolutely positioned gallery rows
+- Check 16 — hard-coded pixel width on a layout container
+- Check 17 — quoted column name instead of a per-item formula
+- Check 18 — control with no `AccessibleLabel`
+- Check 19 — horizontal row with no narrow-width strategy
+- Check 20 — screen content taller than the viewport cannot be reached
+- Check 21 — text colour not set against a coloured background
+- Check 22 — light foreground on a variant-supplied surface
+- Check 23 — `ModernCard` slot left unset
+- Check 24 — gallery `TemplateSize` smaller than its row template
+- Check 25 — GridLayout axes, row count or height disagree
+- Check 26 — duplicate search UI around `ModernDataGrid`
+- Check 27 — responsive screen content outside its root container
+- Check 28 — timer has no automatic start/reset edge
+- Check 29 — interactive control under a read-only ancestor
+- Check 30 — small bounded gallery hidden in nested scrolling
+- Check 31 — semantic display control missing its visible value binding
+- Check 32 — multiword action label does not fit its control
Agents that write `.pa.yaml` files MUST run these checks against their own
-output before returning, and fix every issue inline. Report the total number of
-fixes applied in the result summary.
+output before returning, and fix every issue inline. Report the outcome of
+**every** check by number in the result summary, as described below.
---
## How to run the checks
1. Read the `.pa.yaml` file you just wrote
-2. Apply each check below in order
+2. Apply the checks in order. Checks 1-5 come first because each one invalidates the
+ whole file or the whole compile, and the flood of misleading diagnostics that follows
+ hides every other problem
3. For every issue found: apply the fix directly using `Edit`
-4. Track the count and a one-line description of each fix
-5. Do NOT re-run `compile_canvas` here — the orchestrating skill does that
+4. Record an outcome for **every** check, by number — not a total
+5. Do NOT re-run `compile_canvas` here — the orchestrator does that
All checks are safe: they tighten existing YAML, never delete semantic content.
+### Reporting
+
+A count of fixes is not evidence that a check ran. Report one line per check, using
+exactly these outcomes:
+
+```text
+QA: 1 PASS · 2 PASS · 3 PASS · 4 FIXED(7) · 5 PASS · 6 FIXED(2) · 7 FIXED(30) ·
+ 8 PASS · 9 PASS · 10 PASS · 11 PASS · 12 PASS · 13 PASS · 14 PASS · 15 PASS ·
+ 16 PASS · 17 PASS · 18 FIXED(4) · 19 PASS · 20 PASS · 21 PASS · 22 FIXED(3) ·
+ 23 FIXED(4) · 24 PASS · 25 N/A · 26 N/A · 27 PASS · 28 N/A · 29 PASS ·
+ 30 N/A · 31 PASS · 32 PASS
+```
+
+- `PASS` — you inspected every control the check applies to and found nothing.
+- `FIXED(n)` — you found and repaired `n` occurrences.
+- `N/A` — the construct the check targets does not appear on this screen (no gallery, no
+ `ModernCard`). Use this honestly; it is not a synonym for "did not check".
+
+Checks 7, 18 and 21 apply frequently, but their outcomes still depend on the file:
+
+- Check 7 is `N/A` when the changed scope has no children of an AutoLayout container.
+- Check 18 is `N/A` when the changed scope contains only decorative controls.
+- Check 21 is `N/A` when the changed scope has no non-default coloured surface.
+- Check 27 is `N/A` only when the brief explicitly requires fixed ManualLayout with
+ deliberate screen-level overlays.
+
+`PASS` is valid when every applicable control was inspected and no defect was found.
+Never infer that a check was skipped solely from the number of controls on the screen.
+
+---
+
+## Check 1 — CONTROL-VERSION-SUFFIX (`Control:` value contains `@version`)
+
+**Problem:** Every control type resolves to exactly one template version per app. A single
+`Control: [email protected]` anywhere in the app pins every `ModernText` instance to one
+version and reports every property belonging to the other version as unknown:
+
+```text
+Another instance of control type 'ModernText' has already been referenced using a
+different version '1.0.0'.
+Unknown property 'Color' for control type 'Text'.
+Unknown property 'FontWeight' for control type 'Text'.
+```
+
+Those properties are valid. Nothing is wrong with them. One stray suffix can produce
+hundreds of phantom diagnostics, and they name an internal control type (`'Text'`) that
+appears nowhere in the YAML — so they are extremely hard to diagnose after the fact. This
+check is cheap; run it first.
+
+**Detect:** For every `Control:` property, flag any value that contains an `@` character
+(e.g. `Control: [email protected]`).
+
+**Fix:** Strip the `@…` suffix, keeping only the bare control name (`Control: Text`).
+
+**Exception:** None. Always use the bare name that `list_controls` returned.
+
+---
+
+## Check 2 — MISSING-FORMULA-PREFIX (property value without `=`)
+
+**Problem:** Every `.pa.yaml` property value is a Power Fx expression. A value without the
+`=` prefix fails the whole file at parse time, and a file that does not parse reports no
+other diagnostics — so this one mistake hides every other problem in the screen:
+
+```text
+An error occurred while parsing PaYaml. Error code: YamlInvalidSyntax;
+Reason: Power Fx expressions must start with '='.
+```
+
+**Detect:** For every entry under a `Properties:` mapping, check that the value starts
+with `=`, or is a `|-` block whose first content line starts with `=`. Flag bare literals
+such as `Text: Weekly Timesheet`, `Width: 320`, or `Visible: true`.
+
+**Fix:** Add the `=` prefix, quoting literal text:
+
+```yaml
+# Before:
+Text: Weekly Timesheet
+Width: 320
+# After:
+Text: ="Weekly Timesheet"
+Width: =320
+```
+
+Then check the same values for a colon followed by a space. Any plain scalar containing
+`: ` breaks the parser with
+`While scanning a plain scalar value, found invalid mapping` — this includes ordinary
+caption formatting, not just record literals:
+
+```yaml
+# Before:
+Text: ="Location: " & ThisItem.Location
+Default: ={Value: "Tab1"}
+# After:
+Text: '="Location: " & ThisItem.Location'
+Default: '={Value: "Tab1"}'
+```
+
+**Exception:** Structural keys (`Control:`, `Variant:`, `Children:`, control names) are
+not Power Fx and take no `=`.
+
+---
+
+## Check 3 — DUPLICATE-PROPERTY-KEY (same key twice in one `Properties:` block)
+
+**Problem:** YAML rejects the whole file, and because it is a parse failure no other
+diagnostic in that screen is reported:
+
+```text
+Reason: Duplicate name 'LayoutMinWidth' used at Scalar [...].
+First use is located at PaYamlLocation { Line = 119, Column = 31 }.
+```
+
+It happens most often after editing a control twice — appending `LayoutMinWidth`,
+`FillPortions` or `AlignInContainer` that were already set higher up in the same block.
+
+**Detect:** For every `Properties:` mapping, check that no key appears twice.
+
+**Fix:** Keep the intended value and delete the other occurrence. The message reports the
+first use's line and column — go there directly.
+
---
-## Check 1 — LayoutMinWidth / LayoutMinHeight on every AutoLayout child
+## Check 4 — ENUM-LITERAL (enum qualifier or member written incorrectly)
+
+An enum literal has two parts and each fails differently. Check both.
+
+### 4a — the qualifier
+
+**Problem:** Enum type names cannot be derived from control names, and a guessed name
+fails with `Name isn't recognized`. The same property name maps to different enum types on
+different controls:
+
+| Control | Property | Correct enum name |
+|---------|----------|-------------------|
+| `ModernDropdown` / `ModernTextInput` / `ModernNumberInput` | `Appearance` | `Appearance` |
+| `ModernButton` | `Appearance` | `ButtonAppearance` |
+| `Badge` | `Appearance` / `Shape` / `ThemeColor` | `BadgeCanvas.Appearance` / `BadgeCanvas.Shape` / `BadgeCanvas.ThemeColor` |
+| `Progress` | `Shape` / `Thickness` / `ProgressColor` | `Progress.Shape` / `Progress.Thickness` / `Progress.ProgressColor` |
+
+**Detect:** For every property you set to an enum value, find that property in the control
+definition in your screen brief and compare your qualifier against its `Enum name:` line.
+Flag any mismatch, and flag any bare value such as `ThemeColor: =Subtle`.
+
+**Fix:** Use the `Enum name:` verbatim, wrapped in `'` when it contains a dot or a space:
+
+```yaml
+# Before:
+Appearance: ='BadgeAppearance'.Tint
+ThemeColor: =Subtle
+# After:
+Appearance: ='BadgeCanvas.Appearance'.Tint
+ThemeColor: ='BadgeCanvas.ThemeColor'.Subtle
+```
+
+**Exception:** None. Never remove the qualifier to "fix" an unrecognized enum name — a
+bare member name fails the same way.
+
+### 4b — the member
+
+**Problem:** An enum member that is not a valid unquoted Power Fx identifier must be
+quoted. The most common case is a member that starts with a digit. The control definition
+in your brief lists numeric members bare (`values: 0, 1, 2, 3, 4, 5, Auto`), but that
+listing is not the literal you write. Unquoted, Power Fx reads the digit as the start of a
+new number:
+
+```text
+[Control 'HoursInput', Property 'Precision'] Expected operator.
+[Control 'HoursInput', Property 'Precision'] Expected an operand.
+```
+
+Two messages, one property, and **neither says `Name isn't recognized` or mentions an
+enum** — which is why this is routinely misread as a formula bug. Seven such properties
+produce twenty-one errors.
+
+**Detect:** For every enum property you set, inspect the member after the `.`. Wrap it in
+`'` when it starts with a digit or contains spaces or other characters that prevent it
+from being used as an unquoted identifier.
+
+**Fix:**
+
+```yaml
+# Before:
+Precision: =DecimalPrecision.1
+# After:
+Precision: =DecimalPrecision.'1'
+
+# A member containing a space must also stay quoted:
+Font: =Font.'Open Sans'
+```
+
+**Exception:** A simple identifier such as `Rounded` does not need member quotes:
+`'BadgeCanvas.Shape'.Rounded`. Do not remove required quotes from members such as
+`'Open Sans'` merely because they start with a letter.
+
+---
+
+## Check 5 — MISSING-VARIANT (control that declares variants written without one)
+
+**Problem:** A control whose template declares variants has no default. Omitting the key
+fails the whole compile with a message that names neither file nor control:
+
+```text
+The keyword 'Variant' is required but is missing or empty.
+```
+
+**Detect:** For every `Control: GroupContainer` and `Control: Gallery` — and any control
+whose definition in your brief includes a `Variants` section — check that a sibling
+`Variant:` key is present and non-empty.
+
+**Fix:** Add the variant that matches the intent:
+
+```yaml
+- [Prefix]Row:
+ Control: GroupContainer
+ Variant: AutoLayout # AutoLayout | GridLayout | ManualLayout
+
+- [Prefix]List:
+ Control: Gallery
+ Variant: Vertical # Vertical | Horizontal | VariableHeight
+```
+
+**Exception:** Controls with no `Variants` section take no `Variant` key.
+
+---
+
+## Check 6 — LayoutMinWidth / LayoutMinHeight on every GroupContainer
**Problem:** Power Apps defaults `LayoutMinWidth` to 250 and `LayoutMinHeight` to
-100 on children of an AutoLayout `GroupContainer` (any container that sets
-`LayoutDirection`). In a sidebar, header, or narrow cell, these defaults
-silently push the child wider/taller than intended and clip its siblings.
+100 on `GroupContainer`. In a sidebar, header, or narrow cell, these defaults
+silently push the container wider/taller than intended and clip siblings.
-**Detect:** For every control whose parent has a `LayoutDirection` property
-(i.e., it is a child of an AutoLayout `GroupContainer`), check whether
+**Detect:** For every control with `Control: GroupContainer`, check whether
`LayoutMinWidth: =0` and `LayoutMinHeight: =0` are present in `Properties:`.
**Fix:** Add either property if missing:
@@ -41,12 +308,39 @@ LayoutMinWidth: =0
LayoutMinHeight: =0
```
-**Exception:** None. Always set both on every child of an AutoLayout
-`GroupContainer`.
+**Exception:** None. Always set both on every GroupContainer.
---
-## Check 2 — AlignInContainer on every AutoLayout child
+## Check 7 — CROSS-AXIS-ALIGNMENT (container `LayoutAlignItems` and child `AlignInContainer`)
+
+Cross-axis sizing is decided in two places. Check the container first — one container fix
+replaces a fix on every one of its children.
+
+### 7a — the container
+
+**Problem:** A container whose `LayoutAlignItems` is `Start`, `Center` or `End` sizes each
+child to its **intrinsic** cross-axis dimension instead of the container's. In a vertical
+container that means text is laid out at some default width and everything past it is
+**clipped, not wrapped** — a heading reading `"PROJECT PULSE"` renders as `PROJECT`, and
+`="Estimated budget $" & Text(total)` renders as `Estimated budget` with the figure gone.
+`compile_canvas` sees nothing wrong: the `Text` formula is perfectly valid.
+
+**Detect:** For every container with `LayoutDirection: =LayoutDirection.Vertical`, read its
+`LayoutAlignItems`. If it is `Start`, `Center` or `End` and any descendant is a text
+control whose content can be long, flag it.
+
+**Fix:** Use `Stretch` on the container:
+
+```yaml
+LayoutDirection: =LayoutDirection.Vertical
+LayoutAlignItems: =LayoutAlignItems.Stretch
+```
+
+**Exception:** A vertical container holding only fixed-size chrome — icons, avatars,
+steppers — may keep `Center`. Text panels, headings, form fields and card bodies may not.
+
+### 7b — the child
**Problem:** Children of an AutoLayout container (any container that sets
`LayoutDirection`) have unpredictable cross-axis alignment when
@@ -69,9 +363,13 @@ dimension (e.g., a 28px circular avatar inside a 44px horizontal row), use
`AlignInContainer: =AlignInContainer.Center` instead, so the child keeps its
natural size and is centered.
+⚠️ This check is per-control and there is no compile diagnostic behind it. A screen where
+`AlignInContainer` appears on *none* of its controls has not had this check run — say so
+in your report rather than claiming a clean pass.
+
---
-## Check 3 — FILLPORTIONS-DEFAULT (missing `FillPortions` on AutoLayout child)
+## Check 8 — FILLPORTIONS-DEFAULT (missing `FillPortions` on AutoLayout child)
**Problem:** Children of an AutoLayout container inherit a PA-chosen default for
`FillPortions` that varies by control type, so the intent isn't clear.
@@ -100,7 +398,7 @@ layout intent is explicit.
---
-## Check 4 — SCROLL-TRAP (`FillPortions: =1` inside scroll container)
+## Check 9 — SCROLL-TRAP (`FillPortions: =1` inside scroll container)
**Problem:** When a container has `LayoutOverflowY: =LayoutOverflow.Scroll` and
its direct child has `FillPortions: =1`, the child is pinned to the viewport
@@ -121,7 +419,7 @@ FillPortions: =0
---
-## Check 5 — WRAP-MISSING (single-line label without `Wrap: =false`)
+## Check 10 — WRAP-MISSING (single-line label without `Wrap: =false`)
**Problem:** Power Apps defaults `Wrap` to `true` on `Label` controls. A narrow
nav item, breadcrumb, badge, or KPI value will wrap its text onto two lines and
@@ -151,7 +449,7 @@ comment text. These should keep the default wrapping behavior.
---
-## Check 6 — NO-HEIGHT-TRAP (`FillPortions: =0` without explicit `Height`)
+## Check 11 — NO-HEIGHT-TRAP (`FillPortions: =0` without explicit `Height`)
**Problem:** When an AutoLayout child has `FillPortions: =0` (or `FillPortions`
is absent, which defaults to 0) and no explicit `Height`, Power Apps defaults
@@ -160,30 +458,60 @@ inexplicable gaps or clipping.
**Detect:** For every `GroupContainer` whose parent has `LayoutDirection`
(AutoLayout child), check:
+- Is the parent's `LayoutDirection` **Vertical**? This check applies to the parent's main
+ axis only. In a horizontal parent, `FillPortions` governs width, so apply the same test
+ to `Width` instead of `Height`.
- Is `FillPortions` absent or `=0`?
-- Is `Height` absent?
-- If both → flag it.
+- Is `Height` absent (vertical parent) or `Width` absent (horizontal parent)?
+- If all → flag it.
**Fix:** Add an explicit `Height` formula that sums child heights + gaps +
-padding:
+padding, writing the padding and gap as the **literal numbers you set on this
+container**:
+
+```yaml
+# This container sets PaddingTop: =12, LayoutGap: =8, PaddingBottom: =12
+Height: =12 + child1.Height + 8 + child2.Height + 12
+```
+
+⚠️ **Never write `PaddingTop`, `PaddingBottom`, `LayoutGap`, `PaddingLeft` or
+`PaddingRight` as bare names in a formula.** They are properties of a container,
+not global names, and Power Fx resolves them against nothing:
```yaml
+# WRONG — every bare name here fails with `Name isn't recognized`
Height: =PaddingTop + child1.Height + LayoutGap + child2.Height + PaddingBottom
```
+One such formula emits a `Name isn't recognized` error for every bare name it
+contains, on a control that is otherwise correct. There is no `Self.LayoutGap`
+form to reach for either — substitute the literal value.
+
If the children's heights are unknown at write time, use a safe static value
(e.g., `Height: =44` for a single row, `=200` for a card panel) and note it in
the fix log so the user can refine.
+After confirming a fixed size exists, verify that it fits. For every fixed-height
+vertical section, evaluate each responsive branch and sum direct child heights, nested
+minimum content heights, gaps and padding. Include wrapped or `AutoHeight` text at its
+expected narrow-width line count. Flag any branch where the section height is smaller
+than that budget. Do not mark this check `PASS` merely because `Height` is present.
+
+Avoid parent-height formulas that depend on descendant control `.Height` values when
+those descendants also size from their parent. Use collection counts and literal content
+budgets directly; layout feedback loops can collapse to the platform's default 100px
+height while compiling cleanly.
+
**Exception:** The screen root container uses `Width: =Parent.Width` and
`Height: =Parent.Height` — not an AutoLayout child. Do NOT flag it.
-Also do NOT flag controls where `FillPortions > 0` — PA computes the height
-proportionally and `Height` should be absent.
+Also do NOT flag controls where `FillPortions > 0` — PA computes the main-axis size
+proportionally and the explicit size should be absent. Do not add a cross-axis size to a
+child that uses `AlignInContainer: =AlignInContainer.Stretch`; the parent already sets it.
---
-## Check 7 — TEXT-PADDING (ModernText, Label padding defaults to 5)
+## Check 12 — TEXT-PADDING (ModernText, Label padding defaults to 5)
**Problem:** `ModernText` and `Label` controls default `PaddingTop`, `PaddingBottom`,
`PaddingLeft`, and `PaddingRight` to `5`. In most UI contexts (labels in a
@@ -212,9 +540,14 @@ the intended non-zero value explicitly. The rule is **never leave any of the
four padding properties absent on a `ModernText`** — always set all four so the
PA default of 5 cannot creep in.
+Then check vertical fit. Prefer `AutoHeight: =true`. When a fixed height is required,
+set `PaddingTop: =0`, `PaddingBottom: =0`, and make `Height` at least `Size * 1.5`.
+Also ensure a fixed-height parent band can hold every wrapped text child plus its own
+padding and gaps.
+
---
-## Check 8 — FILLPORTIONS-HEIGHT-CONFLICT (both set on the same control)
+## Check 13 — FILLPORTIONS-HEIGHT-CONFLICT (both set on the same control)
**Problem:** Setting both `FillPortions: =N` (where `N > 0`) and an explicit
`Height: =value` on the same control within a vertical AutoLayout container confuses the layout engine.
@@ -230,7 +563,7 @@ against the parent's available space.
---
-## Check 9 — FILLPORTIONS-WIDTH-CONFLICT (both set on the same control)
+## Check 14 — FILLPORTIONS-WIDTH-CONFLICT (both set on the same control)
**Problem:** Setting both `FillPortions: =N` (where `N > 0`) and an explicit
`Width: =value` on the same control within a horizontal AutoLayout container
@@ -247,8 +580,586 @@ against the parent's available space.
---
-## Check 10 — CONTROL-VERSION-SUFFIX (`Control:` value contains `@version`)
+## Check 15 — GALLERY-TEMPLATE-LAYOUT (absolutely positioned gallery rows)
+
+**Problem:** `Gallery` is a Classic control with no AutoLayout variant. Controls placed
+directly in its template are positioned with absolute `X`/`Y`/`Width`, so the row is
+frozen at whatever width you authored. At phone width the right-hand columns run off
+screen and inputs shrink to a few pixels. `compile_canvas` reports nothing.
+
+**Detect:** For every control with `Control: Gallery`, inspect its direct `Children`. Flag
+the gallery if it has more than one direct child, or if any direct child sets `X` or `Y`.
+
+**Fix:** Give the gallery exactly one direct child — an AutoLayout `GroupContainer` sized
+to the template — and move the row content inside it:
+
+```yaml
+Children:
+ - [Prefix]RowShell:
+ Control: GroupContainer
+ Variant: AutoLayout
+ Properties:
+ LayoutDirection: =LayoutDirection.Horizontal
+ LayoutGap: =8
+ LayoutMinWidth: =0
+ LayoutMinHeight: =0
+ Width: =Parent.TemplateWidth
+ Height: =Parent.TemplateHeight
+```
+
+Then size the row content with `FillPortions` and drop every `X`/`Y` inside the template.
+
+Set `Parent.TemplateWidth`/`Parent.TemplateHeight` **only on the shell**, which is the
+gallery's direct child. Deeper descendants must use `FillPortions`, `Parent.Width` or
+`Parent.Height`; `Parent` there means the shell, which has no `TemplateWidth`, and the
+compile fails with `Name isn't recognized: 'TemplateWidth'`.
+
+**Exception:** A single-column gallery whose template holds exactly one full-width control
+needs no shell.
+
+---
+
+## Check 16 — FIXED-LAYOUT-WIDTH (hard-coded pixel width on a layout container)
+
+**Problem:** A container with `Width: =1120` renders 1120px wide inside a 1024px viewport
+and clips its right edge. The screen looks correct only at the width it was authored at.
+
+**Detect:** For every `GroupContainer` and `Gallery`, flag a `Width` set to a numeric
+literal greater than 400 that does not reference `Parent`, `Self`, or `App`.
+
+**Fix:** Replace with a responsive expression, or delete it and let the parent size the
+control:
+
+```yaml
+# Before:
+Width: =1120
+# After:
+Width: =Parent.Width
+# or, as a child of an AutoLayout container:
+FillPortions: =1
+```
+
+**Exception:** Genuinely fixed-size elements — icon boxes, avatars, stepper buttons,
+fixed-width sidebars. Keep interactive ones at 44px or larger so they remain tappable.
+
+---
+
+## Check 17 — ITEM-DISPLAY-TEXT (quoted column name instead of a per-item formula)
+
+**Problem:** `ItemDisplayText` and `ItemKey` are evaluated per row with `ThisItem` in
+scope. `ItemDisplayText: ="Value"` is a constant string, not a field reference, and the
+dropdown renders every option blank. `compile_canvas` accepts it.
+
+**Detect:** For every control setting `ItemDisplayText` or `ItemKey`, flag a value that is
+a quoted literal rather than an expression referencing `ThisItem`.
+
+**Fix:**
+
+```yaml
+# Before:
+ItemDisplayText: ="Value"
+# After:
+ItemDisplayText: =ThisItem.Value
+```
+
+**Exception:** When `Items` is already a single-column table, omit the property entirely.
+
+---
+
+## Check 18 — ACCESSIBLE-LABEL-MISSING (control with no `AccessibleLabel`)
+
+**Problem:** A control that renders content or accepts input without an `AccessibleLabel`
+is unusable with a screen reader, and an interactive gallery without `TabIndex` cannot be
+reached from the keyboard. `compile_canvas` reports neither. A screen authored without
+them needs dozens of labels retrofitted into a file that was otherwise finished. Writing
+them as you go costs nothing.
+
+**Detect:** For every control that renders content or accepts input — `ModernText`,
+`ModernCard`, `Badge`, `Gallery`, `Image`, `Icon`, buttons, and every input control —
+check that `AccessibleLabel` is present. For every `Gallery` a user selects from, check
+that `TabIndex` is present.
+
+**Fix:** Add a label derived from the control's content, and a tab stop on interactive
+galleries:
+
+```yaml
+AccessibleLabel: ="Filtered inventory list"
+TabIndex: =0
+```
+
+Inside a gallery template, make it row-specific:
+
+```yaml
+AccessibleLabel: ="Quantity on hand for " & ThisItem.Name
+```
+
+**Exception:** Purely decorative controls — spacer containers, background rectangles,
+divider lines. Do not label those.
+
+---
+
+## Check 19 — NO-REFLOW (horizontal row with no narrow-width strategy)
+
+**Problem:** A horizontal AutoLayout row authored at desktop width does not reflow. At
+phone width its children squeeze to a few pixels, run off the right edge, or collapse to
+zero height. This is the most common defect in generated apps, and nothing in
+`compile_canvas` reports it.
+
+**Detect:** For every container with a horizontal branch and more than two substantive
+children:
+
+1. Confirm it wraps or changes direction at a width breakpoint.
+2. Evaluate the horizontal branch's width budget: fixed `Width` and `LayoutMinWidth`
+ values, gaps and horizontal padding must fit the available parent width. A breakpoint
+ formula is not a pass when the desktop branch still places ten 100-170px fields in one
+ row.
+3. Evaluate the vertical branch's height budget. Sum fixed child heights, nested
+ content heights, gaps and vertical padding. A child with `FillPortions: =1` still needs
+ enough remaining height for its descendants; otherwise its labels collapse to zero
+ height.
+
+**Fix:** Add one of the two strategies:
+
+```yaml
+# Wrap onto more lines:
+LayoutWrap: =true
+
+# Or stack below a breakpoint:
+LayoutDirection: =If(Parent.Width < 640, LayoutDirection.Vertical, LayoutDirection.Horizontal)
+```
+
+If the horizontal width budget still does not fit, wrap it or group each label/input pair
+inside a vertical field container so the parent row has fewer substantive children. If
+the vertical height budget does not fit, raise the containing height or the gallery
+`TemplateSize`; do not rely on `FillPortions` to create space that is not available.
+
+**Exception:** A two-child row of a label and a fixed icon, or a row whose children all
+carry `FillPortions` and remain legible when proportionally narrowed.
+
+---
+
+## Check 20 — ROOT-NOT-SCROLLABLE (screen content taller than the viewport cannot be reached)
+
+**Problem:** A canvas screen does not scroll by itself. If the root container is not a
+scroll container, everything below the viewport is unreachable — no scrollbar, no wheel
+response, and the user never learns the content exists.
+
+**Detect:** Find the screen's root container. Flag it if it does not set
+`LayoutOverflowY: =LayoutOverflow.Scroll` while its children include a gallery, a form, or
+more than about three stacked sections.
+
+**Fix:**
+
+```yaml
+LayoutDirection: =LayoutDirection.Vertical
+LayoutOverflowY: =LayoutOverflow.Scroll
+```
+
+Then re-run Check 9: a **direct** child of a scroll container must use `FillPortions: =0`,
+or it is pinned to the viewport height and the content is clipped rather than scrolled.
+
+**Exception:** A screen whose content is genuinely fixed and fits the shortest supported
+viewport.
+
+---
+
+## Check 21 — LOW-CONTRAST-TEXT (text colour not set against a coloured background)
+
+**Problem:** Text controls do not inherit a contrasting colour from their container. A
+container with a dark `Fill` whose child text controls omit `Color` renders near-black on
+near-black. `compile_canvas` passes it.
+
+**Detect:** For every container that sets a non-default `Fill`, check every descendant
+text control (`ModernText`, `Badge`, and any control with a `Text` or `Content` property)
+for an explicit colour — `Color` on the modern React controls, `FontColor` on `Badge`,
+`TitleColor`/`SubtitleColor`/`DescriptionColor` on `ModernCard`.
+
+**Fix:** Set the colour explicitly wherever the background was set:
+
+```yaml
+Color: =RGBA(239, 246, 250, 1)
+```
+
+**Exception:** None. If you chose the background, choose the foreground.
+
+---
+
+## Check 22 — VARIANT-SURFACE-CONTRAST (light foreground on a variant-supplied surface)
+
+**Problem:** Check 21 catches text that *omits* a colour. This is the opposite failure: the
+colour is set, and it is set against a surface the control derives from a **Fluent enum**
+rather than from `Fill`. The agent picks a near-white foreground for a dark theme, the
+variant supplies a near-white surface, and the control renders white-on-white — a nav
+button whose label is invisible, or a status badge that reads as an empty pill.
+
+These are the enum values that produce a **light** surface:
+
+| Property | Light-surface members |
+|----------|----------------------|
+| `Appearance` on `ModernButton` | `ButtonAppearance.Secondary`, `.Outline`, `.Subtle`, `.Transparent` |
+| `Appearance` on inputs | `Appearance.Outline`, `.FilledLighter` |
+| `Appearance` on `Badge` | `'BadgeCanvas.Appearance'.Tint`, `.Ghost`, `.Outline` |
+| `ThemeColor` on `Badge` | `'BadgeCanvas.ThemeColor'.Informative`, `.Warning` |
+
+**Detect:** For every control that sets `Color` or `FontColor` to a light value (any
+channel triple averaging above ~180), check whether its surface comes from one of the enum
+values above. If it does, flag it unless the chosen appearance is known to render a dark
+surface with the supplied `BasePaletteColor`. A `Fill` property alone is not proof:
+Fluent `Secondary`, `Outline`, `Subtle` and `Transparent` buttons can keep their
+variant-supplied light surface and ignore that fill.
+
+Check the dynamic case too: a `ThemeColor` driven by `If`/`Switch` will pass through light
+members for some rows even when the branch you eyeballed was dark.
+
+**Fix:** Pick a foreground that works against the variant surface, or switch to a dark
+surface appearance and set its palette:
+
+```yaml
+# Before — Secondary is a light surface, so near-white text vanishes
+Appearance: =ButtonAppearance.Secondary
+Color: =RGBA(238, 243, 250, 1)
+Fill: =RGBA(23, 37, 58, 1) # may be ignored
+
+# After — keep Secondary and use dark text
+Appearance: =ButtonAppearance.Secondary
+Color: =RGBA(23, 37, 58, 1)
+
+# Or use a palette-backed dark primary surface
+Appearance: =ButtonAppearance.Primary
+BasePaletteColor: =RGBA(23, 37, 58, 1)
+Color: =RGBA(238, 243, 250, 1)
+```
+
+**Exception:** A control genuinely intended to sit on a light page background, where the
+foreground is dark. The rule is that foreground and surface must be chosen together —
+never one from your palette and the other from an enum default.
+
+---
+
+## Check 23 — CARD-PLACEHOLDER (`ModernCard` slot left unset)
+
+**Problem:** `ModernCard` does not render unset slots as empty. It substitutes placeholder
+content: a large stock photograph for `Image`, and the literal strings `Title`, `Subtitle`
+and `Description` for the text slots. The photo takes most of the card's height, so the
+value you *did* set is pushed out of view or clipped mid-glyph. Every card on the screen
+looks identical and none of them shows its data. `compile_canvas` reports nothing.
+
+**Detect:** For every `Control: ModernCard`, list the slots supported by the control
+definition and the slots the YAML sets. Flag it when `Image` is absent. When the
+definition includes `HeaderImage`, flag that when it is absent too. Flag any text slot
+that the card's layout displays but the YAML leaves unset.
+
+**Fix:** Set every slot, using `Blank()` for an image you do not want:
+
+```yaml
+- KpiOpenCard:
+ Control: ModernCard
+ Properties:
+ Image: =Blank()
+ HeaderImage: =Blank()
+ Title: =CountRows(colOpenTasks) & ""
+ Subtitle: ="Open tasks"
+ Description: ="Across all projects"
+```
+
+If the control definition includes `ImageAccessibleLabel` or
+`HeaderImageAccessibleLabel`, set those explicitly when the corresponding image is
+blank. A text-only `ModernCard` inside AutoLayout must use explicit card dimensions and
+`FillPortions: =0`; stretching it with `FillPortions: =1` can collapse every visual slot
+while the accessibility tree still exposes the values. Use at least `Height: =150` and a
+width that fits the intended card, or choose a custom AutoLayout KPI surface when the
+card must fluidly fill available width. When Title, Subtitle and Description are all
+visible, use at least `Height: =180`; anything below 180 is a failure, not a compact
+variant. Do not force all
+three text slots into a short fixed height.
+
+**Exception:** None. If you chose `ModernCard`, you own all of its slots.
+
+---
+
+## Check 24 — GALLERY-ROW-FITS-CONTENT (`TemplateSize` smaller than the row template)
+
+**Problem:** `TemplateSize` fixes the row height; the template's content does not
+negotiate with it. A row sized for density — `TemplateSize: =If(Self.Width < 640, 320, 132)`
+— clips whatever does not fit at the *desktop* branch, so the app looks correct on a phone
+and loses its card titles on a laptop. It is easy to miss because the narrow branch, which
+is the one usually eyeballed, is fine.
+
+The trap is worst with a `ModernCard` row template, whose image band alone can exceed the
+row height you chose.
+
+**Detect:** For every `Gallery`, evaluate `TemplateSize` at **each** branch of its formula.
+For each branch, add up the stacked heights of the row template's children plus their gaps
+and padding — counting nested fixed-height descendants and a `ModernCard`'s image band.
+When a vertical row contains a `FillPortions: =1` child, calculate the minimum height of
+that child's descendants and include it in the sum; do not treat it as zero. Flag any
+branch where the total exceeds `TemplateSize`.
+
+**Fix:** Raise the branch to fit, or reduce what the row renders at that width:
+
+```yaml
+# Before — 132px cannot hold a card image plus a title
+TemplateSize: =If(Self.Width < 640, 320, 132)
+# After
+TemplateSize: =If(Self.Width < 640, 320, 220)
+```
+
+**Exception:** A row that deliberately truncates a long free-text field, where the
+truncation is visible and the row still shows its identifying label.
+
+---
+
+## Check 25 — GRID-CONTRACT (GridLayout axes, row count or height disagree)
+
+**Problem:** GridLayout accepts incomplete or inconsistent sizing formulas. The app can
+compile while cards overlap, jump columns, leave a large blank tail, or clip shadows.
+
+**Detect:** For every `GroupContainer` with `Variant: GridLayout`:
+
+1. Confirm it sets `LayoutGridColumns`, `LayoutGridRows`,
+ `LayoutGridColumnMinWidth` and `LayoutGridRowMinHeight`.
+2. Confirm `LayoutGridRows` uses the same column-count expression as
+ `LayoutGridColumns`.
+3. Confirm `Height` equals rows times row height, plus inter-row gaps and vertical
+ padding.
+4. If any child sets a `LayoutGrid*Start` or `LayoutGrid*End` property, confirm every
+ child is explicitly positioned.
+5. Confirm card shadows have at least 8px padding on the sides where they render.
+
+**Fix:** Reapply the exact grid contract from the screen brief. If it is missing, return
+`Status: Blocked`; do not invent a responsive track map.
+
+**Exception:** None for steps 1-3. Step 4 is `N/A` for a uniform auto-flow card grid.
+
+---
+
+## Check 26 — DUPLICATE-GRID-SEARCH (`ModernDataGrid` plus separate search UI)
+
+**Problem:** `ModernDataGrid.Searchable: =true` renders a built-in search box. If the
+screen also provides a `ModernTextInput` or filter bar that filters the same rows, users
+see two search affordances with unclear combined state.
+
+**Detect:** For every `ModernDataGrid` with `Searchable: =true`, inspect the surrounding
+section for a separate search input or filter formula targeting the same `Items`.
+
+**Fix:** Keep the screen-level search/filter UI and set `Searchable: =false`, or remove
+the property because false is the default.
+
+**Exception:** A separate input that searches a different dataset or performs a different
+action is not duplicate UI.
+
+---
+
+## Check 27 — ROOT-CONTAINMENT (responsive screen content outside its root container)
+
+**Problem:** A responsive screen can compile with a correctly configured root AutoLayout
+container while the actual header, sections and galleries are mis-indented as sibling
+entries in the screen's top-level `Children:` list. The root is then empty. Those siblings
+use screen-level positioning instead of AutoLayout, overlap one another, intercept pointer
+events and leave large blank areas. Every property on the individual controls can be
+valid, so no compile diagnostic reports the failure.
+
+**Detect:** When the screen brief names a responsive root container, inspect the
+`Children:` list directly under the screen key. It must contain exactly that root
+container. Then confirm every visible section named in the brief is nested under the
+root's `Children:` list. A root followed by another screen-level `- [Prefix]Header`,
+`- [Prefix]Panel`, gallery or stage is a failure, not a second layout region.
+
+**Fix:** Move every screen-level sibling under the root container's `Children:` key,
+preserving their order and existing properties:
+
+```yaml
+Screens:
+ Screen1:
+ Children:
+ - AppRoot:
+ Control: GroupContainer
+ Variant: AutoLayout
+ Properties:
+ Width: =Parent.Width
+ Height: =Parent.Height
+ LayoutDirection: =LayoutDirection.Vertical
+ Children:
+ - AppHeader:
+ # ...
+ - AppContent:
+ # ...
+```
+
+After moving the controls, re-run Checks 8, 9, 13, 14 and 20 because their parent
+AutoLayout context has changed.
+
+**Exception:** A brief that explicitly requires a fixed ManualLayout screen with
+deliberate screen-level overlays may use multiple top-level controls. Do not infer this
+exception from the YAML; it must be stated in the brief.
+
+---
+
+## Check 28 — TIMER-LIFECYCLE (timer has no automatic start/reset edge)
+
+**Problem:** A Timer with `AutoStart: =false` does not reliably start when its `Start`
+variable was already set to true before navigation. It needs a false-to-true transition
+after the timer exists. Toggling only `Reset` for the next speaker can leave the display
+at `00:00` and the timer stopped until the user clicks it. Because Timer is clickable by
+default, an accidental second click can pause it indefinitely and block the workflow.
+
+**Detect:** For every `Control: Timer` used as an automatic countdown:
+
+1. If `AutoStart: =false`, trace the `Start` formula. Flag it when the variable is set
+ true before navigating to the timer screen and is never toggled false then true in
+ `OnVisible`.
+2. Trace every reset/next-item action. It must reset the timer and produce a new start
+ edge for the next item.
+3. Flag an interactive timer with no visible play/pause label when clicking it can pause
+ a required workflow.
+4. Inspect its `Text` formula. A countdown must display remaining time
+ (`Duration - Value`) and explicitly show `00:00` after expiry. A formula based only on
+ `Self.Value` counts upward and can show `01:00` beside a "Minute complete" message.
+
+**Fix:** Prefer `AutoStart: =true` for a timer that must begin on screen entry. For each
+new item, toggle `Reset` and restart explicitly:
+
+```yaml
+# Screen OnVisible
+OnVisible: |-
+ =Set(varTimerRunning, false);
+ Set(varTimerReset, !varTimerReset);
+ Set(varTimerRunning, true)
+
+# Timer
+AutoStart: =true
+Start: =varTimerRunning
+Reset: =varTimerReset
+AutoPause: =false
+Text: =If(varTimerFinished, "00:00", Text(Time(0, 0, Max(0, RoundUp((Self.Duration - Self.Value) / 1000, 0))), "mm:ss"))
+```
+
+Use the same false-reset-true sequence when advancing to the next item. If manual pause
+is a requirement, provide a separate labelled button and visible state; do not use the
+timer surface as an undisclosed toggle.
+
+**Exception:** A timer explicitly requested as manual start/pause, with labelled controls
+and a workflow that does not block while it is stopped.
+
+---
+
+## Check 29 — READ-ONLY-ANCESTOR (interactive control under a read-only ancestor)
+
+**Problem:** `DisplayMode` is inherited. A Gallery or container set to
+`DisplayMode.View` makes every descendant button, input and toggle non-interactive even
+when the child sets `DisplayMode.Edit`. The controls can still look enabled, so Preview
+shows a false affordance and clicks silently fail.
+
+**Detect:** For every button, input, toggle, date picker or other interactive control,
+walk its ancestors. Flag any ancestor that sets `DisplayMode: =DisplayMode.View` or
+`Disabled`. This is especially common on a nonselectable Gallery that also contains Edit
+or row-action buttons.
+
+**Fix:** Leave the ancestor in `DisplayMode.Edit` and control selection separately:
+
+```yaml
+- EventGallery:
+ Control: Gallery
+ Variant: Vertical
+ Properties:
+ Selectable: =false
+ DisplayMode: =DisplayMode.Edit
+```
+
+Set `DisplayMode` only on the individual action when it genuinely needs to be disabled.
+
+**Exception:** A deliberately read-only subtree with no interactive descendants.
+
+---
+
+## Check 30 — HIDDEN-BOUNDED-LIST (small bounded gallery hidden in nested scrolling)
+
+**Problem:** A short, known roster is placed in a fixed-height Gallery inside an already
+scrollable screen. The Gallery creates a second scroll region and silently hides rows;
+Studio may not render a visible scrollbar even when `ShowScrollbar: =true`. Users see
+four of six people and have no cue that more exist.
+
+**Detect:** For every Gallery inside a root scroll container:
+
+1. If its Items source is a bounded local collection with roughly ten or fewer rows,
+ compare `Height` with `CountRows(Items) * TemplateSize` plus template padding.
+2. Flag it when the fixed height is smaller than the full list, regardless of
+ `ShowScrollbar`.
+3. Flag a list that can open at a non-zero internal scroll position without an explicit
+ reset-to-top behavior.
+
+**Fix:** Let small bounded lists grow and rely on the root scroll:
+
+```yaml
+Height: =CountRows(Self.AllItems) * Self.TemplateSize
+ShowScrollbar: =false
+```
+
+For genuinely large or unbounded data, keep the internal scroll region but provide a
+visible affordance and reset it to the first row on screen entry.
+
+**Exception:** Large/unbounded datasets where virtualization and internal scrolling are
+intentional and visibly discoverable.
+
+---
+
+## Check 31 — SEMANTIC-VALUE-BINDING (semantic display control missing its visible value)
+
+**Problem:** Semantic controls can render sample placeholder text when the property that
+drives their visible value is absent. A `Badge` with a correct `AccessibleLabel`,
+`ThemeColor` and shape but no `Content` can display a literal placeholder such as `AB`
+for every row while the accessibility tree announces the real status.
+
+**Detect:** For every semantic display control, require its visible value property:
+
+- `Badge`: `Content`
+- `Avatar`: its name/text/image property from the exact control definition
+- `ModernCard`: Title, Subtitle, Description and image slots per Check 23
+- Any other semantic control: the content/value property returned by `describe_control`
+
+An `AccessibleLabel` is not the visible value binding.
+
+**Fix:** Bind the semantic content to the record:
+
+```yaml
+- StatusBadge:
+ Control: Badge
+ Properties:
+ Content: =ThisItem.Status
+ AccessibleLabel: ="Assignment status " & ThisItem.Status
+```
+
+**Exception:** A purely decorative semantic control explicitly intended to have no
+visible value.
+
+---
+
+## Check 32 — ACTION-LABEL-FIT (multiword action label does not fit its control)
+
+**Problem:** A multiword button or link with no explicit width uses a small platform
+default. Labels such as `Add to my itinerary`, `Back to speakers`, or `CSV import setup`
+wrap one word per line or clip inside a tiny square while the surrounding row is mostly
+empty.
+
+**Detect:** For every interactive control with a text label:
+
+1. If the label has more than one word or more than about 12 characters, require an
+ explicit `Width` or `LayoutMinWidth` that fits it at each breakpoint.
+2. In a vertical AutoLayout parent, do not treat `AlignInContainer.Stretch` alone as
+ proof that a ModernButton will fill the row. Require `Width: =Parent.Width`;
+ `LayoutMinWidth` alone does not satisfy this case.
+3. If the label intentionally wraps, confirm the control height fits every line plus
+ padding. Navigation labels should normally remain one line.
+
+**Fix:**
+
+```yaml
+Width: =If(Parent.Width < 640, Parent.Width, 220)
+LayoutMinWidth: =160
+Height: =48
+```
-**Detect:** For every `Control:` property, flag any value that contains an `@` character (e.g. `Control: [email protected]`).
+For four-item phone navigation, allocate equal widths that fit the parent without
+wrapping; shorten labels or use icons when the full labels cannot fit.
-**Fix:** Strip the `@…` suffix, keeping only the bare control name (`Control: Text`).
\ No newline at end of file
+**Exception:** A deliberately compact icon-only action whose visible text is omitted.
diff --git a/plugins/canvas-apps/references/TechnicalGuide.md b/plugins/canvas-apps/references/TechnicalGuide.md
deleted file mode 100644
index 89139e44d..000000000
--- a/plugins/canvas-apps/references/TechnicalGuide.md
+++ /dev/null
@@ -1,445 +0,0 @@
-# Canvas App YAML Generation Guide
-
-This guide captures best practices and learnings for generating Canvas App YAML screens.
-
-## Quick Start Checklist
-
-When generating a new Canvas App screen:
-
-Always review this technical guide AND the design guide prior to designing a screen.
-
-1. ⚠️ **Run `list_controls` FIRST — this is non-optional** - Controls you don't know exist can't influence your design. Skipping this step leads to rebuilding things like `Avatar`, `Badge`, `Progress`, `ModernTabList`, and `ModernCard` from scratch using primitive controls. Run `list_controls` before planning layout or choosing any control type.
-2. ✅ **Explore examples** - Review existing `.pa.yaml` files for patterns if available
-3. ✅ **Plan state management** - Identify what variables you need (Set() calls)
-4. ✅ **Choose layout strategy** - ManualLayout for precise control, AutoLayout for responsive design
-5. ✅ **Select control types** - Match controls to use case
-6. ✅ **Write formulas carefully** - Use Power Fx syntax with `=` prefix
-7. ✅ **Validate early and often** - Use `compile_canvas` tool to catch errors
-
-## File Structure
-
-Have one .pa.yaml file for the App object, and a separate file for each screen.
-
-```yaml
-Screens:
- ScreenName:
- Properties: # Optional screen-level properties
- Fill: =RGBA(...)
- OnVisible: |- # Initialize variables on screen load
- =Set(var1, value);
- Set(var2, value)
- Children:
- - ControlName:
- Control: ControlType
- Variant: VariantName # Optional
- Properties:
- PropertyName: =formula
- Children: # Only for controls with children
- - NestedControl:
- ...
-```
-
-## YAML Syntax Rules
-
-### Multi-line formulas — use `|-`
-
-Any formula that spans multiple lines must use the `|-` block scalar. The `=` prefix goes on the first content line, not on the `|-` line:
-
-```yaml
-OnSelect: |-
- =Set(x, 1);
- Set(y, 2)
-```
-
-Single-line formulas can be written inline:
-
-```yaml
-Text: =firstName & " " & lastName
-```
-
-### Strings that contain `: ` must be quoted
-
-YAML treats `key: value` as a mapping. If a plain string value contains a colon followed by a space, wrap the whole value in quotes:
-
-```yaml
-# WRONG — YAML parses "Label: something" as a nested mapping key
-HintText: =Label: enter a value
-
-# RIGHT
-HintText: ="Label: enter a value"
-```
-
-### Power Fx record literals must be quoted — `={Value: "..."}` will fail
-
-⚠️ This is a common source of hard-to-diagnose errors. A Power Fx record literal looks like `{Value: "x"}`, but in a YAML plain scalar that `Value:` is parsed as a YAML mapping key before Power Fx ever sees it. Always wrap record literals in a quoted YAML string:
-
-```yaml
-# WRONG — YAML parses `Value:` as a mapping key, formula never runs
-Default: ={Value: "Tab1"}
-
-# RIGHT — outer quotes make the whole thing a YAML string first
-Default: "={Value: ""Tab1""}"
-
-# Also valid — single quotes (no escaping needed for inner double quotes)
-Default: '={Value: "Tab1"}'
-```
-
-This applies anywhere a record literal appears inline: `Default`, `Selected`, `Items` (when hardcoded), and similar properties. `ModernTabList.Default` is the most common place this bites.
-
-## Control Type Selection
-
-**⚠️ Required — not optional:** Run list_controls before planning your layout. Controls you don't know exist can't influence your design, and the catalog includes high-level controls (`Avatar`, `Badge`, `Progress`, `ModernTabList`, `ModernCard`, and others) that are easy to miss and expensive to reinvent with primitives.
-
-### Layout Containers
-
-| Use Case | Control Type | Variant |
-|----------|--------------|---------|
-| Precise positioning | `GroupContainer` | `ManualLayout` |
-| Horizontal Responsive layout | `GroupContainer` | `AutoLayout` with `LayoutDirection: =LayoutDirection.Horizontal` |
-| Vertical Responsive layout | `GroupContainer` | `AutoLayout` with `LayoutDirection: =LayoutDirection.Vertical` |
-
-**Choosing a layout strategy:** Default to AutoLayout (responsive). 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.
-
-⚠️ **`GroupContainer` has no `OnSelect` — it cannot be clicked.** This is a common dead end when building card UI: the container lays out perfectly but tapping it does nothing.
-
-- **Clickable cards:** Use `ModernCard` instead — it has `OnSelect` and is designed for this.
-- **Clickable non-card areas:** Overlay a transparent `Button` or `Rectangle` (both have `OnSelect`) on top of the container at the same position and size. If applicable, set the Appearance property to transparent; otherwise set `Fill: =RGBA(0,0,0,0)` and `BorderThickness: =0` to make it invisible.
-
-### Data Display
-
-| Use Case | Control Type | Key Properties |
-|----------|--------------|----------------|
-| List of items | `Gallery` | Items, TemplateSize, OnSelect |
-| Tabular data | `Table` | Items, columns |
-| Grid data with editing | `DataGrid` | Items, columns, OnSelect |
-| Forms | `Form`, `EntityForm` | DataSource, Item, OnSuccess |
-
-## Common Property Patterns
-
-### Positioning (ManualLayout)
-
-```yaml
-Properties:
- X: =100 # Absolute position
- Y: =50
- Width: =200 # Fixed width
- Height: =40
-```
-
-### Responsive Sizing
-
-```yaml
-Properties:
- X: =(Parent.Width - Self.Width) / 2 # Center horizontally
- Width: =Parent.Width # Full width
- Height: =Parent.Height - Self.Y # Fill remaining height
-```
-
-### Colors
-
-```yaml
-# Using color constants
-Fill: =Color.White
-BasePaletteColor: =Color.Blue
-
-# Using RGBA
-Fill: =RGBA(240, 240, 240, 1)
-FontColor: =RGBA(0, 0, 0, 1)
-
-# Conditional colors
-BasePaletteColor: =If(isActive, Color.Blue, Color.Gray)
-```
-
-### Button States
-
-```yaml
-Properties:
- DisplayMode: =If(isDisabled, DisplayMode.Disabled, DisplayMode.Edit)
- Text: =buttonText
- OnSelect: |-
- =If(condition,
- false, # Guard clause - do nothing
- Set(variable, value); # Execute logic
- Set(anotherVar, anotherValue)
- )
-```
-
-## Power Fx Formula Patterns
-
-### State Management
-
-```yaml
-# Initialize variables on screen load
-OnVisible: |-
- =Set(variable1, "initial value");
- Set(variable2, 0);
- Set(variable3, false)
-
-# Update state on interaction
-OnSelect: |-
- =Set(counter, counter + 1);
- Set(status, "updated")
-```
-
-### Conditional Logic
-
-```yaml
-# Simple conditional
-Text: =If(isActive, "Active", "Inactive")
-
-# Nested conditionals
-Text: =If(status = "complete",
- "Done!",
- If(status = "pending",
- "In Progress",
- "Not Started"))
-
-# Boolean expressions
-Visible: =isEnabled && !isHidden
-DisplayMode: =If(gameOver || alreadyPlayed, DisplayMode.Disabled, DisplayMode.Edit)
-```
-
-### String Operations
-
-```yaml
-# Concatenation
-Text: =firstName & " " & lastName
-Text: =currentPlayer & " wins!"
-
-# String comparison
-## Not equal (empty string)
-Visible: =searchText <> ""
-## Equal (case-sensitive)
-Visible: =selectedOption = "Option1"
-```
-
-### Converting date/time values to text
-
-When using format specifiers, always use them in lower case (e.g., `mm` for month, not `MM`)
-
-```yaml
-
-# Convert date to text using the "dddd, mmmm d, yyyy" format (e.g., "Monday, January 1, 2024")
-Text: =Text(varDate, "dddd, mmmm d, yyyy")
-
-# Convert current time to text using the "hh:mm:ss" format (e.g., "14:30:00")
-Text: =Text(Now(), "hh:mm:ss")
-```
-
-### Escaping enum values
-
-Some enum names and/or values need to be escaped with `'` to be parsed correctly in Power Fx.
-That is the case if the name or the value contains spaces, special characters, or if it starts with a number. For example:
-```yaml
-# Using enum values with dots: the enum name is 'ButtonCanvas.Appearance' and it has a value 'Transparent'
-- ButtonCanvas1:
- Control: Button
- Properties:
- Appearance: ='ButtonCanvas.Appearance'.Transparent
-
-# Using enum values that start with a number: the enum name is 'DecimalPrecision' and it has a value '2'
-- NumberInput1:
- Control: ModernNumberInput
- Properties:
- Precision: =DecimalPrecision.'2'
-```
-
-### Escaping option set values
-
-Some option set names and values need to be escaped with `'` to be parsed correctly in Power Fx. That is the case if
-the name or the value contains spaces, special characters, or if it starts with a number. For example:
-```yaml
-# Using option set values with spaces: the option set name is 'Account Status' and it has a value 'Active'
-- galItemsGallery:
- Control: Gallery
- Properties:
- Items: =Filter(Accounts, 'Account Status' = 'Account Status'.Active)
-
-# Using option set with special characters
-- lblDueDate:
- Control: ModernText
- Properties:
- Text: =ThisItem.DueDate
- Visible: =ThisItem.Status = 'Status (Assignments)'.Active
-```
-
-## Layout Strategies
-
-### Manual Grid Layout
-
-For precise control (e.g., game boards, forms):
-
-```yaml
-- Container:
- Control: GroupContainer
- Variant: ManualLayout
- Properties:
- X: =100
- Y: =100
- Width: =300
- Height: =300
- Children:
- - Button1:
- Control: Button
- Properties:
- X: =0
- Y: =0
- Width: =90
- Height: =90
-```
-
-**Pattern:** Calculate positions as `(size * index) + (spacing * index)`
-
-### Auto Layout (Responsive)
-
-For flexible, responsive designs:
-
-```yaml
-- Container:
- Control: GroupContainer
- Variant: AutoLayout
- Properties:
- LayoutDirection: =LayoutDirection.Horizontal
- LayoutAlignItems: =LayoutAlignItems.Center
- LayoutJustifyContent: =LayoutJustifyContent.SpaceBetween
- LayoutGap: =16
- PaddingTop: =8
- PaddingBottom: =8
- Children:
- - Button1:
- Properties:
- FillPortions: =1 # Takes proportional space, change for relative proportions within a container
-```
-
-**Key Learnings:**
-
-1. **Dynamic Gallery Height:** Use `Height: =CountRows(Self.AllItems) * Self.TemplateHeight`
-2. **Enable Container Scrolling:** Set `LayoutOverflowY: =LayoutOverflow.Scroll`
-3. **AutoLayout Child Properties:** Children have `AlignInContainer`, `FillPortions`, `LayoutMinWidth/Height`, `LayoutMaxWidth/Height`
-4. **Pure AutoLayout:** Don't mix ManualLayout inside AutoLayout containers
-5. **FillPortions Required for Fixed-Size Children:** Every child of an AutoLayout container must set `FillPortions: =0` if it has a fixed `Width`/`Height`. Without this, the container silently overrides the fixed size you set.
-
-## Event Handling Patterns
-
-### Guard Clauses
-
-```yaml
-OnSelect: |-
- =If(gameOver || pos1 <> "",
- false, # Do nothing if condition met
- Set(pos1, currentPlayer); # Otherwise execute logic
- UpdateGameState()
- )
-```
-
-### Sequential Operations
-
-```yaml
-OnSelect: |-
- =Set(pos1, currentPlayer);
- Set(gameOver, CheckWinCondition());
- Set(currentPlayer, If(currentPlayer = "X", "O", "X"))
-```
-
-## Named Formulas (NFs) and User Defined Functions (UDFs)
-
-Define reusable logic in `App.Formulas`. This is ideal for constants, complex calculations,
-or any logic that needs to be shared across multiple controls or screens.
-
-```yaml
-App:
- Properties:
- Formulas: |-
- =// Named constants
- MaxItems = 100;
- ColorPrimary = RGBA(52, 120, 246, 1);
-
- // Functions with parameters
- GetStatusColor(status: Text): Color =
- If(
- status = "complete", Color.Green,
- status = "pending", Color.Yellow,
- Color.Gray
- );
-
- TogglePlayer(current: Text): Text =
- If(current = "X", "O", "X");
-```
-
-**Benefits:** Maintainability, readability, consistency, performance
-
-## Best Practices
-
-### App Configuration
-- ✅ Set `App.StartScreen` to the initial landing screen so the app always opens on the intended screen
-
-### State Management
-- ✅ Initialize all variables in `OnVisible`
-- ✅ Use descriptive variable names
-- ✅ Keep state updates sequential with semicolons
-
-### Formula Design
-- ✅ Use guard clauses to prevent invalid operations
-- ✅ Keep formulas readable with proper indentation
-- ❌ Don't create deeply nested If statements
-
-### Layout
-- ✅ Use ManualLayout for precise, fixed layouts
-- ✅ Use AutoLayout for responsive, flexible layouts
-- ✅ Use pure AutoLayout for scrollable screens
-- ✅ Set `LayoutOverflowY: =LayoutOverflow.Scroll` on scrollable containers
-- ✅ Set dynamic gallery heights: `Height: =CountRows(Self.AllItems) * Self.TemplateHeight`
-- ✅ Set `AutoHeight: =true` on most Text labels so they expand with content, or if intended as one line, so they don't show scrollbars
-- ❌ Don't mix ManualLayout inside AutoLayout containers
-- ❌ Don't create nested scrollbars
-
-### Control Selection
-- ✅ Use ListControls tool to discover options
-- ✅ Use DescribeControl tool to verify properties
-- ❌ Don't guess at property names
-
-### Validation
-- ✅ Use compile_canvas tool to validate directory
-- ✅ Validate after major changes
-- ❌ Don't skip validation until the end
-
-### Data
-If the app you're building requires any references to external data sources, temporarily use `ClearCollect` in the App.OnStart property to populate collections with mock data.
-
-## Common Property Reference
-
-**Positioning:**
-- `X`, `Y` - Position (absolute in ManualLayout)
-- `Width`, `Height` - Size
-- `Align` - Text alignment (horizontal)
-- `VerticalAlign` - Text alignment (vertical)
-
-**Styling:**
-- `Fill` - Background color
-- `FontColor` - Text color
-- `BasePaletteColor` - Button color theme
-- `Size` - Font size
-- `FontWeight` - Font weight (Bold, Semibold, Normal)
-
-**Behavior:**
-- `DisplayMode` - Edit, View, Disabled
-- `Visible` - Boolean visibility
-- `OnSelect` - Click handler
-- `OnVisible` - Screen load handler
-
-**Layout (AutoLayout):**
-- `LayoutDirection` - Horizontal or Vertical
-- `LayoutAlignItems` - Center, Start, End, Stretch
-- `LayoutJustifyContent` - Center, SpaceBetween, Start, End
-- `LayoutGap` - Spacing between items
-- `LayoutOverflowY` - Vertical overflow (Scroll for scrollable containers)
-- `FillPortions` - Proportional sizing
-- `PaddingTop/Bottom/Left/Right` - Container padding
-
-## Troubleshooting
-
-- **Formula doesn't update UI:** Ensure you're using `Set()` to update variables
-- **Button text is too small:** Buttons don't support `Size` property - make button larger
-- **Variables reset unexpectedly:** Variables are screen-scoped - use `OnVisible` to initialize
-- **Layout doesn't look right:** Check if you're mixing ManualLayout and AutoLayout
-- **Validation fails with "Unknown property":** Use describe_control tool to see valid properties
\ No newline at end of file
diff --git a/plugins/canvas-apps/references/ValidationWorkflow.md b/plugins/canvas-apps/references/ValidationWorkflow.md
new file mode 100644
index 000000000..08baad8e4
--- /dev/null
+++ b/plugins/canvas-apps/references/ValidationWorkflow.md
@@ -0,0 +1,221 @@
+# Validation Workflow
+
+The orchestrator owns compilation of the finished workspace and the final summary.
+
+## Contents
+
+- Section 0 — Compile gates: when to compile, and why gate 3 exists
+- Section 1 — Compile: diagnostic tiers, parse-error coordinates, version conflicts,
+ reading diagnostics, liveness, the convergence budget, repair ownership, and verifying
+ before summarizing
+- Section 2 — Summary: the CREATE, EDIT, and unresolved-diagnostics report formats
+
+## 0. Compile Gates
+
+Compilation is not a final step. Three gates precede this workflow:
+
+1. The planner compiles `[working directory]/App.pa.yaml` immediately after writing it.
+2. The orchestrator confirms that result before dispatching builders.
+3. The orchestrator compiles after each **wave** of builders returns, before dispatching
+ the next wave.
+
+Gate 3 exists because builders work from a shared plan. A defect in the first wave is
+almost certainly repeated in every later screen. Catching it after three files is cheap;
+repairing it across six finished files is not.
+
+When gate 3 reveals a systemic defect:
+
+- Repair the files that already exist in place, with targeted `Edit` calls.
+- Correct the shared plan and the briefs for rows **not yet dispatched**, so the next wave
+ does not repeat the defect.
+- Never re-dispatch a builder whose file already exists. A regenerated screen discards the
+ repairs you just made. The only exception is a builder that returned `Status: Blocked`.
+
+A between-wave compile only sees the screens written so far, so a `Navigate` to a screen
+scheduled for a later wave reports `Name isn't recognized: '<ScreenName>'`. That is
+expected. Confirm the name matches a remaining dispatch row and leave it alone — deleting
+the navigation to satisfy an intermediate compile breaks the finished app.
+
+## 1. Compile
+
+Call `compile_canvas`.
+
+If compilation fails, fix diagnostics in this order:
+
+1. `YamlInvalidSyntax` parse errors
+2. Control template version conflicts — `Control type '...@X' has a version that is newer
+ than the current version of 'Y'` and `Another instance of control type '...' has
+ already been referenced using a different version`
+3. `An entity with name '...' already exists` duplicate-name errors
+4. `Unknown property ...` errors
+5. `[Control 'App', Property '...']` errors
+6. Remaining diagnostics
+
+For each tier:
+
+1. Read every referenced absolute path in the working directory.
+2. Fix all diagnostics in the tier.
+3. Re-run `compile_canvas` before moving to the next tier.
+
+Repeat until compilation succeeds. Do not chase cascading screen errors before earlier
+tiers are clean.
+
+### Parse errors carry coordinates — use them
+
+`YamlInvalidSyntax` reasons report `Line`, `Col`, and for duplicate keys the location of
+the first use. Open that exact line. A parse failure is always one wrong character — a
+missing `=`, an unquoted `: `, a mis-indented key, a `Children:` entry without its `- `,
+or a repeated property key. It is never a reason to rewrite a screen, and re-reading the
+whole file instead of jumping to the reported line is the slowest possible response.
+
+`${PLUGIN_ROOT}/references/YamlSyntax.md` maps every reason string to its cause.
+
+**Sweep the file before you re-compile.** A parse error aborts the file, so the compiler
+reports only the *first* one it meets — the second instance of the identical mistake is
+invisible until you fix the first. After correcting an unquoted `: ` in a formula, a
+mis-indented `Children:` entry, or a duplicate property key, read the rest of that file and
+fix every other occurrence of the same pattern in the same pass. Otherwise each one costs a
+full compile cycle and burns the convergence budget on a single defect.
+
+### Version conflicts masquerade as unknown properties
+
+Tier 2 sits above `Unknown property` for a reason. When any `Control:` value carries an
+`@version` suffix, the whole app binds to one template version, and every property that
+exists only in the *other* version is then reported as
+`Unknown property 'P' for control type 'T'` — where `T` is the internal control name, not
+the name you wrote. The properties are fine; the version pin is not.
+
+Symptoms of this exact failure:
+
+- Dozens of `Unknown property` errors naming common properties (`Color`, `FontWeight`,
+ `Default`, `Font`, `Fill`) on modern controls.
+- A control type in the message that does not match what you wrote — `'Text'` when your
+ YAML says `ModernText`.
+- One or two version diagnostics buried in the same compile output.
+
+The fix is always the same: strip every `@version` suffix from every `Control:` value in
+every file, then re-compile once. Do not edit a single property until you have done that.
+
+### Reading diagnostics
+
+`compile_canvas` output is repetitive: one root cause emits a near-identical message for
+every control that touches it. A single bad collection field name can produce hundreds of
+lines. Reading all of them wastes the context you need to fix them.
+
+- Collapse the diagnostic list to **distinct messages** before reasoning about it. Ten
+ occurrences of `[Control 'X', Property 'Items'] ... invalid arguments` are one problem,
+ not ten.
+- Never read more than the first ~30 distinct diagnostics before re-compiling.
+- If the result is spilled to a temp file because it is too large, that is itself a signal
+ that you are looking at cascading symptoms. Fix the highest tier present and re-compile
+ rather than paging through the whole dump.
+- Fix by root cause, not by occurrence. One `App.pa.yaml` correction routinely clears
+ several hundred downstream errors.
+
+### Liveness
+
+Every turn in the repair phase must end in an `Edit` or a `compile_canvas`. Those are the
+only two actions that change the outcome.
+
+After **two consecutive turns** containing neither, stop and emit the unresolved-diagnostics
+report in section 2. Do not spend a third. A repair phase that has stopped writing and
+stopped compiling is not thinking — it is searching for a capability that does not exist,
+and it will not recover on its own.
+
+Reading a file, planning an approach, or delegating is not progress on its own. If you find
+yourself unable to express a fix with `Edit`, return to the named file and diagnostic
+location. Repeated identical lines need separate targeted edits with enough surrounding
+context to make each match unique.
+
+### Convergence budget
+
+Track the count of **distinct** diagnostics after every compile.
+
+- Allow at most 5 compile-and-fix cycles. A cycle is one failed compile followed by your
+ repair; the planner's `App.pa.yaml` gate does not count.
+- Compare counts within the same tier. Clearing a parse error or a version conflict
+ **reveals** diagnostics that were previously suppressed, so the total can legitimately
+ rise — that is progress, not regression. Reset your baseline whenever a higher tier is
+ cleared.
+- Within one tier, if the distinct count does not strictly decrease across two consecutive
+ cycles, stop. You are guessing, not converging.
+- If two consecutive compiles return the *same* distinct diagnostic set, your last edit
+ changed nothing that mattered. Do not compile a third time hoping for a different
+ answer. Re-read the exact file and line the diagnostic names, and fix that text.
+- On stopping, report the remaining diagnostics explicitly as described in section 2.
+ Never loop indefinitely and never claim success you have not observed.
+
+### Repair ownership
+
+You repair the app yourself. You already hold the plan, the dispatch table, and the
+diagnostic history, and a fresh agent would have to rediscover all of it.
+
+- Fix compile diagnostics with targeted `Edit` calls against the named file. This is
+ always the correct response to a diagnostic.
+- Do not spawn a general-purpose agent to "fix compilation." That restarts discovery from
+ zero and has no shared budget with you.
+- **Do not re-invoke `canvas-app-planner` and re-dispatch builders to regenerate screens
+ because the app failed to compile.** A regenerated screen is a new screen: the fixes you
+ already landed are gone and a new set of defects arrives in their place. That loop does
+ not converge; a handful of targeted edits does.
+- The only sanctioned re-delegation is back to `canvas-app-planner` when a builder
+ returned `Status: Blocked` because its brief was genuinely missing a definition or an
+ assignment field — never for a diagnostic on a file that already exists.
+
+Never modify `[working directory]/_EditorState.pa.yaml` while repairing diagnostics.
+
+### Verify before you summarize
+
+The summary must describe a compile you actually observed. Before writing it, confirm that
+**no `.pa.yaml` file has been edited since the last successful `compile_canvas`.** If one
+has, compile again — a clean result from before your last edit says nothing about what you
+shipped.
+
+Edits to non-compiled artifacts do not invalidate the result: `canvas-app-plan.md`,
+`canvas-app-shared.md` and `*.screen-plan.md` are planning documents, and updating one
+after the final compile is fine.
+
+## 2. Summary
+
+For CREATE:
+
+```markdown
+**App generation complete.**
+
+| Screen | File | Status |
+|--------|------|--------|
+| [Screen] | [file].pa.yaml | Created |
+
+**Compiled clean** after [N] pass(es).
+```
+
+For EDIT:
+
+```markdown
+**Edit complete.**
+
+| Action | Screen | File | Status |
+|--------|--------|------|--------|
+| [Create / Modify] | [Screen] | [file].pa.yaml | Done |
+
+**Compiled clean** after [N] pass(es).
+```
+
+If diagnostics remain after the convergence budget is exhausted, report them explicitly
+instead of claiming completion:
+
+```markdown
+**App generated with unresolved diagnostics.**
+
+| Screen | File | Status |
+|--------|------|--------|
+| [Screen] | [file].pa.yaml | Created |
+
+**Compile status:** [N] distinct diagnostics remain after [M] pass(es).
+
+| Diagnostic | Occurrences | File |
+|------------|-------------|------|
+| [message] | [count] | [file] |
+
+[One line on what was tried and what is likely blocking.]
+```
diff --git a/plugins/canvas-apps/references/YamlSyntax.md b/plugins/canvas-apps/references/YamlSyntax.md
new file mode 100644
index 000000000..5138f692e
--- /dev/null
+++ b/plugins/canvas-apps/references/YamlSyntax.md
@@ -0,0 +1,244 @@
+# Canvas App YAML — File Structure and Syntax
+
+How a `.pa.yaml` file is shaped, the syntax rules that decide whether it parses, and the
+starting workspace every new app arrives with.
+
+**Who does what.** Discovery and compilation belong to the orchestrator and the
+`canvas-app-planner`: they run `list_controls`, `describe_control`, the data and API
+tools, and `compile_canvas`. A `canvas-screen-builder` has only `Read`, `Write` and
+`Edit` — it never discovers and never compiles, and relies entirely on the property names,
+enum names and variants recorded in its screen brief. Where these guides say "run
+`list_controls`" or "compile early", that instruction is addressed to the orchestrator and
+planner.
+
+## Contents
+
+- Before you write YAML
+- File structure
+- `Variant` is required for controls that declare variants
+- Multi-line formulas
+- Values containing `: ` must be quoted
+- Power Fx record literals must be quoted
+- Every property value starts with `=`
+- Reading `YamlInvalidSyntax` reasons
+- The starting workspace — `Screen1` and `_EditorState.pa.yaml`
+- App configuration
+
+## Before you write YAML
+
+1. ⚠️ **Run `list_controls` first — this is non-optional.** Controls you don't know exist
+ can't influence your design, and the catalog includes high-level controls that are
+ expensive to reinvent from primitives.
+2. Run `describe_control` for every control type you intend to use, and record the exact
+ property names, `Enum name:` lines and variants.
+3. Review this guide, `${PLUGIN_ROOT}/references/ControlGuide.md`,
+ `${PLUGIN_ROOT}/references/LayoutGuide.md` and
+ `${PLUGIN_ROOT}/references/DesignGuide.md` before designing a screen.
+4. Plan state: the variables each screen sets, and where they are initialized.
+5. Choose a layout strategy: AutoLayout for responsive, ManualLayout only for fixed
+ desktop dashboards.
+6. Compile early and often rather than saving validation for the end.
+
+## File structure
+
+Have one `.pa.yaml` file for the App object, and a separate file for each screen.
+
+```yaml
+Screens:
+ ScreenName:
+ Properties: # Optional screen-level properties
+ Fill: =RGBA(...)
+ OnVisible: |- # Initialize variables on screen load
+ =Set(var1, value);
+ Set(var2, value)
+ Children:
+ - ControlName:
+ Control: ControlType
+ Variant: VariantName # Required for controls that declare variants
+ Properties:
+ PropertyName: =formula
+ Children: # Only for controls with children
+ - NestedControl:
+ ...
+```
+
+### `Variant` is required for controls that declare variants
+
+`Variant` is not a styling nicety. A control whose template declares variants has no
+default, and omitting the key fails the compile:
+
+```text
+The keyword 'Variant' is required but is missing or empty.
+```
+
+The message names no file and no control, so it is expensive to locate after the fact.
+The two you will use constantly are:
+
+| Control | Allowed `Variant` values |
+|---------|--------------------------|
+| `GroupContainer` | `AutoLayout`, `GridLayout`, `ManualLayout` |
+| `Gallery` | `Vertical`, `Horizontal`, `VariableHeight` (and many layout presets) |
+
+`Form` (`Modern`, `Classic`) and the data-card and data-grid-column controls also require
+one. `describe_control` lists a `Variants` section for any control that needs it — if that
+section is present, the key is mandatory.
+
+## YAML syntax rules
+
+### Multi-line formulas — use `|-`
+
+Any formula that spans multiple lines must use the `|-` block scalar. The `=` prefix goes
+on the first content line, not on the `|-` line:
+
+```yaml
+OnSelect: |-
+ =Set(x, 1);
+ Set(y, 2)
+```
+
+Single-line formulas can be written inline:
+
+```yaml
+Text: =firstName & " " & lastName
+```
+
+### Any value containing `: ` must be quoted — including formulas
+
+YAML treats `key: value` as a mapping, so a plain (unquoted) scalar may not contain a
+colon followed by a space *anywhere*. This bites hardest on the most ordinary thing in a
+canvas app: a label that concatenates a caption with a value.
+
+```yaml
+# WRONG — the value is a plain scalar containing ": ", so YAML splits it
+HintText: =Label: enter a value
+Text: ="Location: " & ThisItem.Location
+AccessibleLabel: ="Votes: " & ThisItem.Votes
+
+# RIGHT — single-quote the whole value; inner double quotes need no escaping
+HintText: '="Label: enter a value"'
+Text: '="Location: " & ThisItem.Location'
+AccessibleLabel: '="Votes: " & ThisItem.Votes'
+
+# ALSO RIGHT — a block scalar has no such restriction
+Text: |-
+ ="Location: " & ThisItem.Location
+```
+
+The failure is reported as:
+
+```text
+An error occurred while parsing PaYaml. Error code: YamlInvalidSyntax;
+Reason: While scanning a plain scalar value, found invalid mapping.
+```
+
+It names no control and no line, so it is expensive to hunt down after the fact. Scan for
+`: ` in every value as you write it. The rule covers hint text, headings, tooltips, and
+any `Text`, `Content`, `Title`, `Subtitle` or `AccessibleLabel` that formats a caption.
+
+### Power Fx record literals must be quoted — `={Value: "..."}` will fail
+
+A Power Fx record literal looks like `{Value: "x"}`, but in a YAML plain scalar that
+`Value:` is parsed as a YAML mapping key before Power Fx ever sees it. Always wrap record
+literals in a quoted YAML string:
+
+```yaml
+# WRONG — YAML parses `Value:` as a mapping key, formula never runs
+Default: ={Value: "Tab1"}
+
+# RIGHT — outer quotes make the whole thing a YAML string first
+Default: "={Value: ""Tab1""}"
+
+# Also valid — single quotes (no escaping needed for inner double quotes)
+Default: '={Value: "Tab1"}'
+```
+
+This applies anywhere a record literal appears inline: `Default`, `Selected`, `Items`
+(when hardcoded), and similar properties. `ModernTabList.Default` is the most common place
+this bites.
+
+### Every property value starts with `=`
+
+A `.pa.yaml` property value is a Power Fx expression, not a YAML literal. Omitting the
+`=` fails the whole file:
+
+```text
+An error occurred while parsing PaYaml. Error code: YamlInvalidSyntax;
+Reason: Power Fx expressions must start with '='.
+```
+
+```yaml
+# WRONG
+Text: Weekly Timesheet
+Width: 320
+Visible: true
+
+# RIGHT
+Text: ="Weekly Timesheet"
+Width: =320
+Visible: =true
+```
+
+With a `|-` block the `=` goes on the first content line, never on the `|-` line itself.
+
+### Reading `YamlInvalidSyntax` reasons
+
+A file that fails to parse reports **no other diagnostics**, so its real errors stay
+hidden until it parses. Fix these first, and map the reason string directly to a cause:
+
+| Reason | Cause | Fix |
+|--------|-------|-----|
+| `Power Fx expressions must start with '='` | A property value missing its `=` prefix | Add `=`; quote literal text as `="..."` |
+| `While scanning a plain scalar value, found invalid mapping` | An unquoted value containing `: ` — a caption concatenation or a record literal | Wrap the whole value in `'...'`, or convert it to a `|-` block |
+| `Expected 'MappingEnd', got 'Scalar' (at Line: N, Col: N)` | A key indented to the wrong level | Go to the reported line and align it with its siblings |
+| `While parsing a block collection, did not find expected '-' indicator` | A `Children:` entry written without its leading `- ` | Add `- ` before the control name |
+| `Named object value cannot be null` | A key with nothing after it — an empty `Properties:`, or a property with no value | Give it a value or delete the key |
+| `Duplicate name 'X' used at ...` | The same property key written twice in one `Properties:` block | Delete the duplicate; the message reports the first use's line and column |
+| `While scanning a multi-line double-quoted scalar, found wrong indentation` | A quoted string wrapped across lines | Put it on one line, or convert the property to a `|-` block |
+| `found character that cannot start any token` | A tab character | Replace tabs with spaces |
+
+**Use the coordinates.** These messages carry `Line`, `Col`, and — for duplicates — the
+location of the first use. Open that exact line rather than re-reading the file or
+rewriting the screen. A parse error is one wrong character, never a design problem.
+
+## The starting workspace — `Screen1` and `_EditorState.pa.yaml`
+
+A new blank app is **not** an empty workspace. It already contains:
+
+- `App.pa.yaml` — app-level properties
+- `Screen1.pa.yaml` — one default screen, possibly with an empty container scaffold
+- `_EditorState.pa.yaml` — Editor metadata (`ScreensOrder`)
+
+### Reuse `Screen1` — never leave it stranded
+
+⚠️ The most common generated-app defect is an app that ships with a blank `Screen1` next
+to the real screens. It appears in the screen list, it is usually first in `ScreensOrder`,
+and it makes the app look unfinished.
+
+**Rule:** In CREATE mode, the first screen of your design MUST be written into
+`Screen1.pa.yaml`, replacing its contents wholesale. Keep the top-level key as `Screen1`
+so `_EditorState.pa.yaml` stays consistent, and give every control inside it a meaningful
+name.
+
+```yaml
+# Screen1.pa.yaml — the app's first real screen. Do NOT create "Home.pa.yaml"
+# and leave this file blank.
+Screens:
+ Screen1:
+ Properties:
+ Fill: =RGBA(18, 18, 20, 1)
+ OnVisible: =Set(varSelectedTab, "Sessions")
+ Children:
+ - HomeRoot:
+ Control: GroupContainer
+ Variant: AutoLayout
+ ...
+```
+
+Never edit `_EditorState.pa.yaml`; Studio owns it.
+
+## App configuration
+
+- ✅ Set `App.StartScreen` to the intended landing screen — `=Screen1` in CREATE mode.
+- ✅ Write your first screen into the pre-existing `Screen1.pa.yaml`.
+- ❌ Never call `Navigate` from `App.OnStart` or from the start screen's `OnVisible`. The
+ compile reports `Navigate is not permitted in OnStart`; set `App.StartScreen` instead.
diff --git a/plugins/canvas-apps/skills/canvas-app/SKILL.md b/plugins/canvas-apps/skills/canvas-app/SKILL.md
index 0d7217827..35adedddc 100644
--- a/plugins/canvas-apps/skills/canvas-app/SKILL.md
+++ b/plugins/canvas-apps/skills/canvas-app/SKILL.md
@@ -1,407 +1,151 @@
---
name: canvas-app
-version: 2.0.0
-description: Creates or edits a Power Apps Canvas App through the Canvas Authoring MCP coauthoring session. Handles new app generation from requirements, simple inline edits, and complex multi-screen changes with parallel screen builders. Triggers on requests to create, build, generate, modify, update, change, or edit a Canvas App or .pa.yaml files.
+version: 3.0.0
+description: Creates or edits a Power Apps Canvas App through the Canvas Authoring MCP coauthoring session. Handles new app generation, direct targeted edits, complex multi-screen changes, responsive layout, per-screen self-QA, and compile-error convergence. Trigger on requests to create, build, generate, modify, update, change, fix, or edit a Canvas App or .pa.yaml files.
author: Microsoft Corporation
user-invocable: true
-allowed-tools: Read, Write, Edit, Bash, AskUserQuestion, Task, TaskCreate, TaskUpdate, TaskList, EnterPlanMode, ExitPlanMode, mcp__canvas-authoring__sync_canvas, mcp__canvas-authoring__compile_canvas
+allowed-tools: Read, Write, Edit, Bash, AskUserQuestion, Task, TaskCreate, TaskUpdate, TaskList, EnterPlanMode, ExitPlanMode, mcp__canvas-authoring__sync_canvas, mcp__canvas-authoring__compile_canvas, mcp__canvas-authoring__describe_control
---
# Create or Edit a Canvas App
-Create or edit a Power Apps canvas app for the following requirements:
+Create or edit a Power Apps canvas app for:
$ARGUMENTS
-## Overview
-
-This skill handles both **creating** and **editing** canvas apps through a unified workflow.
-It syncs the current app state to detect whether the app has existing content, then routes
-accordingly:
-
-- **CREATE mode** — the app is empty or has no meaningful content; a new app is generated
- from scratch using a preferences wizard and parallel screen builders.
-- **EDIT mode (simple)** — the app has existing content and the requested changes are small;
- edits are applied inline without planning agents.
-- **EDIT mode (complex)** — the app has existing content and the requested changes are
- substantial; a planner designs the changes and parallel screen builders execute them.
-
-Two specialist agents are used for planned work:
-
-1. **`canvas-app-planner`** — discovers available controls, APIs, and data sources; gathers
- control property definitions; and writes the shared plan document (`canvas-app-plan.md`)
- and `App.pa.yaml`. Receives the approved plan from the skill.
-2. **`canvas-screen-builder`** — writes or modifies exactly one screen's YAML; multiple
- builders run in parallel after the plan is approved
-
-You (the skill) coordinate the agents, detect mode, design and present the plan for user
-approval, and own the compilation + error-fixing loop after all screens are written.
-
----
-
-## Phase 0 — Create App Folder
-
-Before syncing or editing, create a subfolder to contain the app's YAML files:
-
-1. Extract the app name or a 2–4 word summary from `$ARGUMENTS`
-2. Convert to kebab-case (e.g., "Expense Tracker" → `expense-tracker`, "my travel planner" →
- `my-travel-planner`)
-3. Create the folder using `Bash`: `mkdir -p <folder-name>`
-4. Resolve its absolute path — this is the **working directory** for all subsequent phases
-
-Pass this absolute path as the working directory in every agent prompt below.
-
----
-
-## Phase 1 — Sync
-
-Call the `sync_canvas` MCP tool targeting the working directory. This pulls the current app
-state from the coauthoring session into local `.pa.yaml` files. Only proceed after
-`sync_canvas` completes successfully.
-
----
-
-## Phase 2 — Detect Mode
-
-After `sync_canvas` completes, read the synced `.pa.yaml` files and check whether the app
-has meaningful content. An app is considered **empty** if:
-
-- No `.pa.yaml` files were written, or
-- The only files present contain no screens, or
-- Every screen present has no controls (only bare screen-level YAML with no children), or
-- Every screen's controls consist solely of containers (e.g., `GroupContainer`) with no
- leaf controls inside them
-
-**If the app is empty → CREATE mode.** Proceed to Phase 3.
-
-**If the app has meaningful content → EDIT mode.** Skip Phase 3 and proceed to Phase 4.
-
----
-
-## Phase 3 — Gather Preferences (CREATE mode only)
-
-Use `AskUserQuestion` to collect design preferences that cannot be reliably inferred from
-`$ARGUMENTS`. **Parse `$ARGUMENTS` first** to determine which questions to skip — but a
-short request like "visitor check-in app" or "expense tracker" leaves most preferences
-unspecified and you MUST ask.
-
-Call `AskUserQuestion` with the applicable questions from the table below (include only the
-ones that need answers):
-
-| Question | Header | When to Ask | Options |
-|----------|--------|-------------|---------|
-| 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)* |
-| 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 |
-| 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 |
-| 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)* |
-
-**Rules:**
-
-1. If the user provides a screenshot (either attached with their original request or via the
- wizard), examine it to extract structural cues (layout, navigation pattern) and visual cues
- (color palette, density, typography). Use these to inform the aesthetic direction — do not
- ask the aesthetic question separately.
-2. **If all questions are already answered by `$ARGUMENTS` and any attached images, skip the
- wizard entirely** and proceed directly to Phase 5.
-3. Ask all applicable questions in a single `AskUserQuestion` call — do not ask them one at a time.
-4. Store all answers for use in the planner prompt below.
-
-**Target users & device influence design decisions:**
-- **Desktop users** → data-dense layouts, tables, keyboard-friendly, multi-column. ManualLayout acceptable for pixel-perfect dashboards.
-- **Tablet users** → touch-friendly targets, medium density, AutoLayout (responsive) so the app adapts to landscape/portrait.
-- **Phone users** → large touch targets, single-column, simplified navigation, AutoLayout (responsive), minimal typing.
-- **Multi-device / unknown** → AutoLayout (responsive) required.
-
-After collecting preferences, proceed to Phase 5 (Plan).
-
----
-
-## Phase 4 — Assess Complexity (EDIT mode only)
-
-Read all synced `.pa.yaml` files. Based on `$ARGUMENTS` and the current app state, determine
-whether this is a **simple** or **complex** edit:
-
-**Simple** — all of the following are true:
-- Changes affect ≤ 2 controls or properties
-- Changes are confined to ≤ 1 screen
-- No new screens are being added
-- No new data sources or connectors are needed
-- No structural layout changes (e.g., not changing ManualLayout to AutoLayout)
-
-Examples: change a button color, update label text, fix a formula, adjust a control size.
-
-**Complex** — any of the following are true:
-- Changes span multiple screens
-- One or more new screens need to be created
-- New data sources or connectors are required
-- Structural layout changes are involved
-- Significant visual redesign of a screen
-
-Examples: add a settings screen, redesign the home screen layout, integrate a new connector,
-change the navigation flow across the app.
-
-- If **simple**: proceed to Phase 4a.
-- If **complex**: proceed to Phase 5 (Plan).
-
-### Phase 4a — Simple: Direct Edit
-
-Read `${PLUGIN_ROOT}/references/TechnicalGuide.md` before making changes.
-
-Apply the changes directly:
-
-1. **Edit** the relevant `.pa.yaml` files with the required changes, following conventions
- from TechnicalGuide.md.
-
-2. **Validate** by calling `compile_canvas` on the working directory after making changes.
- On failure, read the errors, fix with `Edit`, and re-compile. Iterate until clean.
-
-3. Present a brief summary:
- > **Edit complete.** [1-2 sentence description of what was changed.] Compiled clean after [N] pass(es).
-
-**Stop here.** The simple edit path is complete — do not continue to Phase 5 or beyond.
-
----
-
-## Phase 5 — Plan
-
-You (the skill) own plan design and user approval. After approval, invoke the
-`canvas-app-planner` agent to discover resources, gather control definitions, and write the
-plan document.
-
-### Step 5.1 — Read Reference Documents
-
-Read both reference documents before designing the plan:
-
-- `${PLUGIN_ROOT}/references/TechnicalGuide.md`
-- `${PLUGIN_ROOT}/references/DesignGuide.md`
-
-Internalize both. These govern every design decision you will make.
-
-### Step 5.2 — Design the Plan
-
-#### CREATE mode
-
-Based on the user preferences from Phase 3 and the user's requirements, reason through:
-
-- How many screens are needed and what each does
-- Which controls will drive each screen's layout
-- What aesthetic direction fits the app's purpose
-- How data will flow (data sources, collections, or mock data)
-- **Layout strategy** — follow the layout decision rules in TechnicalGuide.md
-
-#### EDIT mode
-
-Read all `.pa.yaml` files in the working directory (you may have already read them in
-Phase 4). Based on the current app state and the user's edit requirements, reason through:
-
-- Which screens need to be modified and what specific changes are needed
-- Whether any new screens need to be created
-- How changes can be made while preserving the existing app's aesthetic and layout consistency
-- Any new controls, data sources, or variables required
-
-### Step 5.3 — Present Plan for Approval
-
-Enter plan mode (`EnterPlanMode`) and present the plan.
-
-#### CREATE mode
-
-```
-## Canvas App Plan
-
-### Screens ([N] total)
-
-| Screen | File | Purpose | Key Controls |
-|--------|------|---------|--------------|
-| [Name] | [Name].pa.yaml | [one-line description] | [2-3 controls] |
-
-### Data Strategy
-[How data will be loaded — data sources used, or "collections/mock data"]
-
-### Aesthetic Direction
-[e.g., "Bold & editorial — high-contrast dark background, accent RGBA(255,90,60,1), card-based layout, strong typographic hierarchy"]
-```
-
-#### EDIT mode
-
+## Establish the Workspace
+
+Canvas Authoring tools operate on a local directory containing the app YAML.
+
+1. Reuse the current directory when it already contains `App.pa.yaml`.
+2. Otherwise, reuse the single immediate child directory containing `App.pa.yaml`, when
+ exactly one exists.
+3. Otherwise, derive a short kebab-case folder name from the app name or requirements,
+ create it with `Bash`, and resolve its absolute path.
+4. Call `sync_canvas` with that absolute working directory before reading or editing app
+ files. Do not proceed if sync fails.
+
+Always use absolute paths for app files. Never edit `_EditorState.pa.yaml`; Studio owns it.
+
+## Route the Request
+
+Inspect the synced `.pa.yaml` files before choosing a workflow. A blank app normally
+contains `App.pa.yaml`, `Screen1.pa.yaml`, and `_EditorState.pa.yaml`.
+
+Treat the app as empty when it has no screens with meaningful leaf controls. Containers
+without leaf controls do not make the app non-empty.
+
+- **Empty app:** read `${PLUGIN_ROOT}/references/CreateWorkflow.md` and follow it.
+- **Existing app:** read `${PLUGIN_ROOT}/references/EditWorkflow.md` and follow it.
+
+Do not load both workflow documents.
+
+## Planned Build Handoff
+
+CREATE and complex EDIT workflows return here after the planner finishes.
+
+1. Read the absolute `canvas-app-plan.md` path returned by the planner.
+2. Verify its `## Requirement Coverage` table maps every concrete requested noun and
+ interaction to a visible affordance. Any approximation must be explicit and must not
+ use UI copy that claims the unavailable interaction is exact.
+3. Verify its `## Dispatch` table:
+ - Every row has `Action`, `Screen`, `Target File`, `YAML Key`, `Name Prefix`, and
+ `Screen Brief`.
+ - CREATE rows use `Create`; EDIT rows use `Modify` or `Create`.
+ - Target files and screen briefs are absolute paths under the working directory.
+ - No two rows target the same file.
+ - No two rows share a `Name Prefix`.
+ - In CREATE mode the first row targets `Screen1.pa.yaml` with YAML key `Screen1`.
+4. Confirm `canvas-app-shared.md` and every dispatch row's screen brief exist. Verify each
+ brief's assignment matches its dispatch row.
+5. In EDIT mode, apply the `### Before builders` group of `## App Changes` to
+ `App.pa.yaml` now. Screens bind to those collections, formulas and variables, and
+ compiling them against a stale app file produces false name errors.
+6. Confirm the planner reported a clean `compile_canvas` for CREATE-mode `App.pa.yaml`.
+ If it did not, compile now and resolve every App-level diagnostic before dispatching.
+ For EDIT mode, compile after applying the before-builder app changes and resolve
+ App-level diagnostics before dispatching.
+7. Invoke `canvas-screen-builder` once per dispatch row, in parallel waves of at most
+ three. Wait for the whole wave to return before dispatching the next.
+
+Never dispatch more than three builders at once. Larger fan-outs can hang, and waves of
+three expose systemic defects before every screen repeats them.
+
+If any pre-dispatch check fails, do not start builders. Re-invoke `canvas-app-planner`
+with the specific defects and repeat the checks on the corrected artifacts.
+
+Pass each builder only:
+
+```text
+Action: [Create / Modify]
+Screen: [logical screen name]
+Target file: [absolute .pa.yaml path]
+YAML screen key: [key from dispatch row]
+Control name prefix: [prefix from dispatch row]
+Shared plan: [absolute canvas-app-shared.md path]
+Screen brief: [absolute screen-plan.md path]
+Plugin root: ${PLUGIN_ROOT}
```
-## Canvas Edit Plan
-
-### Screens to Modify ([N] total)
-
-| Screen | File | Summary of Changes |
-|--------|------|--------------------|
-| [Name] | [Name].pa.yaml | [one-line description of changes] |
-
-### Screens to Add ([N] total, if any)
-
-| Screen | File | Purpose |
-|--------|------|---------|
-| [Name] | [Name].pa.yaml | [one-line description] |
-
-### Approach
-[e.g., "Preserving existing dark theme — updating button palette on Home screen and adding a
-new Settings screen with consistent RGBA values extracted from existing files"]
-```
-
-#### Both modes
-
-Then call `ExitPlanMode` to request user approval.
-
-- If approved: proceed to Step 5.4.
-- If changes requested: revise the plan and re-enter plan mode with the updated version.
-
-### Step 5.4 — Invoke Planner Agent
-
-After approval, invoke the `canvas-app-planner` agent using the `Task` tool. The agent
-will discover available resources, gather control property definitions, write `App.pa.yaml`
-(CREATE only), and write `canvas-app-plan.md`.
-
-Pass a prompt that includes the **approved plan**. The agent does NOT redesign the plan or
-interact with the user — it discovers resources, enriches the plan with control definitions,
-and writes the output files.
-
-#### CREATE mode
-
-Example prompt:
-
-> You are the canvas-app-planner agent. Write the plan document for a Canvas App.
->
-> Mode: CREATE
->
-> Requirements: [paste $ARGUMENTS here]
->
-> Approved plan:
-> [paste the full plan you presented in Step 5.3 — screens, data strategy, aesthetic
-> direction, all RGBA values]
->
-> User preferences (from wizard):
-> - Target users & device: [answer]
-> - Aesthetic direction: [answer]
-> - Features: [answer]
-> - Reference image: [observations, or "none provided"]
->
-> Working directory: [absolute path from Phase 0]
-> Plugin root: ${PLUGIN_ROOT}
->
-> Follow the instructions in your agent file. Discover resources, gather control
-> definitions, write App.pa.yaml and canvas-app-plan.md to the working directory. Return
-> the screen list and plan document path when complete.
-
-#### EDIT mode (complex)
-
-Example prompt:
-
-> You are the canvas-app-planner agent. Write the plan document for edits to a Canvas App.
->
-> Mode: EDIT
->
-> Edit requirements: [paste $ARGUMENTS here]
->
-> Approved plan:
-> [paste the full plan you presented in Step 5.3 — screens to modify/add, approach,
-> all RGBA values]
->
-> Current app state:
-> - Palette: [exact RGBA values extracted from existing files]
-> - Variables: [variable names found in existing files]
-> - Layout strategy: [AutoLayout / ManualLayout as found in existing files]
-> - Screens: [list of existing screens and their key controls]
->
-> Working directory: [absolute working directory path]
-> Plugin root: ${PLUGIN_ROOT}
-> Synced files: [list of .pa.yaml filenames]
->
-> Follow the instructions in your agent file. Discover resources for new controls, gather
-> control definitions, write canvas-app-plan.md to the working directory. Return the list
-> of screens and the plan document path when complete.
-
-**Wait for the planner to finish.** Do not proceed to Phase 6 until the planner task
-completes successfully.
-
----
-
-## Phase 6 — Build / Edit
-
-After the planner completes, read `canvas-app-plan.md` from the working directory.
-
-Extract the screen list from the `## Screens` table — collect each screen name, its target
-file name, and its action (Create or Modify).
-
-Invoke one `canvas-screen-builder` agent per screen. **Fire all invocations in a single
-message** (parallel execution) — do not wait for one screen to finish before starting the
-next.
-
-For each screen, pass a prompt that includes:
-
-- Screen name (e.g., "Home")
-- Target file name (e.g., "Home.pa.yaml")
-- Action: "Create" (new screen) or "Modify" (existing screen being edited)
-- Absolute path to `canvas-app-plan.md`
-- Working directory
-
-Example prompt per screen:
-
-> You are the canvas-screen-builder agent. [Create / Modify] the **[Screen Name]** screen.
->
-> - Action: [Create / Modify]
-> - Target file: [ScreenName].pa.yaml
-> - Plan document: [absolute path to canvas-app-plan.md]
-> - Working directory: [absolute path from Phase 0]
->
-> Follow the instructions in your agent file. [Write / Edit] [ScreenName].pa.yaml and return
-> your result when done. Do not call compile_canvas — validation is handled by the skill.
-
-Wait for all screen-builder tasks to complete before proceeding.
-
----
-
-## Phase 7 — Validate and Fix
-
-After all screen-builders have finished writing their files, call `compile_canvas` on the
-working directory.
-
-**On success:** Proceed to Phase 8.
-
-**On failure:** Read every error in the output. Errors will reference specific files and
-line numbers. For each error:
-
-1. `Read` the referenced `.pa.yaml` file
-2. Fix the error using `Edit`
-3. After fixing all errors from this pass, call `compile_canvas` again
-
-Repeat until `compile_canvas` reports no errors. Do not give up after a single fix attempt —
-iterate until the entire directory compiles clean.
-
-Track how many `compile_canvas` passes were needed.
-
----
-
-## Phase 8 — Summary
-
-Delete `canvas-app-plan.md` from the working directory using `Bash`:
-`rm <working-directory>/canvas-app-plan.md`
-
-Present a final summary based on the mode:
-
-**CREATE mode:**
-
-> **App generation complete.**
->
-> | Screen | File | Status |
-> |--------|------|--------|
-> | [Screen Name] | [filename].pa.yaml | Created |
->
-> **Compiled clean** after [N] pass(es). | **Screens:** [N] | **Data:** [source or collections]
-
-**EDIT mode (complex):**
-
-> **Edit complete.**
->
-> | Action | Screen | File | Status |
-> |--------|--------|------|--------|
-> | [Create / Modify] | [Screen Name] | [filename].pa.yaml | Done |
->
-> **Compiled clean** after [N] pass(es).
-If any errors remain after exhausting fixes, report them explicitly so the user knows what
-needs manual attention.
+The target file, YAML key, and name prefix are authoritative. Modify actions preserve the
+key already present in the target file.
+
+Compile after each wave returns, before dispatching the next. A systemic mistake in the
+first wave is usually repeated in every later screen. Repair files that already exist in
+place; only rows still waiting for dispatch receive corrected briefs.
+
+A between-wave compile can report a `Navigate` target that belongs to a later wave as
+unrecognized. Confirm it matches a remaining dispatch row and leave it in place.
+
+After all builders finish:
+
+- Check each builder's `QA:` line. It must list an outcome for all 32 checks in
+ `${PLUGIN_ROOT}/references/QAChecks.md`. Treat these as unrun and return the existing
+ screen to the builder for self-QA only:
+ - a missing or truncated line, a line omitting any check 1-32, or a bare fix count;
+ - an outcome contradicted by the screen structure, such as check 7 `N/A` despite
+ AutoLayout children, check 18 `N/A` despite content controls, check 21 `N/A` despite
+ a coloured surface, check 24 `N/A` despite a Gallery, or check 32 `N/A` despite a
+ newly created `ModernDataGrid`;
+ - check 27 `PASS` while a responsive root has screen-level siblings;
+ - check 32 `PASS` while a multiword action directly under vertical AutoLayout lacks
+ `Width: =Parent.Width`.
+- A self-QA follow-up is not a rebuild. Ask the builder to inspect and repair the existing
+ target file, then return the corrected `QA:` line.
+- Compare every repeated navigation block against `canvas-app-shared.md`: same items,
+ order, wordmark, colours, and narrow-width behavior. Builders cannot perform this
+ app-wide comparison because each sees only one screen.
+- Reject check 23 `PASS` when a `ModernCard` displays Title, Subtitle and Description with
+ `Height < 180`; return that screen for self-QA.
+- If a builder returns `Status: Blocked`, re-invoke the planner to repair only that screen
+ brief, then rerun only that builder.
+- `Status: Blocked` is the only reason to rerun screen generation. Repair compile
+ diagnostics in place; regeneration discards fixes and does not converge.
+- In EDIT mode, apply the `### After builders` group of `## App Changes` to `App.pa.yaml`.
+ The orchestrator is the sole owner of EDIT changes to that file.
+- Read `${PLUGIN_ROOT}/references/ValidationWorkflow.md` and follow it.
+
+## Shared Invariants
+
+1. Never guess control properties. Use `describe_control`; only write properties returned
+ for that exact control type or already present on that exact existing control.
+2. Use exact RGBA values and shared variable names from approved plans.
+3. Control names are unique across the entire app, not per screen. Every new control a
+ builder writes carries that screen's assigned prefix, especially repeated nav bars,
+ headers, toolbars, and badges.
+4. Never write a version suffix on `Control:`. Write `Control: ModernText`, never
+ `Control: [email protected]`. One suffixed instance can produce hundreds of false
+ `Unknown property` diagnostics throughout the app.
+5. Never invent an enum type name. Copy the exact `Enum name:` from `describe_control`.
+ Quote enum members that start with a digit:
+ `DecimalPrecision.'1'`, not `DecimalPrecision.1`.
+6. In CREATE mode, reuse `Screen1.pa.yaml` for the landing screen and set
+ `App.StartScreen` to `=Screen1`.
+7. Never navigate from `App.OnStart` or the start screen's `OnVisible`.
+8. Keep mock data compact: roughly 5-8 short rows per collection.
+9. Builders own exactly one screen file. The planner owns CREATE-mode `App.pa.yaml`; the
+ orchestrator owns EDIT-mode `App.pa.yaml`.
+10. Compile early and after each builder wave. Never defer the first compile until every
+ file is written.
+11. Do not report completion until the workspace compiles clean or remaining diagnostics
+ are explicitly reported.