Matlab Review Code logo

Matlab Review Code

OrganizationPopular
matlab
matlab-review-code

Review MATLAB code for quality, performance, maintainability, and adherence to MathWorks coding standards. Uses check_matlab_code and matlab_coding_guidelines. Use when reviewing code, checking style, finding code smells, assessing quality, or preparing code for handoff or publication.

Overview

Publishermatlab
Repositorymatlab-agentic-toolkit
Skill namematlab-review-code
Stars
1.2K
Forks
138
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by matlab on GitHub. Read the source before you install it.

Installation

Install the Matlab Review Code AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/matlab-core/matlab-review-code
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matlab/matlab-agentic-toolkit.git /tmp/matlab-agentic-toolkit
mkdir -p .claude/skills
cp -r /tmp/matlab-agentic-toolkit/skills-catalog/matlab-core/matlab-review-code .claude/skills/matlab-review-code
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Matlab Review Code in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Matlab Review Code on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Matlab Review Code is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Code Review

Systematically review MATLAB code for quality, correctness, performance, and adherence to MathWorks coding conventions using static analysis and manual inspection patterns.

When to Use

  • User asks to review, audit, or improve code quality
  • User wants to check adherence to MathWorks coding standards
  • Preparing code for handoff, publication, or open-source release
  • After a significant implementation — verify before committing
  • User reports "code smells" or asks for cleanup suggestions

When NOT to Use

  • User wants to debug a runtime error — use matlab-debug-code instead
  • User wants to optimize performance — use performance profiling skills
  • User wants to generate tests — use matlab-write-tests instead

Workflow

  1. Run static analysis — Use check_matlab_code MCP tool on all target files
  2. Load coding standards — Read the matlab_coding_guidelines MCP resource
  3. Check naming — Verify functions, classes, variables, and files follow conventions
  4. Review function signatures — Arguments blocks, input/output counts, name-value patterns
  5. Assess structure — Function length, nesting depth, complexity
  6. Check patterns — Vectorization, preallocation, modern API usage
  7. Summarize — Report findings by severity: errors > warnings > suggestions

Step 1: Static Analysis

Use the check_matlab_code MCP tool on each file. Then inspect results programmatically:

matlab
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+):

matlab
issues = codeIssues("src");
disp(issues.Issues);

Step 2: Load Coding Standards

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.

Review Checklist

Naming

ElementConventionExample
FunctionslowerCamelCase, verb phrasecomputeArea, loadData
ClassesPascalCaseSensorReader, DataProcessor
VariableslowerCamelCase, descriptivesampleRate not sr
ConstantsUPPER_SNAKE or Constant propertyMAX_ITERATIONS
Test filest prefixtComputeArea.m
App filesPascalCaseDashboardApp.m
File = functionFile name matches primary functioncomputeArea.m → function computeArea

Function Quality

CheckStandardSeverity
Input countMax 6 positional inputsWarning
Output countMax 4 outputsWarning
Validationarguments block presentWarning
Name-value argsoptions.Name pattern (not varargin)Suggestion
LengthFlag if >50 linesSuggestion
NestingFlag if >3 levels deepWarning
end keywordAll functions terminated with endWarning
Help textH1 line present for public functionsSuggestion

Code Patterns

CheckModernLegacy (flag it)
Multi-panel figurestiledlayout/nexttilesubplot
Date/timedatetimedatenum/datestr
Stringsstring typechar arrays for text
Vectorization.*, ./, logical indexingLoops over elements
Preallocationzeros(n,1) before loopGrowing arrays in loops
Data containerstable/timetableRaw matrices for named data
Dynamic evalDirect function callseval, evalin, assignin

High-Severity Flags

These should always be reported as errors:

  • Use of eval, assignin, or evalin — security and maintainability risk
  • Growing arrays inside loops without preallocation — performance
  • Shadowing built-in functions — sum = 5 shadows sum()
  • Missing arguments block in public-facing functions
  • Hardcoded file paths with backslashes

What checkcode Misses

check_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/nexttile
  • Shadowed builtin variables — sum = 0 shadows sum(), checkcode may not flag it
  • Deep nesting (>3 levels) — checkcode does not measure nesting depth
  • Hardcoded backslash paths — checkcode flags unused variables but not path style
  • Magic numbers — unlabeled constants in code (e.g., if length(x) > 10)
  • Missing H1 help text — checkcode does not require help text

Do not skip Steps 3-6 of the workflow just because checkcode returns few results.

Patterns

Complexity Assessment

matlab
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

Check Toolbox Dependencies

matlab
[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

Review Report Format

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

Conventions

  • Always run check_matlab_code as the first step — it catches issues automatically
  • Load matlab_coding_guidelines for the authoritative standard
  • Report findings by severity: errors (must fix) > warnings (should fix) > suggestions (nice to have)
  • Flag any use of eval, assignin, or evalin as high-severity
  • Check requiredFilesAndProducts to verify toolbox dependencies are documented
  • Verify every public function has an H1 help text line
  • Use codeIssues for directory-wide analysis (R2022b+)
  • Do not suggest changes that alter behavior — review is read-only assessment
  • For deprecated API migration details, use the matlab-modernize-code skill

Copyright 2026 The MathWorks, Inc.


Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Matlab Review Code AI skill do?

Review MATLAB code for quality, performance, maintainability, and adherence to MathWorks coding standards. Uses check_matlab_code and matlab_coding_guidelines. Use when reviewing code, checking style, finding code smells, assessing quality, or preparing code for handoff or publication.

Why use Matlab Review Code on TypingMind?

Because you install it once and use it with any model. Matlab Review Code is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Matlab Review Code in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/matlab-core/matlab-review-code. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Matlab Review Code?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Matlab Review Code?

As many as you like. As long as a model supports skills, you can use Matlab Review Code with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Matlab Review Code AI skill free?

It is published on GitHub by matlab. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