$npx -y skills add matlab/matlab-agentic-toolkit --skill matlab-create-experimentCreate an experiment for the MATLAB Experiment Manager app from user code, script, or problem description. TRIGGER when: user asks to create an experiment from a script/function, wants to sweep parameters or hyperparameters, asks to compare configurations, or describes a problem
| 1 | # Create Experiment for Experiment Manager |
| 2 | |
| 3 | Plans and creates experiments in MATLAB Experiment Manager by analyzing user code or problem |
| 4 | descriptions, determining the experiment type, and generating the appropriate experiment |
| 5 | function, hyperparameter table, and experiment object. |
| 6 | |
| 7 | ## When to Use |
| 8 | - User has a MATLAB script/function and wants to sweep parameters or hyperparameters |
| 9 | - User asks to create an experiment or compare configurations |
| 10 | - User describes a problem and wants to explore parameter space |
| 11 | - User wants to track outputs across different parameter combinations |
| 12 | |
| 13 | ## When NOT to Use |
| 14 | - User is debugging an existing experiment or training failure |
| 15 | - User wants to run, resume, or view results of an existing experiment |
| 16 | - User already has a working Experiment Manager experiment set up |
| 17 | - User wants to edit experiment settings (hyperparameters, strategy, description) — direct them to make changes in the Experiment Manager app. However, editing the experiment function code (.m file) is allowed. |
| 18 | - User wants Bayesian optimization or random sampling strategy — direct them to configure from the Experiment Manager app |
| 19 | |
| 20 | --- |
| 21 | |
| 22 | ## Autonomy Model |
| 23 | |
| 24 | This skill follows a guidance + autonomy pattern. Decision points are tagged: |
| 25 | |
| 26 | | Tag | Meaning | |
| 27 | |-----|---------| |
| 28 | | `[user]` | Always pause and ask. Non-negotiable. | |
| 29 | | `[auto]` | Agent decides silently. Escalates on failure. | |
| 30 | | `[depends]` | Resolved by clarity of signals — auto if clear, ask if ambiguous. | |
| 31 | |
| 32 | After analysis, tell the user how you intend to work in one plain sentence. |
| 33 | Always add: "Let me know if you'd prefer more or less control." |
| 34 | |
| 35 | --- |
| 36 | |
| 37 | ## Phase 1: Analysis |
| 38 | |
| 39 | Read the user's code or problem description and classify the experiment type. |
| 40 | |
| 41 | ### Type Classification |
| 42 | |
| 43 | Classify into one of three types using API-level and semantic signals. |
| 44 | |
| 45 | **IMPORTANT:** If semantic signals indicate training (even without explicit DL API calls), |
| 46 | classify as training — NOT general purpose. |
| 47 | |
| 48 | | Type | Signals | Template class | |
| 49 | |------|---------|----------------| |
| 50 | | General purpose | No DL functions, no training indicators. Optimization, simulation, data analysis. | `'experiments.internal.experimentTemplates.MATLABFunction'` | |
| 51 | | Built-in training | Uses `trainnet`/`trainNetwork`/`trainingOptions`, standard layers, datastores. OR: file name contains "train", user mentions "classification"/"transfer learning". | `'experiments.internal.experimentTemplates.BlankTrainnetTraining'` | |
| 52 | | Custom training (custom loop) | Uses `dlnetwork`/`dlfeval`/`dlgradient`/`dlarray`, manual gradients, GANs. OR: training loop with loss computation, user mentions "fine-tune"/"detector". | `'experiments.internal.experimentTemplates.CustomTraining'` | |
| 53 | |
| 54 | ### Classification Priority |
| 55 | 1. Training loop structure (epoch iteration, loss tracking) → Custom training |
| 56 | 2. Sets up data/layers/options without looping → Built-in training |
| 57 | 3. Neither semantic nor API signals indicate training → General purpose |
| 58 | |
| 59 | ### Discovery Variables |
| 60 | |
| 61 | | Variable | Tag | Notes | |
| 62 | |----------|-----|-------| |
| 63 | | Experiment type | `[depends]` | Auto if signals are clear; ask if ambiguous | |
| 64 | | Parameters to sweep | `[depends]` | Auto-infer from hardcoded values; ask if unclear | |
| 65 | | Parameter values | `[auto]` | Suggest 2-3 alternatives around hardcoded values | |
| 66 | | Init function needed | `[auto]` | Yes if expensive ops independent of params detected | |
| 67 | | Function signature | `[auto]` | Determined by type (see REFERENCES.md) | |
| 68 | |
| 69 | Exit criteria: type classified, parameters identified, outputs known. |
| 70 | |
| 71 | --- |
| 72 | |
| 73 | ## Phase 2: Design |
| 74 | |
| 75 | Generate the experiment function and prepare the full design for user review. |
| 76 | |
| 77 | 1. **Description** — Create a 2-4 line description covering: what the experiment does, |
| 78 | parameters being swept, outputs captured per trial, and evaluation criterion. |
| 79 | |
| 80 | 2. **Parameters** — Build the parameter table (Name | Values | Description). |
| 81 | - Hardcoded value → suggest 2-3 alternatives around it |
| 82 | - Categorical → list reasonable alternatives |
| 83 | - `[auto]` Warn if total trials > 50 (suggest reducing values) |
| 84 | |
| 85 | 3. **Function signature** — Select based on type: |
| 86 | |
| 87 | | Type | Signature | |
| 88 | |------|-----------| |
| 89 | | General purpose | `[out1, out2, ...] = func(params)` | |
| 90 | | Built-in (Form A, targets in datastore) | `[trainingData, net, lossFcn, options] = func(params)` | |
| 91 | | Built-in (Form B, targets separate) | `[trainingData, targets, net, lossFcn, options] = func(params)` | |
| 92 | | |