Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/matlab-app-building/matlab-build-app

matlab-build-app

Unverified

Build MATLAB apps from requirements to working code. Asks discovery questions (or skips them when the path is known), recommends UIFigure or UIHTML architecture, identifies layout archetype (Dashboard, Explorer, Tabbed, Wizard, Canvas), produces an implementation plan, and executes the build. For UIFigure apps, optionally serializes as App Designer (.mlapp or plain-text .m + .xml). Use when a user wants to build a MATLAB app, create a GUI, make an interactive tool, build a uifigure app, build a uihtml app, build an App Designer app, build a .mlapp app, build a plain-text App Designer app, or asks which approach to use. Also use when user describes spatial layout needs: dashboard, control panel, sidebar, tabs, wizard, stepper, canvas, workspace.

FileKindSize
SKILL.mdskill md20.9 KB
assets/colors_and_type.cssother12.8 KB
assets/minimal-bridge.htmlother1.3 KB
assets/minimal-bridge.mother1.2 KB
assets/standalone-chart-template.htmlother11.5 KB
manifest.yamlconfig672 B
references/app-designer/agent-guide-mlapp.mdmarkdown15.7 KB
references/app-designer/agent-guide-plaintext.mdmarkdown14.7 KB
references/app-designer/agent-guide-shared.mdmarkdown27.1 KB
references/app-designer/background-tasks.mdmarkdown4.8 KB
references/app-designer/plaintext/classdef-template.mdmarkdown11.3 KB
references/app-designer/plaintext/matlabAppSchema.xsdother16.8 KB
references/app-designer/plaintext/property-reference.mdmarkdown45.1 KB
references/app-designer/plaintext/xml-template.mdmarkdown12.3 KB
references/archetypes/canvas.mdmarkdown8.0 KB
references/archetypes/dashboard.mdmarkdown6.4 KB
references/archetypes/explorer.mdmarkdown5.7 KB
references/archetypes/tabbed.mdmarkdown6.6 KB
references/archetypes/wizard.mdmarkdown9.7 KB
references/background-tasks.mdmarkdown6.9 KB
references/editing-guide.mdmarkdown3.3 KB
references/timers.mdmarkdown2.1 KB
references/uifigure/callbacks.mdmarkdown3.0 KB
references/uifigure/components.mdmarkdown1.7 KB
references/uifigure/containers.mdmarkdown1.3 KB
references/uifigure/grid-layout.mdmarkdown4.9 KB
references/uifigure/guide.mdmarkdown5.3 KB
references/uifigure/layout-patterns.mdmarkdown1.5 KB
references/uifigure/mvvm-background-tasks.mdmarkdown3.9 KB
references/uifigure/mvvm-guide.mdmarkdown11.1 KB
references/uifigure/mvvm-testing.mdmarkdown2.8 KB
references/uifigure/mvvm-view-binding.mdmarkdown5.4 KB
references/uihtml/brand-design-tokens.mdmarkdown5.6 KB
references/uihtml/bridge-guide.mdmarkdown7.0 KB
references/uihtml/chart-bridge-integration.mdmarkdown7.5 KB
references/uihtml/chart-performance.mdmarkdown5.0 KB
references/uihtml/chart-type-selection.mdmarkdown3.1 KB
references/uihtml/chart-updates.mdmarkdown4.7 KB
references/uihtml/charting-guide.mdmarkdown3.9 KB
references/uihtml/chartjs-setup.mdmarkdown4.0 KB
references/uihtml/communication-patterns.mdmarkdown4.2 KB
references/uihtml/component-styles.mdmarkdown4.3 KB
references/uihtml/css-layout-patterns.mdmarkdown5.0 KB
references/uihtml/dark-mode.mdmarkdown3.8 KB
references/uihtml/data-types.mdmarkdown2.7 KB
references/uihtml/doughnut-scatter-charts.mdmarkdown6.0 KB
references/uihtml/error-handling.mdmarkdown4.6 KB
references/uihtml/external-color-schemes.mdmarkdown2.6 KB
references/uihtml/js-coding-guide.mdmarkdown11.2 KB
references/uihtml/js-testing-debugging.mdmarkdown2.9 KB
references/uihtml/line-bar-charts.mdmarkdown5.2 KB
references/uihtml/mvvm-guide.mdmarkdown11.0 KB
references/uihtml/mvvm-observable-classes.mdmarkdown2.9 KB
references/uihtml/mvvm-view-binding.mdmarkdown5.3 KB
references/uihtml/platform-limitations.mdmarkdown2.5 KB
references/uihtml/setup.mdmarkdown3.9 KB
references/uihtml/styling-guide.mdmarkdown8.1 KB
scripts/+module/+backgroundtask/BackgroundTaskModule.pbinary2.5 KB
scripts/+module/+backgroundtask/templates/cancelBackground.mother357 B
scripts/+module/+backgroundtask/templates/handleBackgroundComplete.mother1.4 KB
scripts/+module/+backgroundtask/templates/safeProgress.mother734 B
scripts/+module/+backgroundtask/templates/startBackground.mother1.2 KB
scripts/+module/AppBuilderModule.pbinary242 B
scripts/AppDesignerAgentInterface.pbinary12.6 KB
scripts/MlappBackend.pbinary9.4 KB
scripts/PlainTextBackend.pbinary10.2 KB

references/app-designer/background-tasks.md

View on GitHub
# Background Tasks — App Designer API reference

