Install
$ agentstack add skill-wzyn20051216-matlab-agent-skills-matlab-simulink-modeling ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
MATLAB Simulink Modeling
Use this skill for model-based design and simulation workflows.
First Checks
- Confirm
Simulinkis installed withverand licensed withlicense('test','Simulink'). - Prefer an official MATLAB MCP auto session tied to a visible MATLAB/Simulink desktop before substantial edits. Use
load_system,open_system, andset_param(modelName,"ZoomFactor","FitSystem")so the user can see the model. - Audit topology before editing: blocks, lines, solver config, sample times, logged signals.
- Prefer existing model architecture and naming.
- Save a copy before destructive edits to user models.
Visible Workflow Requirement
The user specifically wants to watch Simulink modeling and simulation, not only receive final artifacts. Default to this sequence unless the user explicitly asks for headless-only execution:
- Bring up a visible MATLAB/Simulink window first.
- For an existing model, run:
``matlab load_system(modelPath) open_system(modelName) set_param(modelName,"ZoomFactor","FitSystem") ``
- For a new model, call
new_system, save it underartifacts/models/or the project model folder, then immediatelyopen_systembefore adding the rest of the blocks. - During automated construction, save and refresh the model at meaningful milestones so the user can see progress: plant, controller, feedback path, logging/scopes, and final layout.
- During simulation and tuning, open Scope blocks or MATLAB figures and update/plot each run so the user can see response changes.
- If the model window does not appear, do not assume success. Verify the visible window title if possible and retry by focusing MATLAB's command window and executing
open_systemthere. - Still export
.slx, data, figures, logs, and validation reports for reproducibility after the visible demonstration.
MCP Requirement
For this repository and machine:
- Use official MATLAB MCP auto-mode control for model creation, block editing, simulation, and tuning by default.
- Let MCP reuse an existing shared session when present, otherwise allow it to start visible MATLAB automatically.
- Do not replace visible MCP-driven Simulink work with silent batch execution unless the user explicitly asks for headless execution.
- In reports, clearly state that the modeling path was MCP-driven and note any exact blocker if a required MCP action could not be completed.
Build and Modify
Use Simulink APIs rather than manual UI steps:
new_system,open_system,load_system,save_systemadd_block,delete_block,add_line,delete_lineget_param,set_param,find_systemSimulink.SimulationInputfor parameter sweeps- signal logging or
To Workspaceblocks for measurable outputs
If SimuBridge MCP tools are available, prefer them for topology audit, library search, block editing, workspace variables, and waveform analysis.
Simulation Acceptance
A model task passes only when:
- The model diagram updates/compiles after editing, for example with
set_param(modelName,"SimulationCommand","update")or an equivalent compile/update check. - The model loads without errors.
- Solver and stop time are explicit.
- Simulation completes to the requested stop time.
- Required signals are logged and nonempty.
- Generated
.slx,.mat,.png, or report artifacts are saved.
Post-Edit Self Check
After writing or modifying a Simulink model, run a self-check before reporting completion:
- Save the model.
- Update/compile the diagram with
set_param(modelName,"SimulationCommand","update"). - Fix unconnected ports, solver/sample-time errors, algebraic loops, missing variables, and block parameter errors found by the update step.
- Run the requested simulation or a smoke simulation to the target stop time.
- Verify logged signals are nonempty and finite.
- If code generation is in scope, continue into Simulink Coder / Embedded Coder after simulation passes, then verify generated files exist and are nonempty.
- If any compile, simulation, or code generation step cannot pass because a toolbox, support package, compiler, or hardware target is missing, state the exact blocker and save the current runnable model/artifacts for the next attempt.
External Tool Hang Triage
When a Simulink build waits on external tools, diagnose the boundary instead of repeatedly rerunning slbuild:
- If the model simulates but build hangs, inspect generated build logs,
STM32CubeMX.log, temporary script files, and activejava.exe, compiler, or CubeMX processes. - For STM32 builds, verify the
.iocis bound throughSTM32CubeMX.ProjectFile; a CubeMX installation alone is not enough. - Check whether the project path contains non-ASCII characters, spaces, or very long segments. Copy to a short ASCII scratch path such as
C:\codex_build\project_namefor one isolation run. - Distinguish direct tool availability from MATLAB registration. MATLAB may fail even when a desktop shortcut launches the tool.
- Record the exact phase that passed: diagram update, simulation, code generation, CubeMX generation, compiler build, or binary creation.
Risk Checklist
Watch for:
- Algebraic loops.
- Unit/sample-time mismatches.
- Hidden Goto/From or Data Store dependencies.
- Unconnected ports.
- Solver stiffness and step-size drift.
- Simscape initialization failures.
- Stateflow unreachable states or missing default transitions.
Reporting
Always report model path, stop time, solver, changed blocks, logged signals, and validation artifacts.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: wzyn20051216
- Source: wzyn20051216/matlab-agent-skills
- License: MIT
- Homepage: https://github.com/wzyn20051216/matlab-agent-skills
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.