matlab/curating-library-kg
Guide users through curating the library knowledge index — reviewing block categories, marking common/important blocks, and improving block descriptions via agent inference for better agent block selection.
npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill curating-library-kg
Curate .satk/library-kg/ for better agent block selection. Infer categories and descriptions from block metadata in .satk/library-cache/*.json, save curation to .satk/library-curation.json, then regenerate the KG.
building-simulink-models Gate 3.configuring-block-policybuilding-simulink-modelsbuilding-simulink-modelssatk-libraries.json or .satk/reuse-libraries.json must exist with libraries declaredmetadataQuality: "low" and "medium" blocks across ALL declared libraries. These blocks have no useful information. Write a short intent-focused description for every such block to help with agent block selection. Do not skip blocks because a file is large or because they seem unrelated to the current task."high" quality blocks are encouraged but optional.Determine mode before starting. Do not proceed without mode selection.
If .satk/library-kg/index.md already exists, start at step 1 (review existing state). If not, start at step 2.
index.md and common.md, summarize current state to user (libraries, block count, categories, common blocks)..satk/library-cache/*.json files in full. If a file exceeds read limits, read it in chunks until every block has been processed. Apply Curation Rules above — write custom descriptions for blocks, prioritizing low/medium quality. Do NOT proceed to Step 4 until descriptions exist for every low/medium quality block across ALL cache files. Save to customDescriptions.commonBlocks.categoryAssignments.library.LibraryCuration.save(projectRoot, curation), then run library.kg.Populate.run(projectRoot). Present the output summary to the user.libConfig = library.LibraryConfig.load(projectRoot);
library.LibraryCatalog.getOrCreate(libConfig, projectRoot);
Read .satk/library-cache/*.json directly. Each file:
{
"libraryName": "MotorLib",
"description": "Motor control library",
"blocks": [
{
"name": "SpeedController",
"maskType": "SpeedCtrl",
"blockType": "SubSystem",
"maskDescription": "Closed-loop speed regulation with anti-windup",
"description": "",
"pathCategory": "Controllers",
"metadataQuality": "high",
"referenceBlock": "MotorLib/Controllers/SpeedController"
}
]
}
projectRoot = prefdir();
curation = library.LibraryCuration.load(projectRoot);
curation.commonBlocks = {'Speed Controller', 'Torque Estimator'};
curation.categories = struct('name', 'motors', 'description', 'Electric motors', 'keywords', {{'motor', 'drive'}});
% Use containers.Map — supports any block name as key
curation.customDescriptions = containers.Map('KeyType', 'char', 'ValueType', 'char');
curation.customDescriptions('Unit Delay') = 'Delay signal by one sample period';
curation.customDescriptions('1-D Lookup Table') = 'Interpolate output from breakpoint-value pairs';
curation.categoryAssignments = containers.Map('KeyType', 'char', 'ValueType', 'char');
curation.categoryAssignments('DC Current Controller') = 'motor-control';
library.LibraryCuration.save(projectRoot, curation);
library.kg.Populate.run(projectRoot);
Important: Use containers.Map (not struct) for customDescriptions and categoryAssignments. Struct field names cannot contain spaces or hyphens, which most Simulink block names have.
{
"customDescriptions": [
{"block": "Unit Delay", "value": "Delay signal by one sample period"},
{"block": "1-D Lookup Table", "value": "Interpolate output from breakpoint-value pairs"}
],
"categoryAssignments": [
{"block": "DC Current Controller", "value": "motor-control"}
]
}
| Field | Type | Effect |
|-------|------|--------|
| commonBlocks | cell array of strings | Always shown in common.md regardless of quality score |
| categories | struct array with .name, .description, .keywords | Defines categories with keyword matching for assignment |
| categoryAssignments | containers.Map (blockName → categoryName) | Per-block category assignment |
| customDescriptions | containers.Map (blockName → description) | Per-block custom description (intent) |
find_system, get_param on library .slx files. Read .satk/library-cache/*.json for metadata, use library.kg.Populate.run() to generate the KG, and library.kg.Query.search() for lookups..satk/library-cache/*.json or .satk/library-kg/*.md directly — they are auto-generated.library.LibraryCuration.save() only.anges with the user before saving
----
Copyright 2026 The MathWorks, Inc.
----
Take matlab/curating-library-kg from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.