> **Read `references/background-tasks.md` first** (what/when, callback signatures,
> limitations — shared by both formats). This doc is the App Designer verb reference only.
>
> **App Designer apps only** (`.mlapp` or plain-text via `AppDesignerAgentInterface`).
> Standalone programmatic apps: use `references/uifigure/mvvm-background-tasks.md` instead.

**MUST** scaffold background execution with `appBuilder.addBackgroundTask(...)` — the
only supported way. **NEVER** hand-write `parfeval` / `backgroundPool` / `DataQueue` /
`afterEach` / `afterAll` or the `startBackground` / `cancelBackground` /
`handleBackgroundComplete` / `safeProgress` / `cleanupBackground` methods, **NEVER**
`addMethod` those infra methods by hand to route around the verb, and **NEVER** copy
the standalone-programmatic wiring into an App Designer app.

## `addBackgroundTask`

```matlab
appBuilder.addBackgroundTask(name, "Fcn", fcn, "CompleteFcn", completeFcn)
appBuilder.addBackgroundTask(name, "Fcn", fcn, "CompleteFcn", completeFcn, "ProgressFcn", progressFcn)
```

| Argument | Required | Description |
|----------|----------|-------------|
| `name` | Yes | Property name for the task struct (e.g., `"TrainingTask"`) |
| `"Fcn"` | Yes | Name of the static method to run in the background |
| `"CompleteFcn"` | Yes | Name of the completion callback |
| `"ProgressFcn"` | No | Name of the progress callback. Omit if no streaming. |

**Generates** (per call): private struct property (`Fcn`, `CompleteFcn`, `ProgressFcn`,
`Future`, `Queue`, `Running`, `StopRequested`); StartupFcn handle wiring; a static
`Fcn` stub; a `CompleteFcn` stub (pre-filled with cancel/error guards); a `ProgressFcn`
stub (only if specified); a cleanup line in `cleanupBackground`.

**Idempotent infrastructure:** the first call also generates `startBackground`,
`cancelBackground`, `handleBackgroundComplete`, `safeProgress`, `cleanupBackground`,
and a `CloseRequestFcn`. Later calls reuse them and add only the new task's specifics.

**Duplicate rejection:** an existing `name` throws
`AppDesignerAgentInterface:duplicateTask`. Do not re-call for an existing task.

## Build order

1. `create()` / `open()`
2. Add components
3. `addBackgroundTask(...)` per workflow
4. Fill `Fcn` body: `addMethod(fcn, body, "static")`
5. Fill `CompleteFcn` / `ProgressFcn` bodies: `addMethod(name, body, "private")`
6. Wire start/cancel buttons: `setCallbackCode(...)`
7. `save()`

Filling a stub overwrites it and emits an `overwriteMethod` warning — expected, harmless.

## Example (progress + cancel)

```matlab
appBuilder.addBackgroundTask("TrainingTask", ...
    "Fcn", "trainModel", "CompleteFcn", "onTrainingComplete", "ProgressFcn", "onTrainingProgress");

% Background compute: sendProgress injected as last arg
appBuilder.addMethod("trainModel", sprintf([ ...
    'function result = trainModel(data, sendProgress)\n' ...
    'for i = 1:data.NumEpochs\n' ...
    '    result = trainOneEpoch(data, i);\n' ...
    '    sendProgress(struct(''Epoch'', i, ''Loss'', result.loss));\n' ...
    'end\n' ...
    'end']), "static");

appBuilder.addMethod("onTrainingProgress", sprintf([ ...
    'function onTrainingProgress(app, data)\n' ...
    'app.StatusLabel.Text = sprintf("Epoch %%d, Loss: %%.4f", data.Epoch, data.Loss);\n' ...
    'end']), "private");

appBuilder.addMethod("onTrainingComplete", sprintf([ ...
    'function onTrainingComplete(app, result, error, wasCancelled)\n' ...
    'app.TrainButton.Enable = "on"; app.CancelButton.Enable = "off";\n' ...
    'if wasCancelled; app.StatusLabel.Text = "Cancelled."; return; end\n' ...
    'if ~isempty(error); uialert(app.UIFigure, error.message, "Error"); return; end\n' ...
    'plot(app.UIAxes, result.loss);\n' ...
    'end']), "private");

% Start / cancel wiring
appBuilder.setCallbackCode("TrainButtonPushed", ...
    sprintf('app.TrainButton.Enable = "off"; app.CancelButton.Enable = "on";\napp.startBackground(''TrainingTask'', app.getTrainingData());'));
appBuilder.setCallbackCode("CancelButtonPushed", "app.cancelBackground('TrainingTask');");
```

For a no-progress task, omit `"ProgressFcn"` and drop the `sendProgress` arg from the
static `Fcn`. Pass task inputs after the name: `app.startBackground('ExportTask', config)`.

## Multiple tasks

Call `addBackgroundTask` once per workflow; infrastructure is idempotent.

```matlab
appBuilder.addBackgroundTask("TrainingTask", "Fcn", "trainModel", "CompleteFcn", "onTrainDone", "ProgressFcn", "onTrainProgress");
appBuilder.addBackgroundTask("ExportTask", "Fcn", "exportData", "CompleteFcn", "onExportDone");
```

## Editing an existing app

Infrastructure and stubs are already in the model. Replace a task's logic with
`addMethod`. Add a new task with `addBackgroundTask` (idempotent). Never re-call it for
an existing task name.

Copyright 2026 The MathWorks, Inc.

----
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall