wzyn20051216/matlab-agent-skills / skills/matlab-runner
matlab-runner
VerifiedRun MATLAB tasks from Codex with reliable MCP-based execution, logs, artifacts, toolbox inventory, smoke tests, and reproducible validation. Use whenever MATLAB code, .m/.mlx scripts, MATLAB tests, local toolbox probing, or command-line automation is needed.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 13.5 KB |
| references/acceptance-levels.md | markdown | 3.0 KB |
| references/failure-classes.md | markdown | 2.5 KB |
| references/mcp-readiness-ladder.md | markdown | 6.4 KB |
| references/toolbox-feature-map.md | markdown | 1.1 KB |
| scripts/mas_dep_probe.m | other | 11.4 KB |
| scripts/mas_precheck.m | other | 7.5 KB |
| scripts/mas_product_map.m | other | 6.2 KB |
| scripts/mas_toolbox_map.m | other | 2.8 KB |
| tests/test_dep_probe.m | other | 6.2 KB |
| tests/test_precheck.m | other | 3.6 KB |
tests/test_dep_probe.m
View on GitHubfunction res = test_dep_probe(verbose)
%TEST_DEP_PROBE Pins the five-level dependency discovery and the name aliases.
%
% res = test_dep_probe()
%
% Half of these cases must FAIL to resolve: a probe that answers "OK" for a folder
% name, for a bogus product, or for a product whose feature is spelled the display
% name, is worse than no probe at all -- it turns a fixable environment problem
% into a mystery.
if nargin < 1, verbose = true; end
here = fileparts(mfilename('fullpath'));
addpath(fullfile(fileparts(here), 'scripts'));
T = struct('name', {}, 'fn', {}, 'expectState', {}, 'expectPass', {}, 'check', {});
T(end+1) = tc('callable function', @() mas_dep_probe('function', 'butter'), 'OK', true, '');
T(end+1) = tc('folder is not a function', @() mas_dep_probe('function', 'robotics'), 'IS_A_DIRECTORY', false, '');
T(end+1) = tc('bogus function name', @() mas_dep_probe('function', 'no_such_fn_xyz'), 'FN_NOT_FOUND', false, '');
T(end+1) = tc('licensed product', @() mas_dep_probe('product', 'Signal Processing Toolbox'), 'OK', true, '');
T(end+1) = tc('product by old name', @() mas_dep_probe('product', 'Neural Network Toolbox'), 'OK', true, 'Deep Learning Toolbox');
T(end+1) = tc('product alias 2', @() mas_dep_probe('product', 'Statistics Toolbox'), 'OK', true, 'Statistics and Machine Learning Toolbox');
T(end+1) = tc('case insensitive', @() mas_dep_probe('product', 'signal processing toolbox'), 'OK', true, '');
T(end+1) = tc('unknown product', @() mas_dep_probe('product', 'Quantum Nonsense Toolbox'), 'UNKNOWN_PRODUCT', false, '');
T(end+1) = tc('feature name as product', @() mas_dep_probe('product', 'Signal_Toolbox'), 'UNKNOWN_PRODUCT', false, '');
T(end+1) = tc('feature probe', @() mas_dep_probe('feature', 'Signal_Toolbox'), 'OK', true, '');
T(end+1) = tc('exec probe ok', @() mas_dep_probe('exec', 'x = 1;'), 'OK', true, '');
T(end+1) = tc('exec probe fails', @() mas_dep_probe('exec', 'error(''boom'')'), 'EXEC_FAILED', false, '');
T(end+1) = tc('deep function probe', @() mas_dep_probe('function', 'tf', struct('deep', true)), 'OK', true, '');
% UAV Toolbox: installed AND licensed on this machine. It was absent from the
% product map, so the probe answered UNKNOWN_PRODUCT -- a false negative that
% then propagated into the capability matrix as "UAV Toolbox is NOT INSTALLED".
T(end+1) = tc('UAV product resolves', @() mas_dep_probe('product', 'UAV Toolbox'), 'OK', true, '');
% Communications Toolbox: installed, and USABLE, but the feature name in our map
% is wrong -- license('test','Communications_Toolbox') returns 0 while the
% product's own probe runs. The probe is the stronger evidence, so the verdict
% must be OK rather than a false NOT_LICENSED.
T(end+1) = tc('probe rescues wrong feature name', @() mas_dep_probe('product', 'Communications Toolbox'), 'OK', true, '');
% NEGATIVE CONTROL for the line above. The rescue is conditional on the probe
% actually RUNNING and SUCCEEDING. With the probe suppressed, the same wrong
% feature name must fall back to NOT_LICENSED -- otherwise the "rescue" is just
% a way of always saying OK, which would make every missing toolbox look
% available.
T(end+1) = tc('neg: no probe -> NOT_LICENSED', @() mas_dep_probe('product', 'Communications Toolbox', struct('skipExec', true)), 'NOT_LICENSED', false, '');
% ---- core built-ins must NOT be reported missing ----------------------------
% exist(name,'file') excludes built-ins by design, so chol/eig/inv came back
% FN_NOT_FOUND and svd came back IS_A_DIRECTORY. These pins hold the fix.
core = {'chol', 'svd', 'eig', 'inv', 'fft', 'sprintf'};
for k = 1:numel(core)
nm = core{k};
T(end+1) = tc(['builtin ' nm], @() mas_dep_probe('function', nm), 'OK', true, '');
end
% the legacy entry point must still answer, and must agree with the new one
tb = mas_precheck('toolbox', 'Signal Processing Toolbox');
nP = 0;
if verbose, fprintf('=== dependency probe tests ===\n'); end
R = struct('case', {}, 'state', {}, 'level', {}, 'pass', {}, 'detail', {});
for k = 1:numel(T)
t = T(k);
r = t.fn();
ok = strcmp(r.state, t.expectState) && (r.pass == t.expectPass);
if ~isempty(t.check)
ok = ok && strcmp(r.product, t.check);
end
nP = nP + ok;
if verbose
fprintf(' [%s] %-24s -> %-16s L%d %s\n', tern(ok, 'PASS', 'FAIL'), ...
t.name, r.state, r.level, shorten(r.detail));
end
R(end+1) = struct('case', t.name, 'state', r.state, 'level', r.level, ...
'pass', ok, 'detail', r.detail); %#ok<AGROW>
end
okTb = tb.pass && isfield(tb.value, 'feature') && strcmp(tb.value.feature, 'Signal_Toolbox');
nP = nP + okTb;
if verbose
fprintf(' [%s] %-24s -> %s\n', tern(okTb, 'PASS', 'FAIL'), 'mas_precheck delegate', tb.detail);
end
% ---- aliases must map to the SAME feature, not a second copy -----------------
aliasPairs = { ...
'Deep Learning Toolbox', 'Neural Network Toolbox'; ...
'Statistics and Machine Learning Toolbox', 'Statistics Toolbox'; ...
'Simscape Electrical', 'Simscape Power Systems'};
nAlias = 0;
for k = 1:size(aliasPairs, 1)
a = mas_product_map(aliasPairs{k, 1});
b = mas_product_map(aliasPairs{k, 2});
nAlias = nAlias + (a.found && b.found && strcmp(a.feature, b.feature) && ...
strcmp(a.name, b.name));
end
if verbose
fprintf(' [%s] %-24s -> %d/%d alias pairs share one row\n', ...
tern(nAlias == size(aliasPairs, 1), 'PASS', 'FAIL'), 'cross-version aliases', ...
nAlias, size(aliasPairs, 1));
end
total = numel(T) + 1 + size(aliasPairs, 1);
allok = (nP + nAlias) == total;
res = struct('nPass', nP + nAlias, 'nTotal', total, 'cases', R, 'pass', allok, ...
'legacyDelegate', tb);
if verbose
fprintf('\n---- %d / %d dependency cases passed ----\n', nP + nAlias, total);
end
end
% ---------------------------------------------------------------------------
function t = tc(name, fn, state, pass, product)
t = struct('name', name, 'fn', fn, 'expectState', state, 'expectPass', pass, ...
'check', product);
end
function s = shorten(s)
if numel(s) > 72, s = [s(1:69) '...']; end
end
function s = tern(c, a, b)
if c, s = a; else, s = b; end
end
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate 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. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |