setup-custom-libraries

$npx mdskill add matlab/simulink-agentic-toolkit/setup-custom-libraries

Register or update custom Simulink block libraries for agent-assisted modeling.

  • Solves the need to add custom blocks for agent-preferred model building.
  • Depends on .satk/reuse-libraries.json, block-policy.json, and library-kg/index.md.
  • Checks existence of three config files to decide setup or addition.
  • Updates configuration files so agent uses custom libraries over built-in blocks.

SKILL.md

.github/skills/setup-custom-librariesView on GitHub ↗
---
name: setup-custom-libraries
description: Declare, add, or update custom Simulink block libraries and configure block policy and knowledge index. Use when a user wants to register, set up, configure, or add new files to their custom libraries for agent-assisted model building.
license: MathWorks BSD-3-Clause
metadata:
  author: MathWorks
  version: "1.1"
---

# Setup Custom Libraries

Register or update custom Simulink block libraries so the agent prefers them over built-in blocks during model building.

## When to Use

- User asks to set up, register, add, or configure custom libraries
- User wants to add new `.slx` files to an existing library configuration
- User says "setup custom libraries", "add my library", "configure libraries", "add a new library file"
- `building-simulink-models` routes here via the policy gate

## When NOT to Use

- Only configuring block exclusions or parameter protection (libraries already declared) → `configuring-block-policy`
- Only curating block descriptions/categories (libraries already declared) → `curating-library-kg`

## Workflow

**Do this FIRST and ALONE — no other tool calls in the same message.**

Check all three files: `.satk/reuse-libraries.json`, `.satk/block-policy.json`, `.satk/library-kg/index.md`.

- **All three exist → setup already complete.** If they want to add new libraries, proceed to "Adding files" below.
- **`.satk/reuse-libraries.json` exists with `confirmedNone: true` → no custom libraries configured.** Ask the user if they want to change that. If not, setup is complete — skip Gates 2 and 3.
- **Any missing → run gates sequentially:**

Follow `references/library-setup.md` for all gate resolution details — it is the single source of truth for API calls, examples, and options at each gate.

**Gate 1 — Library declaration:** If `.satk/reuse-libraries.json` is missing, STOP and ask the user about reusable libraries. Do not read reference files, open models, or plan blocks until they respond.
**Gate 2 — Block policy:** If `.satk/block-policy.json` is missing, STOP and ask the user about policy setup by following `references/library-setup.md`. Do not proceed until policy is resolved.
**Gate 3 — Library blocks knowledge index:** If `.satk/library-kg/index.md` is missing, STOP and ask the user whether to index their library blocks so the agent knows which blocks are available during model building. Follow `references/library-setup.md` for options. Do not proceed until they respond.

If user confirms no libraries in Gate 1, save with `confirmedNone: true` and skip Gates 2 and 3.


### Adding files to existing config

When `.satk/reuse-libraries.json` already exists with declared libraries: read the existing config, append the new library entries, save via `library.LibraryConfig.save()`, then regenerate the knowledge index with `library.kg.Populate.run(projectRoot)` so new blocks are indexed.

## Guardrails

- **Never write `.satk/` JSON files manually.**  Always follow the instructions and APIs in `references/library-setup.md` for each case.
- **Do not use `find_system`, `load_system`** to discover, validate, or enumerate library contents. All library operations must go through the specified APIs in `references/library-setup.md`.
- **Each gate requires explicit user input before proceeding.** Do not assume anything, wait for the response before moving to the next gate.
  
----

Copyright 2026 The MathWorks, Inc.

----

More from matlab/simulink-agentic-toolkit

SkillDescription
author-modeladvisor-checks>
authoring-simulink-inputs>
building-architecture-modelsCommon steps for building multi-layer system architecture models using System Composer. Use when implementing architecture models or when interacting with interface dictionaries, allocation sets, stereotypes, and requirements for architecture components.
building-simulink-modelsBuilds and edits Simulink, System Composer, Stateflow, and Simscape models. Use when modifying model structure, parameters, ports, connections, or Stateflow chart internals.
checking-model-complianceUse this skill when the user asks to check Simulink model compliance against a standard (MISRA, MAB, JMAAB, ISO 26262, ISO 25119, DO-178C, DO-254, IEC 61508, IEC 62304, EN 50128, CERT C/CWE, AUTOSAR), wants to run Model Advisor checks, or needs a compliance report with fix suggestions. For JMAAB/MAB, supplement deterministic checks with agentic review of uncheckable guidelines.
configuring-block-policyGuide users through creating and managing .satk/block-policy.json for controlling which blocks the agent can use, which are excluded, and which block parameters the agent should not modify. Use when setting up block usage policy for a project.
create-sdi-run>
curating-library-kgGuide users through curating the library knowledge index — reviewing block categories, marking common/important blocks, and improving block descriptions for better agent block selection.
filing-bug-reportsGenerate 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.
generate-requirement-draftsGenerates 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.