Reviews MATLAB code for quality, performance, and MathWorks coding standards using static analysis and manual inspection patterns.
Ships in matlab-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Systematically review MATLAB code for quality, correctness, performance, and adherence to MathWorks coding conventions using static analysis and manual inspection patterns.
matlab-debug-code insteadmatlab-write-tests insteadcheck_matlab_code MCP tool on all target filesmatlab_coding_guidelines MCP resourceUse the check_matlab_code MCP tool on each file. Then inspect results programmatically:
info = checkcode("src/computeArea.m", "-struct");
for k = 1:numel(info)
fprintf('Line %d (col %d-%d): %s\n', ...
info(k).line, info(k).column(1), info(k).column(end), info(k).message);
end
For directory-wide analysis (R2022b+):
issues = codeIssues("src");
disp(issues.Issues);
Read the matlab_coding_guidelines MCP resource to get the authoritative MathWorks coding standards. Use these as the baseline for all naming, formatting, and structural checks.
| Element | Convention | Example |
|---|---|---|
| Functions | lowerCamelCase, verb phrase | computeArea, loadData |
| Classes | PascalCase | SensorReader, DataProcessor |
| Variables | lowerCamelCase, descriptive | sampleRate not sr |
| Constants | UPPER_SNAKE or Constant property | MAX_ITERATIONS |
| Test files | t prefix | tComputeArea.m |
| App files | PascalCase | DashboardApp.m |
| File = function | File name matches primary function | computeArea.m → function computeArea |
| Check | Standard | Severity |
|---|---|---|
| Input count | Max 6 positional inputs | Warning |
| Output count | Max 4 outputs | Warning |
| Validation | arguments block present | Warning |
| Name-value args | options.Name pattern (not varargin) | Suggestion |
| Length | Flag if >50 lines | Suggestion |
| Nesting | Flag if >3 levels deep | Warning |
end keyword | All functions terminated with end | Warning |
| Help text | H1 line present for public functions | Suggestion |
| Check | Modern | Legacy (flag it) |
|---|---|---|
| Multi-panel figures | tiledlayout/nexttile | subplot |
| Date/time | datetime | datenum/datestr |
| Strings | string type | char arrays for text |
| Vectorization | .*, ./, logical indexing | Loops over elements |
| Preallocation | zeros(n,1) before loop | Growing arrays in loops |
| Data containers | table/timetable | Raw matrices for named data |
| Dynamic eval | Direct function calls | eval, evalin, assignin |
These should always be reported as errors:
eval, assignin, or evalin — security and maintainability risksum = 5 shadows sum()arguments block in public-facing functionscheck_matlab_code does NOT catch all issues. After running static analysis, always scan the source code for these common problems that require visual inspection:
subplot usage — not flagged by checkcode, but should use tiledlayout/nexttilesum = 0 shadows sum(), checkcode may not flag itif length(x) > 10)Do not skip Steps 3-6 of the workflow just because checkcode returns few results.
function complexity = assessComplexity(filePath)
%assessComplexity Estimate cyclomatic complexity of a MATLAB function.
arguments
filePath (1,1) string {mustBeFile}
end
code = fileread(filePath);
branchKeywords = ["if " "elseif " "case " "while " "for " "catch "];
complexity = 1;
for kw = branchKeywords
complexity = complexity + numel(strfind(code, kw));
end
end
[files, products] = matlab.codetools.requiredFilesAndProducts('src/myFunction.m');
fprintf('Required products:\n');
for k = 1:numel(products)
fprintf(' %s (ID: %d)\n', products(k).Name, products(k).ProductNumber);
end
Present findings in this format:
## Code Review: computeArea.m
### Static Analysis (checkcode)
- 2 warnings, 0 errors
### Naming ✓
- [x] Function: lowerCamelCase
- [x] Variables: descriptive
- [x] File name matches function
### Structure
- [x] arguments block present
- [x] Function under 50 lines
- [ ] ⚠ Nesting depth reaches 4 levels (line 32)
### Patterns
- [x] Vectorized
- [x] Modern graphics API
- [ ] ⚠ Uses datenum (line 18) — migrate to datetime
### Suggestions
1. Extract nested logic at line 32 into a local function
2. Replace datenum with datetime for date handling
check_matlab_code as the first step — it catches issues automaticallymatlab_coding_guidelines for the authoritative standardeval, assignin, or evalin as high-severityrequiredFilesAndProducts to verify toolbox dependencies are documentedcodeIssues for directory-wide analysis (R2022b+)matlab-modernize-code skillCopyright 2026 The MathWorks, Inc.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/matlab-core:matlab-review-codefrom matlab-core
npx claudepluginhub matlab/matlab-agentic-toolkit --plugin matlab-core6 skills in this plugin
/matlab-create-live-scriptCreate, edit, and run plain-text MATLAB live scripts (.m files) with rich text formatting, LaTeX equations, section breaks, and inline figures. Use when generating tutorials, analysis notebooks, reports, documentation, or educational content, when modifying existing live scripts, or when converting existing binary .mlx files to .m for version control. Requires R2025a+./matlab-debug-codeDiagnose MATLAB errors and unexpected behavior. Breakpoints, workspace inspection, try-catch diagnostics, and common error patterns. Use when debugging functions, tracing errors, inspecting variables, or diagnosing runtime failures./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 installations for CI/CD, containers, or fleet provisioning./matlab-list-productsShow all installed MATLAB products and support packages for a given MATLAB installation folder. Use when listing, checking, or verifying what products or support packages are in a MATLAB installation./matlab-read-documentationGuides the agent to reference official MathWorks Documentation and Help. Determine correct function syntax and workflows from user guides when deeper context is needed. Minimize iterations and repetitive trial and error. Use this skill to: Identify correct syntax and configuration details. Retrieve relevant, version-specific (or release-specific) information from official documentation. Consult user guides when conceptual or workflow context is needed. Apply best practices.Other plugins' skills for the same job