wzyn20051216/matlab-agent-skills / skills/matlab-testing-ci
matlab-testing-ci
VerifiedMATLAB testing, validation, and CI workflow for matlab.unittest, MATLAB Test, Simulink Test, coverage, artifact generation, GitHub Actions, and open-source reproducibility. Use whenever MATLAB work needs verification, regression tests, CI, GitHub publication, or acceptance criteria.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.5 KB |
| assets/install-roots.json | config | 2.9 KB |
| scripts/mas_bench_record.m | other | 11.5 KB |
| scripts/mas_capability_check.m | other | 12.7 KB |
| scripts/mas_delivery_check.m | other | 32.2 KB |
| scripts/mas_grade.m | other | 5.5 KB |
| scripts/mas_phase43_grade.m | other | 12.4 KB |
| scripts/mas_ref_derive.m | other | 21.7 KB |
| scripts/mas_ref_spec.m | other | 6.3 KB |
| scripts/mas_refcheck.m | other | 10.7 KB |
| scripts/mas_skill_audit.m | other | 10.9 KB |
| scripts/mas_skill_install_audit.m | other | 13.7 KB |
| scripts/mas_verify_task.m | other | 3.9 KB |
| tests/test_bench.m | other | 5.4 KB |
| tests/test_capability.m | other | 6.1 KB |
| tests/test_delivery_check.m | other | 22.0 KB |
| tests/test_grade.m | other | 3.0 KB |
| tests/test_phase43_grade.m | other | 9.1 KB |
| tests/test_refcheck.m | other | 5.0 KB |
| tests/test_skill_install_audit.m | other | 8.7 KB |
scripts/mas_grade.m
View on GitHubfunction r = mas_grade(checks)
%MAS_GRADE Separate three questions that are usually conflated:
% 1. did it run?
% 2. is the number right?
% 3. does it meet the engineering requirement?
%
% r = mas_grade(checks)
%
% WHY THIS SPLIT MATTERS
% Phase 3A/3B produced all three failure combinations, and each one was once
% reported as "PASS" by somebody:
% * a run that finished with NaN (ran, not correct)
% * a correct number for a design that cannot meet the spec (correct, not
% acceptable -- e.g. 47.9 V steady state but 2.25 ms recovery)
% * a skipped check counted as a pass (not even ran)
% A single boolean cannot express that, so it does not get to.
%
% CHECK FIELDS
% id string
% executed logical -- was the check actually run?
% kind 'numeric' | 'domain'
% value measured number (numeric only)
% reference independent reference (numeric only; must NOT be self-generated)
% tol absolute tolerance, OR struct('rel',x) (numeric only)
% limit threshold (domain only)
% cmp 'le' | 'ge' (domain only; default 'le')
% reason optional explanation for a skip/fail
%
% OUTPUT
% r.ran logical
% r.correct true | false | 'UNDETERMINED' (no numeric check = undetermined,
% NOT true: absence of evidence)
% r.meets true | false | 'UNDETERMINED' (no domain check = undetermined)
% r.overall 'FAIL' | 'RAN_ONLY' | 'CORRECT_NOT_ACCEPTED' | 'PASS' | 'UNDETERMINED'
% r.failures cellstr of ids that failed, with the measured value
if ~isstruct(checks) || isempty(checks)
error('mas_grade:input','checks must be a non-empty struct array');
end
nNum = 0; nDom = 0;
ran = true;
numOK = true; domOK = true;
domInvalid = false;
failures = {};
for k = 1:numel(checks)
c = checks(k);
if ~isfield(c,'executed') || ~c.executed
ran = false;
why = '';
if isfield(c,'reason'), why = c.reason; end
failures{end+1} = sprintf('%s: not executed %s', c.id, why); %#ok<AGROW>
continue;
end
kind = 'domain';
if isfield(c,'kind') && ~isempty(c.kind), kind = c.kind; end
switch lower(kind)
case 'numeric'
nNum = nNum + 1;
if ~isfield(c,'reference') || isempty(c.reference)
numOK = false;
failures{end+1} = sprintf('%s: no independent reference', c.id); %#ok<AGROW>
continue;
end
% Absence is not a pass. An empty value made `err <= tol` empty and
% the old `if` treated it as false, so a check that never produced a
% number could leave numOK untouched. NaN and Inf are the same kind
% of non-evidence and must fail loudly.
if isempty(c.value) || ~isnumeric(c.value) || ~isscalar(c.value) || ...
~isfinite(c.value)
numOK = false;
failures{end+1} = sprintf('%s: value is empty/non-scalar/non-finite', c.id); %#ok<AGROW>
continue;
end
if ~isnumeric(c.reference) || ~isscalar(c.reference) || ~isfinite(c.reference)
numOK = false;
failures{end+1} = sprintf('%s: reference is not a finite scalar', c.id); %#ok<AGROW>
continue;
end
tol = 0;
if isfield(c,'tol') && ~isempty(c.tol)
if isstruct(c.tol), tol = c.tol.rel*abs(c.reference);
else, tol = c.tol; end
end
if ~isfinite(tol) || tol < 0
numOK = false;
failures{end+1} = sprintf('%s: tolerance is invalid', c.id); %#ok<AGROW>
continue;
end
err = abs(c.value - c.reference);
if ~(err <= tol)
numOK = false;
failures{end+1} = sprintf('%s: |%.6g - %.6g| = %.3g > tol %.3g', ...
c.id, c.value, c.reference, err, tol); %#ok<AGROW>
end
case 'domain'
nDom = nDom + 1;
if isempty(c.value) || ~isnumeric(c.value) || ~isscalar(c.value) || ...
~isfinite(c.value) || ~isfinite(c.limit)
domInvalid = true;
failures{end+1} = sprintf('%s: domain measurement is empty/non-finite', c.id); %#ok<AGROW>
continue;
end
cmp = 'le';
if isfield(c,'cmp') && ~isempty(c.cmp), cmp = c.cmp; end
if strcmpi(cmp,'le'), ok = c.value <= c.limit;
else, ok = c.value >= c.limit; end
if ~ok
domOK = false;
failures{end+1} = sprintf('%s: %.6g vs limit %s %.6g', ...
c.id, c.value, cmp, c.limit); %#ok<AGROW>
end
otherwise
error('mas_grade:kind','unknown check kind "%s"', kind);
end
end
r = struct();
r.ran = ran;
if nNum == 0
r.correct = 'UNDETERMINED';
else
r.correct = numOK;
end
if nDom == 0 || (domInvalid && domOK)
r.meets = 'UNDETERMINED';
else
r.meets = domOK;
end
r.nNumeric = nNum; r.nDomain = nDom;
r.failures = failures;
if ~ran
r.overall = 'FAIL'; % not everything ran
elseif isequal(r.correct,false)
r.overall = 'FAIL'; % numbers are wrong
elseif isequal(r.meets,false)
r.overall = 'CORRECT_NOT_ACCEPTED'; % numbers right, requirement not met
elseif ischar(r.correct) || ischar(r.meets)
r.overall = 'UNDETERMINED'; % missing evidence is not a pass
else
r.overall = 'PASS';
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 |