MCPInstall
matlab avatar

arranging-simulink-layouts

Arranges Simulink block diagram layout to improve readability using the modeledit layout engine. Use when the user asks to fix, clean up, tidy, straighten, or rearrange a layout, or to run Simulink's Auto Arrange, when blocks overlap or lines cross, when specific blocks need repositioning, or when grouping blocks into or expanding a subsystem.

Installs
0
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill arranging-simulink-layouts
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads arranging-simulink-layouts automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Arranging Simulink Layouts

Reposition blocks and reroute their lines with the SATK layout engine in model_edit. Move as little of the user's diagram as the request allows.

When to Use

  • "Fix / clean up / tidy / straighten / rearrange the layout", "make it readable"
  • Blocks overlap, lines cross or run through blocks, a few blocks landed far from the blocks they connect to
  • "Move these blocks", "line these up", "sort out the blocks I just added"
  • Grouping blocks into a subsystem, or expanding a subsystem into its parent
  • "Run Auto Arrange", "use Simulink's own arrange"

When NOT to Use

  • Adding, connecting, deleting, or configuring blocks: use building-simulink-models. Layout already runs automatically after every model_edit call.
  • Stateflow chart layout: the layout operation is Simulink-only. A chart scope accepts only a full re-layout (operations [], layout_mode "full"), which moves every element, so ask first.

Set Expectations

  • You drive an automatic layout engine. You don't place blocks pixel by pixel. Say so if the user expects hand-tuned placement.
  • Ctrl+Z is not reliable for agent edits, including layout. Don't offer undo. Before any layout that moves many blocks, recommend that the user saves the model (or a copy) first.
  • The first layout in a MATLAB session can take about 20 s while the engine starts. Later calls take 1–2 s.

Choose the Method

Selective layout is the default. A full layout of a diagram the user has arranged by hand discards their arrangement, so ask before running one. Treat every existing diagram as hand-arranged, however messy it looks.

A vague request ("clean up the layout", "this looks messy") is not agreement to move every block. Only a user who accepts that the whole diagram will move has agreed. For a vague request, diagnose first:

  1. List every pair of blocks that overlap or sit closer than 5 px, with evaluate_matlab_code. Touching blocks count as a problem too. Don't compare Position values by eye, because that misses pairs.
    b = find_system('<scopePath>', 'SearchDepth', 1, 'Type', 'Block');
    b = b(~strcmp(b, '<scopePath>'));
    p = cell2mat(get_param(b, 'Position'));
    pad = 5;
    for i = 1:numel(b)
        for j = i+1:numel(b)
            if all(p(i,1:2) - pad < p(j,3:4)) && all(p(j,1:2) < p(i,3:4) + pad)
                fprintf('%s and %s overlap or are closer than %d px\n', strrep(b{i}, newline, ' '), strrep(b{j}, newline, ' '), pad);
            end
        end
    end
    
    Also look for lines that run through blocks, and for a block far from every block it connects to, or outside the main body of the diagram.
  2. Fix those specific blocks with a selective layout, and tell the user which blocks moved.
  3. If nothing concrete is wrong, or the user wants more, offer a full layout. Explain that every block will move.
SituationMethod
A few blocks overlap, are out of line with their neighbours, or were just added, or the user points out bent lines or misalignment{"op":"layout","targets":[...]} with layout_mode "incremental"
The whole scope is a mess and the user agrees that everything movesoperations [] with layout_mode "full"
The user explicitly asks for Simulink's own tidy-upFormat > Auto Arrange / Simulink.BlockDiagram.arrangeSystem, and only on request
The user wants an exact placementconfigure with Position through model_edit
The user says every other block must stay where it isconfigure with Position, sliding each target along one axis into free space

Selective layout (default)

model_edit(model, "root", '[{"op":"layout","targets":["blk_5","blk_7"]}]', "incremental")
  • Targets must sit directly inside scope. Make one call per scope.
  • The targets move and the lines touching them are rerouted. Other blocks stay put, except that blocks downstream of a target may shift to make room. Mention that in your report. If the user said other blocks must stay put, compare their Position values before and after. If any shifted, put them back and place the targets with configure instead.
  • You can combine a layout operation with edits in the same call. A #ref target names a block that the call adds: [{"op":"add_block","type":"Gain","ref":"g"},{"op":"connect","target":"blk_3.y1 -> #g.u1"},{"op":"layout","targets":["#g","blk_9"]}]
  • When the wiring is tangled, add the targets' immediate neighbours to targets.
  • With layout_mode "full", the targets are ignored and the whole scope is re-laid out.

Full layout of a scope

model_edit(model, "blk_12", "[]", "full")

Use it for a scope that is new or already unreadable, and only with the user's agreement. Prefer the smallest subsystem that contains the mess over root.

Exact placement

model_edit(model, "root", '[{"op":"configure","target":"blk_5","params":{"Position":"[300 100 340 130]"}}]', "incremental")

Later incremental layouts leave the block where you put it, but a full layout of the scope moves it. Use this when the user names a position, asks for specific alignment, or says every other block must stay where it is. In that last case, move each target along one axis into free space, and don't move it past a block it started clear of. That keeps the user's picture of the diagram intact.

