Matlab Model Code Generator
Generate and run minimal reproducible MATLAB or Beita Tianyuan compatible code for the...
Install
npx skills add zhnnky329/MathModeling-skills --skill matlab-model-code-generator -g -a claude-code -y- Repository
- zhnnky329/MathModeling-skills1.1k
- Category
- Engineering
- Updated
- 1mo ago
- License
- MIT
- Context cost
- Lightabout 621 tokens
- Runs scripts
- No, instructions only
What it does
Generate and run minimal reproducible MATLAB or Beita Tianyuan compatible code for the human-approved main method and usable baseline, with compact experiment artifacts and a canonical run summary.
Preconditions
- G2.5 human method choice is recorded.
code/matlab/Qx/qx_code_plan.mdexists.- Required cleaned data and profile exist.
- The plan targets MATLAB or 北太天元.
Legacy artifacts may be read during migration but do not override the human decision.
Workflow
- Read the code plan, decision ledger, method card, probe conditions, and data profile.
- Confirm scope: approved main plus usable baseline. Implement a fallback only after activation.
- Generate conservative
.mfiles undercode/matlab/Qx/. - Prefer basic matrix/table operations and avoid optional toolboxes unless the plan approves them.
- Save tables, metrics, useful figures, and
run_summary.jsonunderresults/Qx/experiments/roundN/. - Evaluate output-degeneracy and fallback-trigger metrics required by the plan.
- Use
diaryor another full log only for a failure or reproducibility warning. - Run in the available compatible runtime. If unavailable, report the unexecuted state explicitly.
- Hand off to
code-reviewer.
Script Layout
code/matlab/Qx/
├── qx_code_plan.md
├── qx_baseline.m
├── qx_main.m
└── run_all.m % only when useful
Do not create scripts for unapproved candidates or a duplicate README.
Compatibility Rules
- Prefer
readtable,readmatrix,writetable,writematrix,save,load, andfullfile. - Use
rng(2026)or the recorded seed. - Use
jsonencodewhen supported; otherwise write the required JSON fields deterministically. - Avoid Live Scripts, App Designer, GUI code, Simulink, and toolbox-only functions unless explicitly approved.
- Note any 北太天元 compatibility risk in the run summary.
Run Summary
Follow the model-code-analyzer contract, including approved decision ID, roles, paths, metrics, output-degeneracy evidence, fallback state, timing, seed, environment, warnings, and errors.
