$npx -y skills add matlab/matlab-agentic-toolkit --skill matlab-install-productsDeterministic workflow to download MATLAB Package Manager (mpm) and install MathWorks products from the OS command line with consistent, repeatable behavior. Use when installing MATLAB, Simulink, toolboxes, or support packages via command line, or setting up scripted installation
| 1 | # Installing MATLAB Products with MATLAB Package Manager (mpm) - Deterministic Protocol |
| 2 | |
| 3 | Use this skill when asked to install MathWorks products using MATLAB Package Manager (mpm) from the OS command line. |
| 4 | |
| 5 | $ARGUMENTS |
| 6 | |
| 7 | ## When to Use |
| 8 | |
| 9 | - User asks to install MATLAB, Simulink, toolboxes, or support packages via the command line |
| 10 | - User wants a scripted, repeatable MATLAB installation (CI/CD, containers, fleet provisioning) |
| 11 | - User asks about mpm, MATLAB Package Manager, or non-interactive MATLAB installs |
| 12 | - User needs to add products to an existing MATLAB installation using mpm |
| 13 | |
| 14 | ## When NOT to Use |
| 15 | |
| 16 | - User wants to install via the graphical MATLAB installer or MathWorks website |
| 17 | - User is asking about MATLAB licensing or activation (separate workflow) |
| 18 | - User wants to manage MATLAB Add-Ons from within MATLAB (use the Add-On Manager) |
| 19 | - User needs to install MATLAB Engine API for Python, Java, or C++ (different process) |
| 20 | |
| 21 | ## Non-Negotiable Determinism Contract (follow exactly) |
| 22 | - Follow the steps in **Protocol** in order. Do not add extra steps or checks. |
| 23 | - Use **only** the canonical shell for the OS. Do not switch shells. |
| 24 | - Use **absolute paths** to `mpm` / `mpm.exe`. Never rely on relative paths. |
| 25 | - Retry downloads at most **once**. Otherwise stop and report the error. |
| 26 | - If security software blocks execution: **stop** and instruct escalation. Do not bypass. |
| 27 | |
| 28 | ## Safety Gate (Windows) — MANDATORY, NO EXCEPTIONS |
| 29 | |
| 30 | **STOP. Read this entire section before executing ANY Windows step.** |
| 31 | |
| 32 | 1. **NEVER** use `powershell.exe -Command` for ANY reason. Bash mangles `$`, backticks, quotes, arrays, and script blocks before PowerShell sees them. This WILL cause `unexpected EOF` or syntax errors. |
| 33 | 2. **NEVER** use bash heredoc syntax (`cat > file <<'EOF'`) or bash redirection (`echo ... >`) to create PowerShell scripts. |
| 34 | 3. **ALWAYS** write `.ps1` files using the **Write file tool**, then invoke with: |
| 35 | `powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File <absolute-script-path>` |
| 36 | 4. Do not emit CMD-only syntax (`if not exist`, `set VAR=`, `%USERPROFILE%`). Use PowerShell equivalents (`Test-Path`, `$env:USERPROFILE`). |
| 37 | |
| 38 | 5. **ASCII only** in all `.ps1` file content. No em dashes (`—`), en dashes (`–`), curly quotes, or other non-ASCII characters. They cause PowerShell parse errors (broken string terminators, missing brace errors) when file encoding doesn't preserve them. |
| 39 | |
| 40 | **If you are about to type `powershell.exe -Command` — STOP. You are violating this rule. Use the Write file tool to create a .ps1 file instead.** |
| 41 | |
| 42 | Windows script authoring pattern: |
| 43 | - **WRONG**: `powershell.exe -Command "$script = @'...` (bash corrupts `$` and heredocs) |
| 44 | - **WRONG**: `cat > C:/Windows/Temp/script.ps1 <<'PS1' ... PS1` (bash heredoc, breaks on Windows) |
| 45 | - **CORRECT**: create a unique temp folder, use the **Write file tool** to write `.ps1` files into it, then run with `-File` |
| 46 | |
| 47 | Unique temp folder: |
| 48 | - Before Step 1, create a timestamped working folder using the Bash tool: |
| 49 | - Windows: `mkdir -p "C:/Users/<username>/AppData/Local/Temp/mpm-<YYYYMMDD-HHMMSS>"` |
| 50 | - Linux/macOS: `mkdir -p "/tmp/mpm-<YYYYMMDD-HHMMSS>"` |
| 51 | - Use this folder for ALL generated scripts and input files throughout the protocol |
| 52 | - Because the folder is new, the Write file tool can always create files in it without needing to delete anything first |
| 53 | - Delete the entire folder during the final cleanup step |
| 54 | |
| 55 | Windows PowerShell syntax reminders: |
| 56 | - Bad: `if not exist C:\Users\name\Downloads mkdir C:\Users\name\Downloads` (CMD syntax) |
| 57 | - Good: `if (-not (Test-Path -LiteralPath 'C:\Users\name\Downloads')) { New-Item -ItemType Directory -Path 'C:\Users\name\Downloads' | Out-Null }` |
| 58 | |
| 59 | Do not ask the user for the exact product name or identifier. Look it up using the appropriate mpm input file from https://www.mathworks.com/products/mpm.html |
| 60 | Do not ask the user whether to install dependencies or not. mpm will take care of it. Just install whatever the user asked for, and let mpm do the rest. |
| 61 | If a user types the shortname of MATLAB releases, automatically use the correct expanded full name. e.g. 25a is R2025a, 25b is R2025b |
| 62 | |
| 63 | ## Required Inputs (ask only if missing) |
| 64 | 1. Operating system (Windows, Linux, macOS) |
| 65 | 2. MATLAB release (for example `R2025b`) |
| 66 | 3. Installation destination (absolute path) |
| 67 | 4. Requested products / toolboxes / support packages |
| 68 | |
| 69 | ## Confirmation Rule |
| 70 | Before executing any steps, always confirm the user's choices: |
| 71 | - Release |
| 72 | - Destination folder |
| 73 | - Products |
| 74 | - Support packages |
| 75 | |
| 76 | Ask for confirmation in one message. The |