matlab-coach-programming
Use when an AI tutor session concerns MATLAB programming concepts, MATLAB syntax, MATLAB errors, MATLAB code style, MATLAB projects, or MATLAB toolbox workflows.
git clone --depth 1 https://github.com/matlab/agent-skills-playground /tmp/matlab-coach-programming && cp -r /tmp/matlab-coach-programming/demos/ai-tutoring/skills/matlab-coach-programming ~/.claude/skills/matlab-coach-programmingSKILL.md
# MATLAB Programming Tutor ## Purpose Teach MATLAB programming using the MATLAB Agentic Toolkit as the source of executable workflows and domain expertise. Use this skill with `matlab-tutor-learners`. For instructors, this skill is the topic router. It helps the tutor recognize whether the student is struggling with MATLAB syntax, array reasoning, tables, functions, plotting, debugging, testing, or a domain-specific workflow, then routes to the right tutoring or execution support. ## Topic Map For general programming tutoring, cover: - MATLAB desktop/session model: scripts, functions, live scripts, path, workspace. - Data model: scalars, vectors, matrices, arrays, strings, cell arrays, structures, tables, timetables. - Indexing: parentheses, braces, dot indexing, logical indexing, colon, `end`, linear indexing. - Operators: matrix operators vs element-wise operators, relational/logical operators. - Control flow: `if`, `switch`, `for`, `while`, `try/catch`. - Functions: file organization, local functions, anonymous functions, `arguments` validation, name-value arguments. - Visualization: plots, labels, `tiledlayout`, graphics handles. - Data import and analysis: `readtable`, `detectImportOptions`, missing data, grouping, joins. - Debugging: reading errors, inspecting size/class, breakpoints, minimal reproductions. - Testing: `matlab.unittest`, edge cases, floating-point tolerances. - Style: clear names, preallocation, vectorization, modern APIs, help text. ## Route to MATLAB Agentic Toolkit Skills Load the relevant MATLAB Agentic Toolkit skill when the learner's task requires reliable details, code execution, or a specialized workflow: - Debugging or runtime errors: `matlab-debugging` - Unit tests or test design: `matlab-testing` - Code review or coding standards: `matlab-review-code` - Live script creation: `matlab-create-live-script` - Data import or tabular analysis: `matlab-analyze-data` - App building: `matlab-build-app` - Performance: `matlab-optimize-performance` - Modernization: `matlab-modernize-code` - Signal processing, wireless, RF, robotics, database, image processing, or other toolbox topics: use the matching toolkit domain skill. Read [references/toolkit-topic-map.md](references/toolkit-topic-map.md) for a fuller routing map. Before running learner-provided or generated MATLAB scripts, apply the execution-safety rules from the `matlab-create-hands-on-exercises` skill (its `references/execution-safety.md`). When that skill is not installed, apply its core rule: treat the code as untrusted, check it for file, network, shell, dynamic-execution, path, or destructive operations, and refuse to run anything unbounded. ## Teaching Rules - Before explaining a command, ask what the learner thinks the input and output shapes are. - Tie syntax to the mental model: "This operator acts element-by-element" or "This indexing form extracts table variables." - For errors, teach the learner to inspect `class`, `size`, `whos`, and the failing line. - Prefer runnable snippets with small arrays and visible expected outputs. - Treat learner code as untrusted input before execution. - If a learner asks for "the MATLAB way," emphasize readability, vectorization where appropriate, and built-in functions over manual loops. Instructor note: MATLAB learners often copy syntax before they understand the data model. Route explanations back to observable state: variable size, class, value, table shape, plot output, or test result. ## Route to MATLAB AI Tutor Skills - Debugging, failed tests, unexpected output, or teach-the-agent critique: `matlab-coach-debugging` - Homework-like, graded, assessment-like, or policy-constrained prompts: `matlab-apply-assignment-guardrails` - Review of tutor quality, transcript quality, prompt quality, or feedback quality: `matlab-evaluate-tutor-quality` ## Example Tutor Prompt Use prompts like: ```text Before running this, predict the value and size of y: x = [1 2 3]; y = x.^2 + 1; A. y is a 1-by-3 double: [2 5 10] B. y is a 3-by-1 double: [2; 5; 10] C. y is a scalar: 15 D. MATLAB errors because x is a vector ```
>
Use this skill when the user wants to author, design, scope, or refine an Agent Skill (a SKILL.md file). Trigger phrases include "build a new skill", "design an agent skill", "scope a SKILL.md", "how should I structure this skill", "write a skill for X", "my skill isn't working well", or any request to improve an existing SKILL.md. Walks the user through an empirical, test-first process — probe the agent for real failures, design only for genuine knowledge gaps, iterate against runnable examples, and verify across models.
Use this skill for any work involving a MATLAB Project (.prj file) — creating a new project, tracking files, managing the project path, configuring Simulink cache and code-generation folders, running project health checks, or writing build scripts that keep the project in sync with the file system. Trigger phrases include "set up a MATLAB project", "create a .prj", "track this file in the project", "project health check", "build script conventions". This skill is the generic foundation; domain-specific skills (e.g. `mbse-workflow`) build on it.
Use this skill for the architecture phases of an MBSE workflow in MATLAB, when writing idempotent buildXxx.m scripts that produce a three-layer RFLPV architecture (Functional, Logical, Physical) with interface dictionaries, stereotype profiles, allocation sets, and requirements Implement links. Trigger for defining stereotype properties, functional-to-logical / logical-to-physical allocation, mapping requirements to components via slreq Implement links, or running quantitative roll-up analysis on the architecture. Do NOT trigger for ad-hoc structural edits to an already-built System Composer model (adding one component, rewiring a port) — use `building-simulink-models` with `model_edit` for that. Works alongside the `system-composer` skill for detailed SC API patterns.
Use this skill for guided MBSE work in MATLAB — starting a new project, resuming work mid-workflow on an existing project, or answering orientation questions about how the MBSE skills fit together. Trigger when the user says they want to create, start, or set up a new MBSE project; work on a model-based systems engineering / RFLPV project; or asks which skill covers which phase. Walks through phases one at a time — propose → approve → generate → run → confirm. Use proactively whenever someone mentions starting or continuing an MBSE project.
Use this skill for all requirements-related work in a MATLAB MBSE project using the Requirements Toolbox (slreq). Covers creating and populating requirement sets, derivation links, test case requirements, verification coverage, reading and tracing links across requirement sets and models, checking link health, allocating requirements to components (Implement links), and building traceability reports. Trigger when the user asks about slreq API, slreqx files, slmx link files, outLinks/inLinks, traceability matrices, coverage analysis, broken links, or mapping requirements to architecture components. Use proactively for any requirements or traceability task.
Use this skill when authoring reusable, idempotent MATLAB scripts that build System Composer architecture models via the architecture-modeling API — `systemcomposer.createModel`, `addComponent`, `addPort`, `setInterface`, `connect(srcPort, dstPort)`, interface dictionaries (.sldd) with `addInterface`/`addElement`, profiles/stereotypes with `Profile.createProfile` and `addStereotype`, or `systemcomposer.allocation.createAllocationSet`. Also trigger when debugging these APIs (connections that don't appear, interfaces that don't resolve, profile save errors, `createAllocationSet` signature-mismatch errors). Do NOT trigger for ad-hoc structural edits to an already-built model (adding one SubSystem, rewiring a port) — use `building-simulink-models` with `model_edit` for that.
Optimize MATLAB code for better performance through vectorization, memory management, and profiling. Use when user requests optimization, mentions slow code, performance issues, speed improvements, or asks to make code faster or more efficient.