MATLAB Build App
Determine the best architecture for a MATLAB application, produce an implementation plan grounded in internal references, and execute the build. For UIFigure apps, optionally serialize into an App Designer format.
When to Use This Skill
Use this skill when:
- User wants to build a MATLAB app, GUI, or interactive tool
- User asks "how should I build this app?" or "which approach should I use?"
- User describes an application — with or without specifying an implementation path
- User mentions: MATLAB app, GUI, uifigure, uihtml, interactive tool, dashboard, visualization app, App Designer, .mlapp, plain-text app
- User describes spatial layout needs: dashboard, control panel, sidebar, tabs, wizard, stepper, canvas, workspace
- User has already chosen a path (e.g., "build me a uihtml app") — handle directly
When Not to Use
- The request is purely about MATLAB computation with no UI component
- The user is asking about an existing app they want to modify → read
references/editing-guide.md
- The user wants to convert between App Designer formats (e.g., .mlapp to plain-text or vice versa) → tell them to use File > Save As in App Designer. Do NOT attempt the conversion programmatically.
Critical Rules
- MUST ask discovery questions before recommending a path — unless the user already specified one
- MUST confirm the path choice with the user before producing the implementation plan
- MUST produce an implementation plan grounded in internal references before writing any code
- MUST write the plan to a file (
<app-name>-plan.md) in the working directory
- NEVER recommend a path without understanding the user's constraints (unless path was pre-specified)
- NEVER apply dark mode, custom colors, or visual themes unless the user explicitly requests them
- ALWAYS present the recommendation as guidance, not a mandate — the user decides
- MUST choose archetype based on the user's primary task, not aesthetics
- NEVER treat two archetypes as equals within one app — one is always the primary container
- UIFigure app: MUST use
uigridlayout for all structural layout — never Position-based sizing
- UIHTML/web app: MUST use CSS Grid or Flexbox for chrome — no absolute positioning for structural panels
- The chrome (header, sidebar, tabs, step indicator) MUST remain spatially stable
- Background execution (any operation taking more than ~1 second) requires a class-structured app and MUST be read up first in
references/background-tasks.md — do NOT hand-write parfeval/backgroundPool/DataQueue plumbing from memory. For an App Designer app (.mlapp or plain text) you MUST use the addBackgroundTask verb and NEVER hand-roll the infrastructure or reuse the standalone-programmatic manual wiring. For a standalone programmatic app, use the MVVM structure per that doc. A flat nested-function app that needs background work MUST escalate to one of these.
- App Designer serialization: MUST read
references/app-designer/agent-guide-shared.md (covers ownership models, editing discipline, property rules, quoting) plus the format-specific guide (agent-guide-mlapp.md or agent-guide-plaintext.md) before building. Those docs are the single source of truth; do not attempt to edit app files without reading them first.
Workflow
User request arrives
│
├── Path NOT specified → Full Discovery
│ │
│ ▼
│ Ask Q1-Q4 (purpose, lifespan, polish, team skills)
│ │
│ ▼
│ Identify layout archetype
│ │
│ ▼
│ Recommend UIFigure vs UIHTML based on Q1-Q4
│ │
│ ▼
│ *** STOP: Present recommendation and WAIT for user confirmation ***
│ (Do NOT produce a plan or read references until user says yes)
│ │
│ ▼
│ Ask Q5 (FINAL): Serialization format? (UIFigure apps only)
│ │
│ ├── App Designer → release check, present format choice,
│ │ continue with UIFigure references + add serialization step
│ │
│ └── Standalone programmatic → no extra step
│ │
│ ▼
│ Produce Implementation Plan → write to <app-name>-plan.md
│ │
│ ▼
│ User reviews plan → confirms or adjusts
│ │
│ ▼
│ Begin building (read references per the plan)
│
└── Path IS specified
│
├── Serialization explicit (e.g., ".mlapp app", "plain-text app")
│ → Skip Q5, proceed with stated format
│ → Ask only missing requirements + archetype if unclear
│ → Produce Implementation Plan
│
├── Architecture explicit but serialization not stated
│ (e.g., "build me a uifigure app")
│ → Still ask Q5 (serialization) before planning
│ → Ask missing requirements + archetype if unclear
│ → Produce Implementation Plan
│
└── UIHTML or standalone programmatic explicit
→ Skip Q5 entirely (not applicable)
→ Ask missing requirements + archetype if unclear
→ Produce Implementation Plan
Discovery Questions
Ask these conversationally — not as a rigid checklist. Gather requirements and layout intent first; ask the serialization question last, once you understand what the app needs to do.
Core Questions
1. What does the app do and who is it for?
What will this app do? Who will use it?
Listen for archetype signals: "dashboard", "control panel", "step-by-step", "workspace".
2. Is this a quick tool or something you'll maintain over time?
Is this meant to be maintained and evolved, or is it more of a quick, proof-of-concept tool?
- Maintained → proceed to remaining questions; team skills matter
- Ephemeral → favor UIHTML app path; can skip team question
3. How polished does the UI need to look?
Are standard MATLAB buttons, sliders, tables, and plots enough? Or do you need custom visuals — branded, animated, or visually richer?
- Standard controls sufficient → UIFigure app signal
- Custom visuals needed → UIHTML app signal
4. Who will work on this app going forward?
Will this be maintained by people comfortable only with MATLAB, or by people also comfortable with web technologies?
Only ask for maintained apps.
- MATLAB-only team → UIFigure app
- Web-comfortable team → UIHTML app
5. (FINAL) How should this app be saved?
Do you want this app to open and edit inside App Designer, or do you prefer a standalone programmatic file (no App Designer dependency)?
This is a serialization question, not an architecture question. The app's structure (components, layout, callbacks) is designed using UIFigure knowledge regardless of the answer. Q5 only determines how that design is persisted to disk.
- App Designer →
.mlapp or plain-text .m + .xml. Check release (plain-text needs R2026b+). If Q3 indicated custom visuals, note that App Designer constrains visual customization vs UIHTML and confirm.
- Standalone programmatic → programmatic
.m code, no App Designer dependency. MVVM may warrant multiple files; that is decided at build time.
Follow-up Probes (only if path isn't clear)
- Interaction style: Real-time feedback needed? → slight UIFigure lean
- Existing work: Existing MATLAB UI code? → UIFigure. Existing web assets? → UIHTML
- Distribution: May need to work outside MATLAB? → UIHTML
- Long computations: Will any operation take more than a second? → use a background task (read
references/background-tasks.md). Note this requires a class-structured app: App Designer serialization, or MVVM if standalone programmatic. Heavy, long, or one-shot work is ALWAYS a background task, never a timer; a timer fits only scheduled, cheap-per-tick work that must update the UI on the main thread (read references/timers.md).
Path Decision Logic
Two stages: first determine architecture (Q1-Q4), then determine serialization format (Q5).
Stage A — Architecture (from Q1-Q4):
Ephemeral app? → Strong default to UIHTML app
Maintained app? → Weigh signals:
Strong UIFigure signals:
✓ Maintained + MATLAB-only team
✓ Standard UI components sufficient
✓ Tight real-time interaction
✓ Existing MATLAB UI code
Strong UIHTML signals:
✓ Ephemeral (regardless of team)
✓ Maintained + web-skilled team
✓ Custom visuals, branded look, animations
✓ Existing web assets
✓ Future portability outside MATLAB
UIFigure + uihtml accent:
Mostly standard app but needs one custom visualization panel.
Stage B — Serialization format (Q5, UIFigure apps only):
Q5 = Standalone → programmatic code (no App Designer). Done.
Q5 = App Designer → adds a serialization layer ON TOP of Stage A.
UIFigure references still apply in full. Serialization is IN ADDITION TO,
not instead of, the normal UIFigure build.
→ Check release, present format choice (plain text vs .mlapp).
→ If Stage A indicated UIHTML for custom visuals, surface the trade-off:
App Designer constrains custom visuals — confirm before committing.
Weighting: 1. Architecture (Q1-Q4) 2. Serialization (Q5, applies only to UIFigure)
Paths at a Glance
| Architecture |
Key strength |
| UIFigure app |
Single language, any MATLAB dev can maintain |
| UIHTML app |
Full visual control, rich interactivity |
| UIFigure + accent |
Best of both when you need one custom visual |
For UIFigure apps, three serialization formats:
| Format |
Trade-off |
Programmatic .m |
Standalone, no App Designer dependency |
App Designer .mlapp |
Binary, works on any release, opens in App Designer |
App Designer plain text .m + .xml |
Source-controllable, AI-editable, R2026b+ |
Layout Archetype
Pick based on the user's primary task:
| Archetype |
Primary user task |
Structure |
| Dashboard |
Monitor and compare at a glance |
KPI cards + charts + table; read-only |
| Explorer |
Adjust parameters, observe live results |
Sidebar controls + live display |
| Tabbed |
Navigate between independent sections |
Tab bar + content panels |
| Wizard |
Complete a sequential workflow |
Step indicator + one-step-at-a-time |
| Canvas |
Create, inspect, or edit spatial artifacts |
Central workspace + tools |
If unclear, ask: "Will users mostly be watching results (Dashboard), tweaking controls (Explorer), switching sections (Tabbed), going through steps (Wizard), or working on a central figure (Canvas)?"
Implementation Plan
After confirming path and archetype, produce a plan and write it to <app-name>-plan.md in the working directory. Present a concise summary inline with the approval request.
Plan Template
**Implementation Plan: [App Name]**
**Architecture:** [UIFigure app / UIHTML app / UIFigure + accent]
**Serialization:** [Programmatic .m / App Designer .mlapp / App Designer plain text]
**Layout:** [Archetype] — [one sentence describing spatial structure]
**Structure:**
- [Major panel/area — spatial description]
- [e.g., "Left sidebar (220px) with date range picker, category filter, refresh button"]
- [e.g., "Main area with line chart showing filtered results"]
**Key behaviors:**
- [User-visible interaction effects]
**Internal references that will be used:**
| Reference | Role in this app |
|-----------|-----------------|
| `references/path/file.md` | [what it provides] |
| ... | ... |
**External skills:**
- `matlab-build-chart` — [role, if applicable]
- `matlab-apply-theme` — [role, if applicable]
**File organization:**
[app directory tree]
**Implementation sequence:**
1. [First reference read] — [what it establishes]
2. [Next reference] — [what it adds]
3. [...]
Each reference pointer carries provenance: [src: references/uifigure/grid-layout.md §Spanning]
Plan Quality Checks
Before presenting:
Reference Router
After plan approval, read the relevant internal references to execute the build.
UIFigure Path
| When building... |
Read |
| Grid layout, sizing, components |
references/uifigure/guide.md |
| Grid details (spanning, collapse) |
references/uifigure/grid-layout.md |
| Panels, tab groups, nested grids |
references/uifigure/containers.md |
| Component reference (controls, display) |
references/uifigure/components.md |
| Callback patterns, data sharing |
references/uifigure/callbacks.md |
| Layout recipes (sidebar, form, split) |
references/uifigure/layout-patterns.md |
| MVVM architecture (complex apps) |
references/uifigure/mvvm-guide.md |
| View binding patterns |
references/uifigure/mvvm-view-binding.md |
| ViewModel testing |
references/uifigure/mvvm-testing.md |
| Background execution — concepts + routing (read first) |
references/background-tasks.md |
| Background execution — standalone programmatic (MVVM) wiring |
references/uifigure/mvvm-background-tasks.md |
| Timers — periodic main-thread work (NOT for offloading heavy work) |
references/timers.md |
UIHTML Path
| When building... |
Read |
| MATLAB-JS bridge, setup(), events |
references/uihtml/bridge-guide.md |
| Communication patterns (4 patterns) |
references/uihtml/communication-patterns.md |
| Data type conversion |
references/uihtml/data-types.md |
| Platform constraints |
references/uihtml/platform-limitations.md |
| uihtml creation, hybrid layouts |
references/uihtml/setup.md |
| Error handling (both sides) |
references/uihtml/error-handling.md |
| JS MVVM architecture |
references/uihtml/mvvm-guide.md |
| Observable/Computed classes |
references/uihtml/mvvm-observable-classes.md |
| JS View binding |
references/uihtml/mvvm-view-binding.md |
| JS coding patterns, modules |
references/uihtml/js-coding-guide.md |
| JS testing & debugging |
references/uihtml/js-testing-debugging.md |
| Chart.js setup & patterns |
references/uihtml/charting-guide.md |
| Chart type selection |
references/uihtml/chart-type-selection.md |
| Chart.js initialization |
references/uihtml/chartjs-setup.md |
| Line & bar charts |
references/uihtml/line-bar-charts.md |
| Doughnut & scatter charts |
references/uihtml/doughnut-scatter-charts.md |
| Chart data updates |
references/uihtml/chart-updates.md |
| Chart ↔ bridge integration |
references/uihtml/chart-bridge-integration.md |
| Chart performance |
references/uihtml/chart-performance.md |
| CSS styling & tokens |
references/uihtml/styling-guide.md |
| Component CSS (buttons, inputs) |
references/uihtml/component-styles.md |
| CSS layout patterns |
references/uihtml/css-layout-patterns.md |
| Brand design tokens |
references/uihtml/brand-design-tokens.md |
| Dark mode |
references/uihtml/dark-mode.md |
| External color schemes |
references/uihtml/external-color-schemes.md |
App Designer Serialization (UIFigure apps only)
Important: App Designer serialization is an additional step AFTER the normal UIFigure build. You MUST also read the UIFigure path references above (components, grid-layout, callbacks, containers, layout-patterns) to design the app's structure. The serialization references below cover only how to persist that design to disk.
Both formats use the same AppDesignerAgentInterface API via the bundled scripts/ tool; only the file extension passed to create()/open() differs.
Read first (both formats):
| When building... |
Read |
Verbs, build sequence, editing, save()/validate()/finalize(), inspect() |
references/app-designer/agent-guide-shared.md |
| Background execution — concepts + routing (read first) |
references/background-tasks.md |
Background execution — addBackgroundTask verb reference |
references/app-designer/background-tasks.md |
Plain-text (.m + .xml):
| When building... |
Read |
Ownership model, .xml authoring, flow, gotchas |
references/app-designer/agent-guide-plaintext.md |
| classdef structure & block ordering rules |
references/app-designer/plaintext/classdef-template.md |
| XML structure and which properties to set |
references/app-designer/plaintext/xml-template.md |
| Per-component property names, types, defaults |
references/app-designer/plaintext/property-reference.md |
| Authoritative XML schema |
references/app-designer/plaintext/matlabAppSchema.xsd |
Binary .mlapp:
| When building... |
Read |
Build flow, native property values, save()/finalize() |
references/app-designer/agent-guide-mlapp.md |
Editing an Existing App
| When editing... |
Read |
| Any existing app (determines format, routes to approach) |
references/editing-guide.md |
Archetype References
| Archetype |
File |
| Dashboard |
references/archetypes/dashboard.md |
| Explorer |
references/archetypes/explorer.md |
| Tabbed |
references/archetypes/tabbed.md |
| Wizard |
references/archetypes/wizard.md |
| Canvas |
references/archetypes/canvas.md |
External Skills (invoked, not read)
matlab-build-chart — when the app includes MATLAB plots (UIFigure path or UIFigure+accent)
matlab-apply-theme — when the app needs dark mode, brand colors, or custom palettes (UIFigure path)
After Plan Approval
All UIFigure apps (regardless of serialization format)
- Read the archetype reference for the spatial skeleton
- If MVVM warranted (Explorer, Wizard, Canvas, or complex apps): read the architecture reference
- Read the UIFigure guide to establish layout (grid, components, containers)
- Layer in path-specific references per the implementation sequence
- For visual polish: invoke
matlab-apply-theme (UIFigure) or read styling references (UIHTML accent)
- For charts: invoke
matlab-build-chart (UIFigure) or read charting references (UIHTML accent)
- If App Designer serialization: read the app-designer reference docs (shared guide + format-specific guide), then use the
AppDesignerAgentInterface API to persist the app. The docs contain the complete build flow, property rules, and editing discipline.
UIHTML path
- Read the archetype reference for the spatial skeleton
- If MVVM warranted: read the JS MVVM architecture reference
- Read the bridge guide to establish the MATLAB-JS connection
- Layer in path-specific references per the implementation sequence
- For visual polish: read styling/CSS references
- For charts: read charting references
Format Fallback
If the plain text path produces errors that cannot be resolved (e.g., version mismatch, unsupported component), fall back to the .mlapp path — the same verbs drive both formats; re-create the handle with a .mlapp extension. Only fall back to fully programmatic UIFigure code as a last resort.
Recommendation Template
Recommended architecture: [UIFigure app / UIHTML app / UIFigure + accent]
Based on what you've described:
- [Key signal 1]
- [Key signal 2]
- [Key signal 3, if applicable]
What this means: [1-2 sentences on development experience]
Trade-off: [Main thing they'd give up vs the other path]
Serialization (if App Designer): I'd recommend [.mlapp / plain text] because [reason]. This doesn't change the app's structure, just how it's saved.
Want to proceed with this approach, or would you prefer the other path?
Copyright 2026 The MathWorks, Inc.
1---2name: matlab-build-app3license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md4metadata:5 source: https://skillmd.com/skills/matlab/matlab-build-app6 author: MathWorks7 version: "2.3"8description: >9 Build MATLAB apps from requirements to working code. Asks discovery questions10 (or skips them when the path is known), recommends UIFigure or UIHTML11 architecture, identifies layout archetype (Dashboard, Explorer, Tabbed, Wizard,12 Canvas), produces an implementation plan, and executes the build. For UIFigure13 apps, optionally serializes as App Designer (.mlapp or plain-text .m + .xml).14 Use when a user wants to build a MATLAB app, create a GUI, make an interactive15 tool, build a uifigure app, build a uihtml app, build an App Designer app,16 build a .mlapp app, build a plain-text App Designer app, or asks which approach17 to use. Also use when user describes spatial layout needs: dashboard, control18 panel, sidebar, tabs, wizard, stepper, canvas, workspace.19allowed-tools:20 - Read21 - Write22 - Edit23 - Bash24 - Grep25 - Glob26---2728# MATLAB Build App2930Determine the best architecture for a MATLAB application, produce an implementation plan grounded in internal references, and execute the build. For UIFigure apps, optionally serialize into an App Designer format.3132## When to Use This Skill3334Use this skill when:35- User wants to build a MATLAB app, GUI, or interactive tool36- User asks "how should I build this app?" or "which approach should I use?"37- User describes an application — with or without specifying an implementation path38- User mentions: MATLAB app, GUI, uifigure, uihtml, interactive tool, dashboard, visualization app, App Designer, .mlapp, plain-text app39- User describes spatial layout needs: dashboard, control panel, sidebar, tabs, wizard, stepper, canvas, workspace40- User has already chosen a path (e.g., "build me a uihtml app") — handle directly4142## When Not to Use4344- The request is purely about MATLAB computation with no UI component45- The user is asking about an existing app they want to modify → read `references/editing-guide.md`46- The user wants to convert between App Designer formats (e.g., .mlapp to plain-text or vice versa) → tell them to use File > Save As in App Designer. Do NOT attempt the conversion programmatically.4748## Critical Rules4950- MUST ask discovery questions before recommending a path — unless the user already specified one51- MUST confirm the path choice with the user before producing the implementation plan52- MUST produce an implementation plan grounded in internal references before writing any code53- MUST write the plan to a file (`<app-name>-plan.md`) in the working directory54- NEVER recommend a path without understanding the user's constraints (unless path was pre-specified)55- NEVER apply dark mode, custom colors, or visual themes unless the user explicitly requests them56- ALWAYS present the recommendation as guidance, not a mandate — the user decides57- MUST choose archetype based on the user's primary task, not aesthetics58- NEVER treat two archetypes as equals within one app — one is always the primary container59- UIFigure app: MUST use `uigridlayout` for all structural layout — never `Position`-based sizing60- UIHTML/web app: MUST use CSS Grid or Flexbox for chrome — no absolute positioning for structural panels61- The chrome (header, sidebar, tabs, step indicator) MUST remain spatially stable62- Background execution (any operation taking more than ~1 second) requires a class-structured app and MUST be read up first in `references/background-tasks.md` — do NOT hand-write `parfeval`/`backgroundPool`/`DataQueue` plumbing from memory. For an App Designer app (`.mlapp` or plain text) you MUST use the `addBackgroundTask` verb and NEVER hand-roll the infrastructure or reuse the standalone-programmatic manual wiring. For a standalone programmatic app, use the MVVM structure per that doc. A flat nested-function app that needs background work MUST escalate to one of these.63- App Designer serialization: MUST read `references/app-designer/agent-guide-shared.md` (covers ownership models, editing discipline, property rules, quoting) plus the format-specific guide (`agent-guide-mlapp.md` or `agent-guide-plaintext.md`) before building. Those docs are the single source of truth; do not attempt to edit app files without reading them first.6465## Workflow6667```68User request arrives69 │70 ├── Path NOT specified → Full Discovery71 │ │72 │ ▼73 │ Ask Q1-Q4 (purpose, lifespan, polish, team skills)74 │ │75 │ ▼76 │ Identify layout archetype77 │ │78 │ ▼79 │ Recommend UIFigure vs UIHTML based on Q1-Q480 │ │81 │ ▼82 │ *** STOP: Present recommendation and WAIT for user confirmation ***83 │ (Do NOT produce a plan or read references until user says yes)84 │ │85 │ ▼86 │ Ask Q5 (FINAL): Serialization format? (UIFigure apps only)87 │ │88 │ ├── App Designer → release check, present format choice,89 │ │ continue with UIFigure references + add serialization step90 │ │91 │ └── Standalone programmatic → no extra step92 │ │93 │ ▼94 │ Produce Implementation Plan → write to <app-name>-plan.md95 │ │96 │ ▼97 │ User reviews plan → confirms or adjusts98 │ │99 │ ▼100 │ Begin building (read references per the plan)101 │102 └── Path IS specified103 │104 ├── Serialization explicit (e.g., ".mlapp app", "plain-text app")105 │ → Skip Q5, proceed with stated format106 │ → Ask only missing requirements + archetype if unclear107 │ → Produce Implementation Plan108 │109 ├── Architecture explicit but serialization not stated110 │ (e.g., "build me a uifigure app")111 │ → Still ask Q5 (serialization) before planning112 │ → Ask missing requirements + archetype if unclear113 │ → Produce Implementation Plan114 │115 └── UIHTML or standalone programmatic explicit116 → Skip Q5 entirely (not applicable)117 → Ask missing requirements + archetype if unclear118 → Produce Implementation Plan119```120121## Discovery Questions122123Ask these conversationally — not as a rigid checklist. Gather requirements and layout intent first; ask the serialization question **last**, once you understand what the app needs to do.124125### Core Questions126127**1. What does the app do and who is it for?**128> What will this app do? Who will use it?129130Listen for archetype signals: "dashboard", "control panel", "step-by-step", "workspace".131132**2. Is this a quick tool or something you'll maintain over time?**133> Is this meant to be maintained and evolved, or is it more of a quick, proof-of-concept tool?134135- **Maintained** → proceed to remaining questions; team skills matter136- **Ephemeral** → favor UIHTML app path; can skip team question137138**3. How polished does the UI need to look?**139> Are standard MATLAB buttons, sliders, tables, and plots enough? Or do you need custom visuals — branded, animated, or visually richer?140141- Standard controls sufficient → UIFigure app signal142- Custom visuals needed → UIHTML app signal143144**4. Who will work on this app going forward?**145> Will this be maintained by people comfortable only with MATLAB, or by people also comfortable with web technologies?146147Only ask for maintained apps.148- MATLAB-only team → UIFigure app149- Web-comfortable team → UIHTML app150151**5. (FINAL) How should this app be saved?**152> Do you want this app to open and edit inside App Designer, or do you prefer a standalone programmatic file (no App Designer dependency)?153154This is a **serialization** question, not an architecture question. The app's structure (components, layout, callbacks) is designed using UIFigure knowledge regardless of the answer. Q5 only determines how that design is persisted to disk.155156- **App Designer** → `.mlapp` or plain-text `.m` + `.xml`. Check release (plain-text needs R2026b+). If Q3 indicated custom visuals, note that App Designer constrains visual customization vs UIHTML and confirm.157- **Standalone programmatic** → programmatic `.m` code, no App Designer dependency. MVVM may warrant multiple files; that is decided at build time.158159### Follow-up Probes (only if path isn't clear)160161- **Interaction style:** Real-time feedback needed? → slight UIFigure lean162- **Existing work:** Existing MATLAB UI code? → UIFigure. Existing web assets? → UIHTML163- **Distribution:** May need to work outside MATLAB? → UIHTML164- **Long computations:** Will any operation take more than a second? → use a background task (read `references/background-tasks.md`). Note this requires a class-structured app: App Designer serialization, or MVVM if standalone programmatic. Heavy, long, or one-shot work is ALWAYS a background task, never a timer; a timer fits only scheduled, cheap-per-tick work that must update the UI on the main thread (read `references/timers.md`).165166## Path Decision Logic167168Two stages: first determine architecture (Q1-Q4), then determine serialization format (Q5).169170```171Stage A — Architecture (from Q1-Q4):172173Ephemeral app? → Strong default to UIHTML app174175Maintained app? → Weigh signals:176177Strong UIFigure signals:178 ✓ Maintained + MATLAB-only team179 ✓ Standard UI components sufficient180 ✓ Tight real-time interaction181 ✓ Existing MATLAB UI code182183Strong UIHTML signals:184 ✓ Ephemeral (regardless of team)185 ✓ Maintained + web-skilled team186 ✓ Custom visuals, branded look, animations187 ✓ Existing web assets188 ✓ Future portability outside MATLAB189190UIFigure + uihtml accent:191 Mostly standard app but needs one custom visualization panel.192193Stage B — Serialization format (Q5, UIFigure apps only):194195Q5 = Standalone → programmatic code (no App Designer). Done.196197Q5 = App Designer → adds a serialization layer ON TOP of Stage A.198 UIFigure references still apply in full. Serialization is IN ADDITION TO,199 not instead of, the normal UIFigure build.200 → Check release, present format choice (plain text vs .mlapp).201 → If Stage A indicated UIHTML for custom visuals, surface the trade-off:202 App Designer constrains custom visuals — confirm before committing.203```204205**Weighting:** 1. Architecture (Q1-Q4) 2. Serialization (Q5, applies only to UIFigure)206207## Paths at a Glance208209| Architecture | Key strength |210|------|--------------|211| **UIFigure app** | Single language, any MATLAB dev can maintain |212| **UIHTML app** | Full visual control, rich interactivity |213| **UIFigure + accent** | Best of both when you need one custom visual |214215For UIFigure apps, three serialization formats:216217| Format | Trade-off |218|------|--------------|219| Programmatic `.m` | Standalone, no App Designer dependency |220| App Designer `.mlapp` | Binary, works on any release, opens in App Designer |221| App Designer plain text `.m` + `.xml` | Source-controllable, AI-editable, R2026b+ |222223## Layout Archetype224225Pick based on the user's **primary task**:226227| Archetype | Primary user task | Structure |228|---|---|---|229| **Dashboard** | Monitor and compare at a glance | KPI cards + charts + table; read-only |230| **Explorer** | Adjust parameters, observe live results | Sidebar controls + live display |231| **Tabbed** | Navigate between independent sections | Tab bar + content panels |232| **Wizard** | Complete a sequential workflow | Step indicator + one-step-at-a-time |233| **Canvas** | Create, inspect, or edit spatial artifacts | Central workspace + tools |234235If unclear, ask: "Will users mostly be *watching results* (Dashboard), *tweaking controls* (Explorer), *switching sections* (Tabbed), *going through steps* (Wizard), or *working on a central figure* (Canvas)?"236237## Implementation Plan238239After confirming path and archetype, produce a plan and write it to `<app-name>-plan.md` in the working directory. Present a concise summary inline with the approval request.240241### Plan Template242243```244**Implementation Plan: [App Name]**245246**Architecture:** [UIFigure app / UIHTML app / UIFigure + accent]247**Serialization:** [Programmatic .m / App Designer .mlapp / App Designer plain text]248**Layout:** [Archetype] — [one sentence describing spatial structure]249250**Structure:**251- [Major panel/area — spatial description]252- [e.g., "Left sidebar (220px) with date range picker, category filter, refresh button"]253- [e.g., "Main area with line chart showing filtered results"]254255**Key behaviors:**256- [User-visible interaction effects]257258**Internal references that will be used:**259260| Reference | Role in this app |261|-----------|-----------------|262| `references/path/file.md` | [what it provides] |263| ... | ... |264265**External skills:**266- `matlab-build-chart` — [role, if applicable]267- `matlab-apply-theme` — [role, if applicable]268269**File organization:**270[app directory tree]271272**Implementation sequence:**2731. [First reference read] — [what it establishes]2742. [Next reference] — [what it adds]2753. [...]276```277278Each reference pointer carries provenance: `[src: references/uifigure/grid-layout.md §Spanning]`279280### Plan Quality Checks281282Before presenting:283- [ ] Every reference listed has a concrete role284- [ ] Structure uses spatial terms the user can visualize285- [ ] Behaviors describe user-visible effects286- [ ] Implementation sequence shows a logical build order287- [ ] Plan is specific enough for "yes, that's what I want" or "change X"288289## Reference Router290291After plan approval, read the relevant internal references to execute the build.292293### UIFigure Path294295| When building... | Read |296|-----------------|------|297| Grid layout, sizing, components | `references/uifigure/guide.md` |298| Grid details (spanning, collapse) | `references/uifigure/grid-layout.md` |299| Panels, tab groups, nested grids | `references/uifigure/containers.md` |300| Component reference (controls, display) | `references/uifigure/components.md` |301| Callback patterns, data sharing | `references/uifigure/callbacks.md` |302| Layout recipes (sidebar, form, split) | `references/uifigure/layout-patterns.md` |303| MVVM architecture (complex apps) | `references/uifigure/mvvm-guide.md` |304| View binding patterns | `references/uifigure/mvvm-view-binding.md` |305| ViewModel testing | `references/uifigure/mvvm-testing.md` |306| Background execution — concepts + routing (read first) | `references/background-tasks.md` |307| Background execution — standalone programmatic (MVVM) wiring | `references/uifigure/mvvm-background-tasks.md` |308| Timers — periodic main-thread work (NOT for offloading heavy work) | `references/timers.md` |309310### UIHTML Path311312| When building... | Read |313|-----------------|------|314| MATLAB-JS bridge, setup(), events | `references/uihtml/bridge-guide.md` |315| Communication patterns (4 patterns) | `references/uihtml/communication-patterns.md` |316| Data type conversion | `references/uihtml/data-types.md` |317| Platform constraints | `references/uihtml/platform-limitations.md` |318| uihtml creation, hybrid layouts | `references/uihtml/setup.md` |319| Error handling (both sides) | `references/uihtml/error-handling.md` |320| JS MVVM architecture | `references/uihtml/mvvm-guide.md` |321| Observable/Computed classes | `references/uihtml/mvvm-observable-classes.md` |322| JS View binding | `references/uihtml/mvvm-view-binding.md` |323| JS coding patterns, modules | `references/uihtml/js-coding-guide.md` |324| JS testing & debugging | `references/uihtml/js-testing-debugging.md` |325| Chart.js setup & patterns | `references/uihtml/charting-guide.md` |326| Chart type selection | `references/uihtml/chart-type-selection.md` |327| Chart.js initialization | `references/uihtml/chartjs-setup.md` |328| Line & bar charts | `references/uihtml/line-bar-charts.md` |329| Doughnut & scatter charts | `references/uihtml/doughnut-scatter-charts.md` |330| Chart data updates | `references/uihtml/chart-updates.md` |331| Chart ↔ bridge integration | `references/uihtml/chart-bridge-integration.md` |332| Chart performance | `references/uihtml/chart-performance.md` |333| CSS styling & tokens | `references/uihtml/styling-guide.md` |334| Component CSS (buttons, inputs) | `references/uihtml/component-styles.md` |335| CSS layout patterns | `references/uihtml/css-layout-patterns.md` |336| Brand design tokens | `references/uihtml/brand-design-tokens.md` |337| Dark mode | `references/uihtml/dark-mode.md` |338| External color schemes | `references/uihtml/external-color-schemes.md` |339340### App Designer Serialization (UIFigure apps only)341342**Important:** App Designer serialization is an additional step AFTER the normal UIFigure build. You MUST also read the UIFigure path references above (components, grid-layout, callbacks, containers, layout-patterns) to design the app's structure. The serialization references below cover only how to persist that design to disk.343344Both formats use the same `AppDesignerAgentInterface` API via the bundled `scripts/` tool; only the file extension passed to `create()`/`open()` differs.345346**Read first (both formats):**347348| When building... | Read |349|-----------------|------|350| Verbs, build sequence, editing, `save()`/`validate()`/`finalize()`, `inspect()` | `references/app-designer/agent-guide-shared.md` |351| Background execution — concepts + routing (read first) | `references/background-tasks.md` |352| Background execution — `addBackgroundTask` verb reference | `references/app-designer/background-tasks.md` |353354**Plain-text (`.m` + `.xml`):**355356| When building... | Read |357|-----------------|------|358| Ownership model, `.xml` authoring, flow, gotchas | `references/app-designer/agent-guide-plaintext.md` |359| classdef structure & block ordering rules | `references/app-designer/plaintext/classdef-template.md` |360| XML structure and which properties to set | `references/app-designer/plaintext/xml-template.md` |361| Per-component property names, types, defaults | `references/app-designer/plaintext/property-reference.md` |362| Authoritative XML schema | `references/app-designer/plaintext/matlabAppSchema.xsd` |363364**Binary `.mlapp`:**365366| When building... | Read |367|-----------------|------|368| Build flow, native property values, `save()`/`finalize()` | `references/app-designer/agent-guide-mlapp.md` |369370### Editing an Existing App371372| When editing... | Read |373|----------------|------|374| Any existing app (determines format, routes to approach) | `references/editing-guide.md` |375376### Archetype References377378| Archetype | File |379|-----------|------|380| Dashboard | `references/archetypes/dashboard.md` |381| Explorer | `references/archetypes/explorer.md` |382| Tabbed | `references/archetypes/tabbed.md` |383| Wizard | `references/archetypes/wizard.md` |384| Canvas | `references/archetypes/canvas.md` |385386### External Skills (invoked, not read)387388- `matlab-build-chart` — when the app includes MATLAB plots (UIFigure path or UIFigure+accent)389- `matlab-apply-theme` — when the app needs dark mode, brand colors, or custom palettes (UIFigure path)390391## After Plan Approval392393### All UIFigure apps (regardless of serialization format)3943951. Read the archetype reference for the spatial skeleton3962. If MVVM warranted (Explorer, Wizard, Canvas, or complex apps): read the architecture reference3973. Read the UIFigure guide to establish layout (grid, components, containers)3984. Layer in path-specific references per the implementation sequence3995. For visual polish: invoke `matlab-apply-theme` (UIFigure) or read styling references (UIHTML accent)4006. For charts: invoke `matlab-build-chart` (UIFigure) or read charting references (UIHTML accent)4017. **If App Designer serialization:** read the app-designer reference docs (shared guide + format-specific guide), then use the `AppDesignerAgentInterface` API to persist the app. The docs contain the complete build flow, property rules, and editing discipline.402403### UIHTML path4044051. Read the archetype reference for the spatial skeleton4062. If MVVM warranted: read the JS MVVM architecture reference4073. Read the bridge guide to establish the MATLAB-JS connection4084. Layer in path-specific references per the implementation sequence4095. For visual polish: read styling/CSS references4106. For charts: read charting references411412### Format Fallback413414If the plain text path produces errors that cannot be resolved (e.g., version mismatch, unsupported component), fall back to the `.mlapp` path — the same verbs drive both formats; re-create the handle with a `.mlapp` extension. Only fall back to fully programmatic UIFigure code as a last resort.415416## Recommendation Template417418**Recommended architecture: [UIFigure app / UIHTML app / UIFigure + accent]**419420Based on what you've described:421- [Key signal 1]422- [Key signal 2]423- [Key signal 3, if applicable]424425**What this means:** [1-2 sentences on development experience]426427**Trade-off:** [Main thing they'd give up vs the other path]428429**Serialization (if App Designer):** I'd recommend [.mlapp / plain text] because [reason]. This doesn't change the app's structure, just how it's saved.430431Want to proceed with this approach, or would you prefer the other path?432433----434435Copyright 2026 The MathWorks, Inc.436437----