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/plaintext/classdef-template.md

View on GitHub
# MATLAB Classdef Template

## Minimal App (no callbacks)

```matlab
classdef AppName < matlab.apps.App

    % Used to locate and load the app's XML configuration file
    properties (Access = public, Constant)
        AppConfigFilename = './AppName.xml';
    end

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                        matlab.ui.Figure
    end

    % App creation
    methods (Access = public)

        % Construct app
        function app = AppName(varargin)
            app = app@matlab.apps.App(varargin{:});

            if nargout == 0
                clear app
            end
        end
    end
end
```

## Full App with Callbacks and Custom Properties

```matlab
classdef AppName < matlab.apps.App

    % Used to locate and load the app's XML configuration file
    properties (Access = public, Constant)
        AppConfigFilename = './AppName.xml'; % File path to the app configuration file containing component layout and settings
    end

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                        matlab.ui.Figure
        MainGrid                        matlab.ui.container.GridLayout
        DisplayPanel                    matlab.ui.container.Panel
        MainAxes                        matlab.ui.control.UIAxes
        ControlPanel                    matlab.ui.container.Panel
        StatusLabel                     matlab.ui.control.Label
        RunButton                       matlab.ui.control.Button
        InputEditField                  matlab.ui.control.EditField
        InputEditFieldLabel             matlab.ui.control.Label
    end

    % Custom app data
    properties (Access = private)
        Data
        IsProcessing = false
    end

    % Helper methods
    methods (Access = private)

        function updateDisplay(app)
            plot(app.MainAxes, app.Data);
            app.StatusLabel.Text = sprintf('Showing %d points', numel(app.Data));
        end
    end

    % Callbacks that handle component events
    methods

        % Code that executes after component creation
        function startupFcn(app)
            app.Data = [];
            app.StatusLabel.Text = 'Ready';
        end

        % Button pushed function: RunButton
        function RunButtonPushed(app, event)
            app.IsProcessing = true;
            app.StatusLabel.Text = 'Processing...';
            app.Data = randn(1, 100);
            updateDisplay(app);
            app.IsProcessing = false;
        end

        % Value changed function: InputEditField
        function InputEditFieldValueChanged(app, event)
            value = app.InputEditField.Value;
            % Process the input
        end
    end

    % App creation
    methods (Access = public)

        % Construct app
        function app = AppName(varargin)
            app = app@matlab.apps.App(varargin{:});

            if nargout == 0
                clear app
            end
        end
    end
end
```

## Invalid app
### Does not inherit from `matlab.apps.App`
### Does not include comment after AppConfigFilename (% File path to the app configuration file containing component layout and settings)
### Custom code (lifecycle hook) added to constructor
### Custom properties block after custom methods block
### Custom methods block after callbacks methods block

```matlab
classdef AppName < handle

    % Used to locate and load the app's XML configuration file
    properties (Access = public, Constant)
        AppConfigFilename = './AppName.xml';
    end

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                        matlab.ui.Figure
        RunButton                       matlab.ui.control.Button
    end

    % Callbacks that handle component events
    methods

        % Code that executes after component creation
        function startupFcn(app)
            app.IsProcessing = false;
        end

        % Button pushed function: RunButton
        function RunButtonPushed(app, event)
            updateDisplay(app);
        end
    end

    % Helper methods (INVALID: must appear before callbacks block)
    methods (Access = private)

        function updateDisplay(app)
            app.IsProcessing = true;
        end
    end

    % Custom app data (INVALID: must appear before custom methods and callbacks)
    properties (Access = private)
        IsProcessing = false
    end

    % App creation
    methods (Access = public)

        % Construct app
        function app = AppName(varargin)
            app = app@matlab.apps.App(varargin{:});

            % INVALID: custom lifecycle code added to constructor
            addlistener(app.UIFigure, 'ObjectBeingDestroyed', @(src, evt) onAppClosing(app));

            if nargout == 0
                clear app
            end
        end
    end
end
```

## Structure Rules

App Designer enforces a strict block ordering. **All user-added code (custom properties and methods) MUST appear between the component properties block and the callbacks block.** Any custom code placed after the callbacks block is removed with a warning by App Designer.

```
1. properties (Access = public, Constant)  — AppConfigFilename
2. properties (Access = public)            — component properties
3. [custom properties blocks]              — user-added (any access level)
4. [custom methods blocks]                 — user-added helpers (any access level), including app lifecycle-related methods (e.g., delete(app)) 
5. methods                                 — callbacks (App Designer-managed)
6. methods (Access = public)               — constructor (always last)
```

### Block details - MUST be in this order

1. **Class declaration**: Always `classdef AppName < matlab.apps.App`

2. **AppConfigFilename** (required, first properties block):
   ```matlab
   properties (Access = public, Constant)
       AppConfigFilename = './AppName.xml'; % File path to the app configuration file containing component layout and settings
   end
   ```

3. **Component properties** (required, declares all UI components):
   ```matlab
   properties (Access = public)
       ComponentName                   matlab.ui.package.ClassName
   end
   ```
   - Align type annotations at column 40
   - List ALL components that appear in the XML (by their `name` attribute)
   - Use fully-qualified MATLAB type
   - **Ordering**: Use reverse depth-first traversal of the XML component tree (see below)

