Skip to content

matlab/agent-skills-playground / demos/mbse-with-agentic-ai/skills/mbse-architecture

mbse-architecture

Verified

Use this skill for the architecture phases of an MBSE workflow in MATLAB, when writing idempotent buildXxx.m scripts that produce a three-layer RFLPV architecture (Functional, Logical, Physical) with interface dictionaries, stereotype profiles, allocation sets, and requirements Implement links. Trigger for defining stereotype properties, functional-to-logical / logical-to-physical allocation, mapping requirements to components via slreq Implement links, or running quantitative roll-up analysis on the architecture. Do NOT trigger for ad-hoc structural edits to an already-built System Composer model (adding one component, rewiring a port) — use `building-simulink-models` with `model_edit` for that. Works alongside the `system-composer` skill for detailed SC API patterns.

code/buildAllocationSet.m

View on GitHub
function buildAllocationSet(allocFile, funcModelName, physModelName, archDir)
% BUILDALLOCATIONSET Create a System Composer functional-to-physical allocation set.
%   Closes any existing allocation set, deletes the file, then creates a new
%   allocation set with a FunctionalToPhysical scenario (idempotent).
%
%   Inputs:
%     allocFile     - Full path to the allocation file (.mldatx) (string)
%     funcModelName - Name of the functional SC model (string)
%     physModelName - Name of the physical SC model (string)
%     archDir       - Directory containing both models; added to MATLAB path (string)

    systemcomposer.allocation.AllocationSet.closeAll();
    if isfile(allocFile), delete(allocFile); end

    addpath(archDir);
    funcModel = systemcomposer.openModel(funcModelName);
    physModel = systemcomposer.openModel(physModelName);
    funcArch  = funcModel.Architecture;
    physArch  = physModel.Architecture;

    % Allocation set name must differ from the file base name — save() derives
    % a name from the file path and checks uniqueness; a match causes "name must
    % be unique" to fail.
    %
    % TWO gotchas with createAllocationSet:
    %  1. Pass model NAMES (char/string), not model OBJECTS. Passing objects
    %     fails on R2025b with "No method 'createNewAllocationSet' with
    %     matching signature found" deep inside AllocationAppCatalog. The help
    %     page says objects are accepted but they are not (for this dispatch path).
    %  2. If allocFile is a string (e.g. from fullfile(proj.RootFolder, ...)),
    %     fileparts returns a string, and [stringBase, 'Set'] builds a 2-element
    %     string array rather than a char concatenation — triggering the same
    %     error. Force char before concatenating.
    [~, allocBase] = fileparts(allocFile);
    allocSetName   = [char(allocBase), 'Set'];
    allocSet = systemcomposer.allocation.createAllocationSet(...
        allocSetName, char(funcModelName), char(physModelName));

    % Reuse the default scenario createAllocationSet auto-creates ("Scenario 1")
    % rather than calling createScenario, which would leave the default empty
    % and the Allocation Editor would open to the empty scenario by default.
    scenario      = allocSet.Scenarios(1);
    scenario.Name = 'FunctionalToPhysical';

    allocate(scenario, funcArch.getComponent('FunctionA'), physArch.getComponent('ComponentX'));
    allocate(scenario, funcArch.getComponent('FunctionB'), physArch.getComponent('ComponentY'));
    % One function can map to multiple physical components:
    allocate(scenario, funcArch.getComponent('FunctionC'), physArch.getComponent('ComponentX'));
    allocate(scenario, funcArch.getComponent('FunctionC'), physArch.getComponent('ComponentZ'));

    save(allocSet, allocFile);
end
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