matlab/agent-skills-playground / demos/requirements-based-verification/skills/simulink-test-sequence-from-ears
simulink-test-sequence-from-ears
VerifiedGenerate Simulink Test Sequence blocks and harnesses from EARS requirements. Use when asked to create a test case from a requirement, generate tests from a .slreqx file, or verify a Simulink model with requirement-based tests.
| File | Kind | Size |
|---|---|---|
| LICENSE.md | markdown | 1.4 KB |
| SKILL.md | skill md | 5.6 KB |
| references/workflow-details.md | markdown | 15.1 KB |
| scripts/addPreconditionSteps.m | other | 1.4 KB |
| scripts/analizeRequirements.m | other | 2.9 KB |
| scripts/analyzeRequirements.m | other | 279 B |
| scripts/buildHarnessesFromApprovedYaml.m | other | 6.7 KB |
| scripts/collectSkillContext.m | other | 29.7 KB |
| scripts/compileHarnessModel.m | other | 326 B |
| scripts/configureEventDriven.m | other | 1.8 KB |
| scripts/configureStateDriven.m | other | 1.9 KB |
| scripts/configureTestSequence.m | other | 1.6 KB |
| scripts/configureUbiquitous.m | other | 1.5 KB |
| scripts/configureUnwantedBehavior.m | other | 1.9 KB |
| scripts/generateMappingReviewFromRequirements.m | other | 29.7 KB |
| scripts/generateSignalMappingsFromYaml.m | other | 4.3 KB |
| scripts/generateTestSequencesFromRequirements.m | other | 4.7 KB |
| scripts/parseEARSPattern.m | other | 2.3 KB |
| scripts/prepareWritableBuildWorkspace.m | other | 1.5 KB |
| scripts/readMappingReviewYaml.m | other | 6.6 KB |
| scripts/writeMappingReviewYaml.m | other | 9.2 KB |
scripts/analizeRequirements.m
View on GitHubfunction context = analizeRequirements(modelName, reqFilePath)
%ANALIZEREQUIREMENTS Extract requirements, model signals, bus definitions, and enums
% for use with the simulink-test-sequence-from-ears skill (Phase 1).
%
% CONTEXT = analizeRequirements(MODELNAME, REQFILEPATH)
%
% Inputs:
% modelName - Simulink model name (without .slx extension)
% reqFilePath - Path to the .slreqx requirements file
%
% Outputs:
% context - Struct with requirements, interfaces, buses, enums,
% and Stateflow transition context
%
% Side effects printed to console:
% - Requirements with EARS pattern classification
% - Model I/O ports with data types
% - Bus definitions (from .sldd files in current directory)
% - Enumeration types (from .m files in current directory)
context = collectSkillContext(modelName, reqFilePath);
fprintf('\n=== REQUIREMENTS ANALYSIS ===\n\n');
for i = 1:numel(context.requirements)
req = context.requirements(i);
fprintf('Requirement ID: %s\n Title: %s\n Description: %s\n EARS Pattern: %s\n', ...
req.id, req.summary, req.description, req.pattern);
if strlength(req.trigger) > 0
fprintf(' Trigger: "%s"\n', req.trigger);
end
if strlength(req.behavior) > 0
fprintf(' Behavior: "%s"\n', req.behavior);
end
fprintf('\n');
end
fprintf('\n=== MODEL I/O SIGNALS ===\n');
fprintf('INPUTS:\n');
for i = 1:numel(context.interfaces.inputs)
fprintf(' %s (%s)\n', ...
context.interfaces.inputs(i).name, context.interfaces.inputs(i).data_type);
end
fprintf('OUTPUTS:\n');
for i = 1:numel(context.interfaces.outputs)
fprintf(' %s (%s)\n', ...
context.interfaces.outputs(i).name, context.interfaces.outputs(i).data_type);
end
fprintf('\n=== BUS DEFINITIONS ===\n');
for i = 1:numel(context.buses)
fprintf('\nBus: %s\n', context.buses(i).name);
for j = 1:numel(context.buses(i).elements)
fprintf(' .%s (%s)\n', context.buses(i).elements(j).name, ...
context.buses(i).elements(j).data_type);
end
end
fprintf('\n=== ENUMERATION TYPES ===\n');
for i = 1:numel(context.enums)
fprintf('%s: ', context.enums(i).name);
for j = 1:numel(context.enums(i).members)
fprintf('%s(%d) ', context.enums(i).members(j).name, context.enums(i).members(j).value);
end
fprintf('\n');
end
fprintf('\n=== STATEFLOW TRANSITIONS ===\n');
for i = 1:numel(context.stateflow.charts)
fprintf('Chart: %s\n', context.stateflow.charts(i).path);
for j = 1:numel(context.stateflow.charts(i).transitions)
tr = context.stateflow.charts(i).transitions(j);
fprintf(' %s -> %s : %s\n', tr.source_state, tr.destination_state, tr.condition);
end
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 |