4. **Custom properties** (optional, MUST come after Component properties AND before Callback methods):
   ```matlab
   properties (Access = private)
       PropertyName = defaultValue
   end
   ```

5. **Custom methods** (optional, MUST come after Component properties AND before Callback methods):
   ```matlab
   methods (Access = private)
       function result = helperMethod(app, input)
       end
   end
   ```
   Put ALL helper/utility/lifecycle methods here — never after the callbacks.
   Use multiple methods blocks when different attributes are required (e.g., `Access = private`, `Access = public`)

6. **Callback methods** (optional, default access, MUST come before constructor):
   ```matlab
   methods
       % Code that executes after component creation
       function startupFcn(app)
       end

       % Button pushed function: ButtonName
       function CallbackName(app, event)
       end
   end
   ```

7. **Constructor** (required, always last methods block. DO NOT add additional code here):
   ```matlab
   methods (Access = public)
       function app = AppName(varargin)
           app = app@matlab.apps.App(varargin{:});
           if nargout == 0
               clear app
           end
       end
   end
   ```

## Component Property Ordering

Component properties must be ordered by **reverse depth-first traversal** of the XML component tree:

1. Start with `UIFigure`
2. Process its immediate `<Children>` in **reverse XML order**
3. For each child that is a container, immediately recurse into it (also processing its children in reverse XML order) before moving to the next sibling

### Worked example

Given this XML tree:
```xml
<UIFigure name='UIFigure'>
    <Children>
        <GridLayout name='MainGrid'>
            <Children>
                <Panel name='ControlPanel'>
                    <Children>
                        <Button name='RunButton'/>
                        <Label name='StatusLabel'/>
                    </Children>
                </Panel>
                <Panel name='DisplayPanel'>
                    <Children>
                        <UIAxes name='MainAxes'/>
                    </Children>
                </Panel>
            </Children>
        </GridLayout>
    </Children>
</UIFigure>
```

The classdef property order is:
```matlab
UIFigure            % root
MainGrid            % only child of UIFigure
DisplayPanel        % last child of MainGrid (reverse order)
MainAxes            % child of DisplayPanel
ControlPanel        % first child of MainGrid (reverse order)
StatusLabel         % last child of ControlPanel (reverse order)
RunButton           % first child of ControlPanel (reverse order)
```

## Callback Naming Conventions

| Component Type | Callback Property | Typical Name |
|---------------|------------------|--------------|
| Button | `ButtonPushedFcn` | `ButtonNamePushed` |
| EditField | `ValueChangedFcn` | `EditFieldNameValueChanged` |
| EditField | `ValueChangingFcn` | `EditFieldNameValueChanging` |
| DropDown | `ValueChangedFcn` | `DropDownNameValueChanged` |
| CheckBox | `ValueChangedFcn` | `CheckBoxNameValueChanged` |
| Switch | `ValueChangedFcn` | `SwitchNameValueChanged` |
| Slider | `ValueChangedFcn` | `SliderNameValueChanged` |
| Slider | `ValueChangingFcn` | `SliderNameValueChanging` |
| Spinner | `ValueChangedFcn` | `SpinnerNameValueChanged` |
| Table | `CellSelectionCallback` | `UITableCellSelection` |
| TabGroup | `SelectionChangedFcn` | `TabGroupSelectionChanged` |
| UIFigure | `SizeChangedFcn` | `updateAppLayout` |
| StartupFcn | `StartupFcn` | `startupFcn` |

## MATLAB UI Type Quick Reference

| XML Element | MATLAB Type |
|-------------|-------------|
| UIFigure | `matlab.ui.Figure` |
| Panel | `matlab.ui.container.Panel` |
| GridLayout | `matlab.ui.container.GridLayout` |
| TabGroup | `matlab.ui.container.TabGroup` |
| Tab | `matlab.ui.container.Tab` |
| ButtonGroup | `matlab.ui.container.ButtonGroup` |
| Tree | `matlab.ui.container.Tree` |
| CheckBoxTree | `matlab.ui.container.CheckBoxTree` |
| TreeNode | `matlab.ui.container.TreeNode` |
| Menu | `matlab.ui.container.Menu` |
| ContextMenu | `matlab.ui.container.ContextMenu` |
| Toolbar | `matlab.ui.container.Toolbar` |
| Button | `matlab.ui.control.Button` |
| StateButton | `matlab.ui.control.StateButton` |
| Label | `matlab.ui.control.Label` |
| EditField | `matlab.ui.control.EditField` |
| NumericEditField | `matlab.ui.control.NumericEditField` |
| DropDown | `matlab.ui.control.DropDown` |
| CheckBox | `matlab.ui.control.CheckBox` |
| RadioButton | `matlab.ui.control.RadioButton` |
| Switch | `matlab.ui.control.Switch` |
| Slider | `matlab.ui.control.Slider` |
| Spinner | `matlab.ui.control.Spinner` |
| TextArea | `matlab.ui.control.TextArea` |
| Table | `matlab.ui.control.Table` |
| UIAxes | `matlab.ui.control.UIAxes` |
| Gauge | `matlab.ui.control.Gauge` |
| ColorPicker | `matlab.ui.control.ColorPicker` |
| PushTool | `matlab.ui.control.PushTool` |
| ToggleTool | `matlab.ui.control.ToggleTool` |

----

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