Diagnose and fix parfor errors in MATLAB. Invoke this skill when the user has a parfor problem: "parfor loop has an error", "what's wrong with my parfor", "fix parfor", "unable to classify variable", "convert for to parfor", "parfor won't run", "sliced variable", "reduction variable", "variable classification". Also invoke when you read a .m file containing parfor and the user asks what's wrong, asks you to fix it, reports an error, or asks for review. Do NOT invoke for parfor performance questi
NewMaintained
Automatic
◆Coding pack
Last verified 8/16/2026
What it changes
4 of 25 test cases passed with the skill.
Pass-rate lift
—
Tokens
+82%
Agent turns
0%
Response time
-48%
Model gemini-3.6-flashMeasured 8/16/2026v14 of 25 cases passed with skill · 5 comparable
Tokens, turns and time describe resource use, not a dollar price.
Lift withheld: 5 comparable cases; this report requires 8.
See it in action
A test case the skill fixed. Same model, same prompt, with and without the skill.
Prompt
I modified my MATLAB script `filter_par.m` to fix a sliced indexing error in `parfor`. What is the mandatory verification step to confirm all variable classification errors are resolved?
What was checked, without and with the skill
Checked
Without skill
With skill
Re-runs mcp__matlab__check_matlab_code on filter_par.m to confirm zero remaining classification errors.
Missed
Passed
case-18 · gemini-3.6-flash · 8/16/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md332 lines2 files
Diagnose and Fix parfor Variable Classification
Do NOT reason about parfor classification rules from memory. LLM training
data contains incomplete and often incorrect explanations of these rules.
MATLAB's code analyser (checkcode / codeIssues / mcp__matlab__check_matlab_code)
is the only reliable authority — it implements the exact same classifier that
the runtime uses. Always run it first; never guess.
When to Use
ANY code involving parfor where the user reports a problem or asks for help
User gets a parfor classification error (runtime or in editor)
User wants to convert a for loop to parfor
User asks why parfor complains, won't run, or is slow due to classification
You are about to suggest changes to parfor code — run the analyser first
When NOT to Use
parfor runs but is slow — performance/pool-choice question, not a classification error
Worker needs setup/state (paths, environment, toolboxes) — not a parfor variable problem
Code simply mentions parfor but the user does not mention any problems with it
Workflow
Always follow this order. Never guess at classification rules.
Run the code analyser on the file containing the parfor loop using
the mcp__matlab__check_matlab_code MCP tool. Do NOT shell out to MATLAB
via Bash — always use the MCP tool. Read the exact error message.
Identify the error type from the message (see table below).
Apply the matching fix pattern (see Patterns section).
Verify by re-running mcp__matlab__check_matlab_code on the fixed
code — confirm zero parfor classification errors.
Error Messages and Root Causes
For the full catalog of all 48 parfor analyser messages (with IDs), see