MATLAB Slash Commands is a set of slash commands for MATLAB development in AI coding agents. The commands write help text, tests, Live Scripts, and READMEs. They review, speed up, and explain code. Each command follows the matching skill in the MATLAB Agentic Toolkit. With the MATLAB MCP Server connected, the commands also run the code they write and check the results in MATLAB.
| Agent | Format | Commands |
|---|---|---|
| Claude Code | Plugin | All 13 |
| GitHub Copilot | .prompt.md files |
6: check, docs, optimize, readme, run, test |
| Cursor | .mdc rule |
One rule that applies to .m, .mlx, and .mlapp files |
/plugin marketplace add matlab/slash-commands
/plugin install matlab-slash-commands@matlab-slash-commandsTo try changes to the commands without installing, clone the repository and start Claude Code with claude --plugin-dir ./slash-commands.
From a clone of this repository, copy the prompt files into your project:
mkdir -p /path/to/project/.github/prompts
cp copilot/prompts/*.prompt.md /path/to/project/.github/prompts/From a clone of this repository, copy the rule into your project:
mkdir -p /path/to/project/.cursor/rules
cp cursor/rules/matlab-development.mdc /path/to/project/.cursor/rules/See the Installation Guide for updating, uninstalling, and troubleshooting.
| Command | What it does | With the MATLAB MCP Server, it also |
|---|---|---|
/matlab-readme |
Writes a README for a MATLAB project | Confirms the required products and runs the examples |
/matlab-docs |
Writes help text for a function | Runs help and the example |
/matlab-livescript |
Writes a plain-text Live Script | Checks the release and toolboxes, and runs the script |
/matlab-check |
Reviews code for errors, style, and outdated functions | Runs the Code Analyzer |
/matlab-run |
Runs a MATLAB file or expression | Requires the server to run code |
/matlab-test |
Writes class-based unit tests | Runs the new tests |
/matlab-property-test |
Writes tests for properties that must hold for any input | Runs the new tests |
/matlab-run-tests |
Runs a test suite and reports results and coverage | Requires the server to run tests |
/matlab-optimize |
Speeds up code and checks that the results do not change | Profiles the code and times it before and after |
/matlab-errors |
Adds arguments blocks and error identifiers |
Runs bad inputs to confirm each error |
/matlab-explain |
Explains what code does and how | Runs sections to confirm behavior |
/matlab-refine |
Turns a request into a MATLAB specification | Confirms the release and installed toolboxes |
/matlab-toolboxes |
Lists installed MathWorks products | Lists the products of the running MATLAB |
Without the server, /matlab-run and /matlab-run-tests check the code and give you the MATLAB commands to run.
The other commands write their output and tell you what to run in MATLAB to confirm it.
The MCP Integration Guide covers server setup and the server tools the commands use.
Take a request from specification to a tested, documented function.
You write processData from the specification after the first command.
/matlab-refine process sensor data
/matlab-test processData
/matlab-check processData.m
/matlab-optimize processData.m
/matlab-errors processData.m
/matlab-docs processData
/matlab-readme
- Command Reference: all 13 commands
- MCP Integration Guide: setup and use with the MATLAB MCP Server
- Cross-Agent Support: Copilot and Cursor formats
- Usage Guide: development patterns
- Installation Guide: setup for each agent
- Examples: complete workflows
- Claude Code, GitHub Copilot, or Cursor
- MATLAB, to run the code the commands write
- Optional: the MATLAB MCP Server, which requires MATLAB R2021a or later
- Live Scripts from
/matlab-livescriptrequire MATLAB R2025a or later
See CONTRIBUTING.md for how to add commands, change existing ones, and keep the Copilot and Cursor versions in step.
BSD 3-Clause License. See LICENSE.
Copyright (c) 2025, The MathWorks, Inc.
- matlab/matlab-agentic-toolkit: MATLAB skills and tools for AI agents
- matlab/matlab-mcp-server: the MATLAB MCP Server
- matlab/prompts: MATLAB prompts for AI coding assistants
- matlab/agent-skills-playground: prototype Agent Skills for MATLAB and Simulink, formerly
matlab/skills