
building-simulink-models
Builds and edits Simulink, System Composer, Stateflow, and Simscape models. Use when modifying model structure, parameters, ports, connections, or Stateflow chart internals.
- Installs
- 185
- 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 building-simulink-models- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads building-simulink-models automatically when relevant.
- 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.
Building Models
Use model_edit for all structural changes — Simulink, System Composer, Simscape, and Stateflow chart internals
When to Use
- Adding, connecting, deleting, or replacing blocks in a model
- Configuring block parameters, signal properties, or model settings
- Creating or editing Stateflow chart internals (states, transitions, junctions, data, events, messages, functions)
- Building System Composer architecture models
- Wiring Simscape physical connections
When NOT to Use
- Querying parameter values → use
model_query_params - Resolving variable references to numeric values → use
model_resolve_params
Library & Policy Prerequisites — BLOCKING GATE
Do this FIRST — evaluate the result before any other tool call. Do not narrate the gate check to the user; proceed silently based on the result.
Call library.settingsLookup() to check for custom library configuration. It returns a struct with resolved absolute paths:
found— whether a libraries file was located (satk-libraries.json or legacy reuse-libraries.json)enabled— whether custom libraries are configuredgatePass— whether the gate is satisfied (can proceed to build)kgIndexPath— absolute path tolibrary-kg/index.mdlibrariesPath— absolute path to the libraries filepolicyPath— absolute path toblock-policy.jsondataRoot— absolute path to the directory containing.satk/
Interpret the result:
found: false→ no custom libraries configured. Proceed with standard Simulink blocks.gatePass: true, found: true→ readkgIndexPathfor block lookup, then plan and edit.gatePass: false→ invokesetup-custom-librariesto populate the Knowledge Index.
Display meaningful description of each check and result instead of stating gate Pass/fail.
No model reading, planning, or editing begins until the gate passes.
Workflow
- Ensure Library & Policy Prerequisites: See BLOCKING GATE above. Do not proceed until gates pass.
- Library block lookup: List every block type you plan to use, search
.satk/library-kg/index.mdand the relevant category pages to find each of the library blocks that match. - Read first: Use
model_readon the target scope to get block IDs and understand existing topology. - Plan the data flow: For complex edits, sketch inputs → operations → outputs, then map to blocks identified in Step 1 & 2.
- Edit: Use
model_editwith operations scoped to one subsystem level at a time. - Verify: Use
model_readon the scope to confirm the structure matches your intent. - Check connectivity: After all edits in a scope are complete, run
model_checkto catch unconnected ports or dangling lines. Fix anyerror-severity issues.
If model_edit returns status: partial: Run both model_read and model_check immediately — don't wait until all edits are complete.
Operation Chaining with ref
Use ref to name a block and #ref to reference it in later operations within the same call:
[{"op": "add_block", "type": "Gain", "name": "MyGain", "ref": "g1"},
{"op": "connect", "target": "blk_5.y1 -> #g1.u1"}]
In SF scope, #ref references are portless — no .y1/.u1 suffixes (see references/stateflow.md).
The response created map shows ref → blk_id (or ref → sf_X in SF scope). In subsequent calls, use the returned ID — #ref only works within a single call.
Guardrails
- Never manually construct block path strings from names shown in
model_overviewormodel_read. Block names can contain invisible newlines and trailing whitespace that causehilite_system,open_system, andget_paramto fail. Instead, resolve paths fromblk_XIDs:% blk_42 → use the number after "blk_" as the SID blockPath = Simulink.ID.getFullName('<ModelName>:42'); hilite_system(blockPath) open_system(blockPath) get_param(blockPath, 'BlockType') - Do not call
Simulink.BlockDiagram.arrangeSystemor useset_paramfor block positioning unless the user explicitly requests it.model_edithas a built-in autolayout engine that runs automatically after each call. - Always pass
layout_modetomodel_edit. Use"full"when populating an empty scope (new model root, or a newly-created subsystem) for optimal block arrangement. Use"incremental"when adding blocks to a scope that already has existing blocks (preserves existing positions). - For requests to fix, tidy, or rearrange an existing layout, to re-place specific blocks, or to group or expand subsystems, load the
arranging-simulink-layoutsskill. - Each
model_editcall operates in exactly one domain (Simulink, System Composer, or Stateflow) determined by the scope. To add a Chart block and then populate it, use two calls: SL scope for the Chart block, then SF scope for internals. Usemodel_readbetween calls to discover the chart'ssf_Xscope ID. - Use meaningfully named variables (e.g.,
Kp_SpeedController) instead of hardcoded numeric values. Define variables in model workspace or a.minit script. - Don't use
evaluate_matlab_codewithset_param/add_blockto bypassmodel_edit— it skips autolayout, undo tracking, and error recovery - Use
open_systemrather thanload_systemto open models that are not already open, or when creating new models, unless the user explicitly asks otherwise or the model is a library. This ensures the user can see live edits as they happen.
Naming Conventions
Prefer code-generation-safe names for blocks, signals, and variables:
- Use only:
a-z,A-Z,0-9, underscore (_) - Don't start with a number
- Don't use leading/trailing or consecutive underscores
- Prefer names under 32 characters (required for some code generation targets)
Block Types
Use the block's display name in the type field. Do not construct or guess library paths.
-
Custom library blocks (from
satk-libraries.json): pass bothtypeANDReferenceBlockfields. Settypeto the block's display name andReferenceBlockto the full library path from the library KG. -
Toolbox KB blocks (from
activeToolboxes): Use them exactly like custom library blocks — reference thetypeandReferenceBlockfields from the toolbox category page in the library KG. -
Built-in Simulink blocks: Use the BlockType directly:
Gain,Sum,Constant,Integrator,SubSystem,Scope -
Library blocks (Simscape, Aerospace, DSP, Communications, etc.): Use the display name as it appears in the Simulink Library Browser:
Voltage Source,Resistor,DC Motor,Solver Configuration,6DOF (Euler Angles) -
If
model_editreturnsINVALID_TYPE: Fall back to the full library path from MATLAB documentation (e.g.,ee_lib/Sources/Voltage Source)
[{"op": "add_block", "type": "In", "ReferenceBlock": "customLib_Portsandsubsystems/In", "name": "Voltage", "ref": "v1"},
{"op": "add_block", "type": "Gain", "ReferenceBlock": "customLib_Mathoperations/Gain", "name": "Kp", "ref": "g1"},
{"op": "add_block", "type": "Add", "ReferenceBlock": "customLib_Mathoperations/Add", "name": "SumErr", "ref": "s1"},
{"op": "add_block", "type": "Out", "ReferenceBlock": "customLib_Portsandsubsystems/Out", "name": "Output", "ref": "o1"}]
[{"op": "add_block", "type": "Voltage Source", "name": "V1", "ref": "v1"},
{"op": "add_block", "type": "Resistor", "name": "R1", "ref": "r1"},
{"op": "add_block", "type": "Electrical Reference", "name": "Gnd", "ref": "gnd"},
{"op": "add_block", "type": "Solver Configuration", "name": "Solver", "ref": "sc"}]
Review Gate
After completing all edits for a scope, verify:
- No
error-severity issues frommodel_check(unconnected ports, dangling lines) - All
refnames resolved toblk_idin thecreatedmap — no dangling#refreferences in subsequent calls - Stateflow charts pass lint (
model_checkwithchecks='["stateflow_lint"]') before layout is applied - If
model_editreturnedstatus: partialat any point, confirm the scope is now structurally complete viamodel_read
Domain-Specific Rules
When working with these domains, read the corresponding reference file before editing:
- Stateflow charts ->
references/stateflow.md—model_editedits chart internals natively. Scope to a chart (sf_Xor chartblk_X) and use the same operations:add_blockfor SF elements, portlessconnectfor transitions,configurefor properties. The reference covers SF-specific syntax, scoping, LabelString patterns, and the two-call SL+SF workflow. - System Composer architecture models ->
references/system-composer.md— Create models withsystemcomposer.createModel, then usemodel_edit. Components usetype: "SubSystem", ports use Bus Element blocks. The reference covers component creation, port wiring, and behavior model generation. - Simscape physical models ->
references/simscape.md— Physical connections use bidirectional<->syntax. The reference covers connection semantics, port patterns, and initial target variables.
Copyright 2026 The MathWorks, Inc.
FAQ
What does the building-simulink-models skill do?
Builds and edits Simulink, System Composer, Stateflow, and Simscape models. Use when modifying model structure, parameters, ports, connections, or Stateflow chart internals.
How do I install building-simulink-models?
Run npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill building-simulink-models 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/building-simulink-models/ (personal) or .claude/skills/building-simulink-models/ (project).
Which AI agents can use building-simulink-models?
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 building-simulink-models 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 building-simulink-models?
It is published by matlab in matlab/simulink-agentic-toolkit. It has 185 recorded installs.
More from matlab/simulink-agentic-toolkit
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.
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.
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.
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.
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.
filing-bug-reports
matlab/simulink-agentic-toolkit
Generate a standalone bug report that another developer can use to reproduce, investigate, and fix an issue. Use when the user says 'file a bug', 'write a bug report', 'report this issue', or asks to document a defect for handoff.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available