k-dense-ai/matlab
Build, review, migrate, and safely plan MATLAB or GNU Octave numerical workflows, including arrays, tabular/time data, tests, projects, graphics, MAT files, and explicit Python interoperability.
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill matlab
Use this skill to design or review numerical code, migrate MATLAB releases,
prepare reproducible projects, and plan trusted execution. MATLAB and GNU
Octave are distinct products: compatibility is partial, not a license or
behavior guarantee.
named toolbox, MATLAB Test, MATLAB Compiler, MATLAB Coder, Parallel Computing
Toolbox, or an add-on is installed, licensed, or available to the user.
with MATLAB Compiler; it cannot run arbitrary source or host MATLAB Engine
for Python. Building artifacts needs the applicable licensed compiler and
every product used by the source.
MATLAB toolboxes. Similar names do not imply API, numerical, graphics, or
licensing equivalence.
the user actually has. Treat availability as unknown until confirmed.
See Octave compatibility and
execution/product boundaries.
Never run an untrusted .m, .mlx, MEX binary, MAT file, project startup or
shutdown action, package installer, or generated artifact. Static review does
not prove safety.
Treat these as execution or code-loading surfaces:
eval, evalin, assignin, text-derived feval, str2func, callbacks,timers, app callbacks, and dynamically modified paths;
system, unix, dos, shell escape !, Java, .NET, Python (py.*,pyrun, pyrunfile), MEX, and native libraries;
mex, codegen, MATLAB Compiler, build tasks, package/project startup, andgenerated code;
load, object deserialization (loadobj, custom serialization), functionhandles, Java/System objects, and class code reachable from MAT files.
.mlx is an opaque archive for this toolkit and MEX is native executable code.
Do not use Python pickle for exchange. Inspect first, isolate when appropriate,
obtain explicit approval, then invoke a user-confirmed executable and license.
Bundled scripts are static or dry-run tools: none launches MATLAB, Octave,
Python Engine, a compiler, or a subprocess.
base product versus required toolboxes/packages, expected inputs/outputs,
numerical tolerances, and whether execution is authorized.
.m files, opaque artifacts, project paths,required products, and MAT headers before any runtime loads them.
arguments block forautomation. Use scripts only for controlled orchestration and live scripts
for reviewed interactive narratives.
rules, indexing, implicit expansion, RNG algorithm/seed, tolerances, and
output formats.
graphics deterministic, and tests independent of base-workspace residue.
licenses, and launch only after explicit approval outside these helpers.
RNG policy, tolerances, and command plan without dumping the environment.
Functions have local workspaces and explicit inputs/outputs.
.mlx) mix code and rich output but are not plain-textreview artifacts. Export reviewed code to .m for static inspection.
clear all, broad addpath(genpath(...)), dependence on pwd, globalvariables, and silent name shadowing. Use project roots and fullfile.
arguments blocks. Remember thattype declarations can convert inputs; validators check without converting.
are private to the file; since R2024a they can appear anywhere in a script
outside conditional contexts.
function y = scaleSignal(x, options)
arguments
x (:,1) double {mustBeFinite}
options.Scale (1,1) double {mustBeFinite, mustBeNonzero} = 1
end
y = x .* options.Scale;
end
Read programming.
A(i,j), A(k), A(:,j),A{...}, and A.(name) have different semantics.
*, /, \, and ^ are matrix operations; dotted forms areelement-wise. Use A\b, not inv(A)*b.
before operations that could accidentally form an outer result.
huge temporaries or unreadable code. Measure with timeit or the profiler.
tolerances, not blanket == or a magic multiple of eps.
RandStream substreams forindependent parallel work; do not use time-based rng("shuffle") for a
reproducibility claim.
Read arrays and
mathematics.
table has named, equal-height variables that may have different types.T(rows,vars) returns a table; T{rows,vars} extracts contents; T.Var
selects one variable.
timetable additionally has row times. Sort, validate time zones anduniqueness, then use retime/synchronize intentionally.
NaN, NaT, <missing>,<undefined>, and empty character vectors. Integer and logical arrays have
no standard missing sentinel.
Preserve units, time zones, variable names, encodings, and missing rules.
Read data import/export.
Use explicit figure/axes handles and tiledlayout; label units; set limits,
color scales, font sizes, and colormaps deliberately. Prefer exportgraphics
over saveas for publication output. In R2026a it exports raster, PDF/EPS/EMF,
SVG, GIF, and interactive HTML; format capabilities differ. Specify
ContentType="vector" for suitable PDF/SVG-style output and Resolution for
raster output. Review accessibility and embedded-raster behavior.
Read graphics and export.
save default; matfile creates 7.3 by default.Versions 4/6/7/7.3 differ in types, compression, and per-variable limits.
Partial access and chunking can help large arrays.
can invoke class deserialization behavior; opaque/function/native content
requires escalation.
Do not rename pickle payloads as MAT files and do not deserialize pickle.
Read data import/export.
dependencies, source control, and reproducible entry points. Review project
actions before opening an untrusted project.
matlab.codetools.requiredFilesAndProducts and Dependency Analyzer arestatic approximations; dynamic dispatch can cause misses or false positives.
A required-product report does not prove a license is available.
codeIssues; legacy text workflows can use checkcode)and codeCompatibilityReport before migration.
matlab.unittest workflows. Parallel runs require Parallel Computing
Toolbox. Dependency-based selection, richer quality dashboards, generated
tests, and advanced coverage/equivalence features can require MATLAB Test or
other products.
runtests automatically opens and later closes a project when targettests belong to a project that is not already open. Account for startup and
shutdown actions before using this behavior.
Read programming and
execution/testing.
MATLAB Engine for Python, and MATLAB Compiler SDK for Python.
matlabengine==26.1.12 (released 2026-05-08). It requires an installed
R2026a; MATLAB Runtime alone is insufficient. R2026a also ships a
preinstalled Engine distribution under one named matlabroot path.
one named interpreter/executable; do not print the full environment,
PATH, PYTHONPATH, or credentials.
pyenv controls MATLAB-to-Python interpreter selection. In-process Pythongenerally requires restarting MATLAB to switch; out-of-process Python can
be terminated and reconfigured.
matlab.engine.start_matlab() starts a MATLAB process and can check out a
license. Never call it merely to probe availability.
tables/timetables, strings/missing values, datetime/duration, dictionaries,
shape/order, and unsupported sparse/object/categorical cases.
Read Python integration.
Every helper is network-free, bounded, symlink-rejecting, and nonexecuting.
Run from this skill directory with Python 3.11+. Bash is allowed only to invoke
these Python CLIs and validation commands; never use it to execute a generated
MATLAB/Octave argv plan or untrusted artifact.
| Helper | Purpose |
|---|---|
| scripts/plan_batch_command.py | Produce reviewed MATLAB/Octave argv; never execute |
| scripts/scan_m_code.py | Scan .m text and flag opaque .mlx/MEX risks |
| scripts/validate_project_manifest.py | Validate paths and declared product/license status |
| scripts/inventory_mat_file.py | Header/metadata inventory; never call loadmat |
| scripts/plan_python_compatibility.py | Check R2026a CPython/Engine compatibility |
| scripts/reproducibility_report.py | Hash named local artifacts and emit a bounded report |
| scripts/generate_function_scaffold.py | Dry-run or create function and unit-test scaffolds |
python scripts/scan_m_code.py path/to/source --root path/to/project
python scripts/plan_batch_command.py matlab script path/to/main.m --root path/to/project
python scripts/validate_project_manifest.py project-manifest.json --root path/to/project
python scripts/inventory_mat_file.py data.mat --root path/to/project
python scripts/plan_python_compatibility.py --python-version 3.13
python scripts/reproducibility_report.py --root path/to/project --file src/analyze.m
python scripts/generate_function_scaffold.py analyzeSignal --root path/to/project
The scaffold generator defaults to dry-run; writing requires --write and
refuses collisions. SciPy and h5py are optional inventory backends; if
authorized, add exact reviewed versions to the caller's project lockfile.
They are not required for --help or header-only inventory, and this skill
does not perform package installation.
exportgraphicsBundled JSON assets are the project manifest,
reproducibility manifest, and
R2026a Python table. There is no
templates/ directory and no Markdown file is loaded from assets/;
local-link tests enforce this package contract.
Take k-dense-ai/matlab 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.