Pick the Targets

  1. The user names blocks: find their blk_X IDs with model_read (depth "0") or model_overview on the scope.
  2. The user points at the diagram ("these blocks", "the ones on the left"): ask them to select the blocks in the editor, then read the selection:
    sel = find_system('<scopePath>', 'SearchDepth', 1, 'Type', 'Block', 'Selected', 'on');
    ids = cellfun(@(p) ['blk_' extractAfter(Simulink.ID.getSID(p), ':')], sel, 'UniformOutput', false)
    
    A selection can be stale: earlier operations sometimes leave blocks selected. Read the block names back to the user and confirm before laying out.
  3. Overlaps: run the overlap check in Choose the Method, step 1.

After Layout

  • Read the layout: block in the response. applied: false comes with a detail that explains why. Report it; don't retry blindly.
  • Run model_check(model, scope, '["unconnected_lines"]') to confirm that the wiring survived.
  • Tell the user which blocks moved, and mention any downstream blocks that shifted.

Restructuring Subsystems

To group blocks into a new subsystem, or expand a subsystem in place, see references/subsystem-restructuring.md. Don't rebuild the content block by block with model_edit. After either operation, run no layout. Offer a full layout of the affected scope, and run it only if the user agrees.

Rules to Remember

  • Move blocks with a layout operation, or with configure Position through model_edit, not with set_param block by block. set_param skips line rerouting and the model_edit pipeline.
  • Use Simulink.BlockDiagram.arrangeSystem only when the user asks for Auto Arrange by name.
  • Ask before any full layout of an existing diagram, even when the model is small, a backup exists, or the user said "clean up the whole thing".
  • Group blocks with Simulink.BlockDiagram.createSubsystem. Copying blocks in one at a time loses wiring and layout. After grouping or expanding, offer a full layout instead of running one.
  • Recommend saving before large moves. Ctrl+Z is not reliable for agent edits.

Copyright 2026 The MathWorks, Inc.


FAQ

What does the arranging-simulink-layouts skill do?

Arranges Simulink block diagram layout to improve readability using the modeledit layout engine. Use when the user asks to fix, clean up, tidy, straighten, or rearrange a layout, or to run Simulink's Auto Arrange, when blocks overlap or lines cross, when specific blocks need repositioning, or when grouping blocks into or expanding a subsystem.

How do I install arranging-simulink-layouts?

Run npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill arranging-simulink-layouts in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/arranging-simulink-layouts/ (personal) or .claude/skills/arranging-simulink-layouts/ (project).

Which AI agents can use arranging-simulink-layouts?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is arranging-simulink-layouts safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains arranging-simulink-layouts?

It is published by matlab in matlab/simulink-agentic-toolkit. It has 0 recorded installs.

More from matlab/simulink-agentic-toolkit

View all →
matlab avatar

building-simulink-models

matlab/simulink-agentic-toolkit

Builds and edits Simulink, System Composer, Stateflow, and Simscape models. Use when modifying model structure, parameters, ports, connections, or Stateflow chart internals.

AI & Agents185 installs
matlab avatar

simulating-simulink-models

matlab/simulink-agentic-toolkit

Configures Simulink simulations non-destructively using SimulationInput objects — parameter overrides without modifying the model, batch sweeps via parsim, custom input signals via Dataset, and simulation data retrieval via logsout. Use when running sim()/parsim() with setVariable, setBlockParameter, setExternalInput, or when performing parameter sweeps and multi-run analysis. Not needed for one-shot simulations without configuration.

Data & Databases156 installs
matlab avatar

testing-simulink-models

matlab/simulink-agentic-toolkit

Tests Simulink models using either ephemeral Gherkin-based tests (modeltest) for quick validation or persistent tests (Simulink Test API) authored from requirements or behavioral specs. Requires Simulink Test.

Testing & QA124 installs
matlab avatar

specifying-plant-models

matlab/simulink-agentic-toolkit

Specify plant models for closed-loop simulation: system specs, architecture, build plans, validation plans. Use when creating, updating, or reviewing plant model specifications, planning plant model architecture, or planning plant model validation.

matlab avatar

specifying-mbd-algorithms

matlab/simulink-agentic-toolkit

Specify algorithms for Model-Based Design: system specs, architecture specs, implementation plans, test plans. Use when creating specifications for controllers, signal processing, diagnostics, estimators, or other algorithms authored in Simulink, Stateflow, System Composer, or MATLAB Function blocks.

AI & Agents90 installs
matlab avatar

generate-requirement-drafts

matlab/simulink-agentic-toolkit

Generates draft requirements from Simulink models. Use when drafting or updating requirement artifacts from a model. Prefers Requirements Toolbox (.slreqx) when available; falls back to structured YAML.

AI & Agents80 installs

Popular frontend & design skills

View category →
mattpocock avatar

setup-matt-pocock-skills

mattpocock/skills

Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.

Frontend & Design1.2M installs
anthropics avatar

frontend-design

anthropics/skills

Guidance 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.

OfficialFrontend & Design1.1M installs
mattpocock avatar

prototype

mattpocock/skills

Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.

Frontend & Design1.1M installs
uizze.sh avatar

ui-taste

uizze.sh

Give your coding agent better UI taste. Build and polish web and iOS interfaces with Uizze's anti-ui-slop playbooks and optional real-product references. Use for UI design, implementation, redesign, critique, or a final visual review in Claude Code, Codex, Cursor, or Copilot.

Frontend & Design1.1M installs
heygen-com avatar

hyperframes-animation

heygen-com/hyperframes

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

heygen-com avatar

hyperframes-core

heygen-com/hyperframes

The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

Frontend & Design931.3K installs