matlab-validate-function-arguments
Use when writing MATLAB functions with arguments blocks — repeating arguments (arguments (Repeating)), .?ClassName property import in constructors, name-value forwarding with namedargs2cell, or migrating from inputParser or validateattributes. Also when reviewing signatures for implicit-conversion pitfalls (size reshaping, class coercion, computed defaults), or when restricting, constraining, or validating function inputs — scalar vs vector enforcement, type rejection, size checking. Also when asked to harden inputs, make a function more robust, tighten input checking, or rewrite for safer inp
npx skills add matlab/matlab-agentic-toolkit --skill matlab-validate-function-arguments --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Instructs the agent to help write MATLAB functions with arguments blocks, covering size/class validators, repeating arguments, and importing class properties as name-value arguments. It also addresses migrating from inputParser or validateattributes, and choosing validators vs class specs for input restrictions. It highlights patterns like name-value forwarding with namedargs2cell and using .?ClassName in constructors.
How it works
The skill outlines concrete MATLAB patterns and rules:
- Use arguments blocks for size, class, and validators; support repeating arguments via (Repeating); import properties with .?ClassName; and forward name-value args using namedargs2cell.
- Provide guidance for migrating from inputParser or validateattributes and for deciding between mustBe validators and class specs.
- Offer examples showing how to enforce scalar vs vector, reject or accept types, and handle defaults and computed values.
- Include cautions on computed defaults, size reshaping behavior, and how different validators behave (e.g., mustBeA, mustBeFloat, mustBeNumeric).
- Present rules for composing multiple arguments blocks and for maximal function signatures with combinations of required, optional, repeating, and name-value arguments.
When to use it
Use when writing MATLAB functions with an arguments block, especially with repeating arguments, constructors accepting name-value args, or when migrating from inputParser or validateattributes. Also applicable for reviewing signatures for implicit conversion pitfalls or when hardening inputs and tightening input checking.
What it can touch
The skill references tools: "claude-code", "codex", "copilot". It describes using MATLAB constructs such as "arguments", "arguments (Repeating)", ".?ClassName", and "namedargs2cell". It also discusses validators like mustBeA, mustBeFloat, mustBeNumeric, mustBeReal, and mustBePositive. It notes patterns for importing class properties and forwarding name-value arguments.
Caveats
License is the provided URL; no explicit runtime guarantees are stated beyond guidance and examples. It cautions about certain MATLAB behaviors (size specs RESHAPE, not reject) and notes limitations around certain file types and migration decisions.
# MATLAB Function Argument Validation Write robust MATLAB functions using `arguments` blocks with correct semantics for size, class, repeating arguments, and property import. ## When to Use - Writing a function with an `arguments` block - Using repeating arguments (`arguments (Repeating)`) - Writing a class constructor that accepts name-value arguments - Migrating from `inputParser` or `validateattributes` - Reviewing a function signature for implicit conversion pitfalls - Choosing between class specs, `mustBeA`, and validators ## When NOT to Use - Basic MATLAB programming without argument validation - App building or UI components (use `matlab-building-apps`) - Unit testing (use `matlab-testing`) - General OOP class design unrelated to argument validation - Simple `if`/`error` guard clauses for runtime invariants inside a function body (those aren't input validation — leave them as-is unless the user asks for an `arguments` block specifically) - **`.mlx` (Live Script) or `.mlapp` (App Designer) files** — these are binary ZIP containers. Don't unzip them or attempt structural edits. If the user asks to add an `arguments` block to a function inside one, ask them to export to plain `
- When to Use
- When NOT to Use
- Critical Misconceptions
- Size specs RESHAPE, not reject
- Class specs CONVERT, not reject
- Numeric validators don't reject complex values
- Computed defaults see PASSED values, not declared defaults
- ~ is a valid placeholder — don't rename it
- Patterns
- Repeating Arguments
- Output Argument Validation — arguments (Output) and (Output, Repeating)
- Composition Rules — What Can Coexist
- .?ClassName — Import Properties as Name-Value Args
- namedargs2cell — Forward Name-Value Args
What does the matlab-validate-function-arguments skill do?
Use when writing MATLAB functions with arguments blocks — repeating arguments (arguments (Repeating)), .?ClassName property import in constructors, name-value forwarding with namedargs2cell, or migrating from inputParser or validateattributes. Also when reviewing signatures for implicit-conversion pitfalls (size reshaping, class coercion, computed defaults), or when restricting, constraining, or validating function inputs — scalar vs vector enforcement, type rejection, size checking. Also when asked to harden inputs, make a function more robust, tighten input checking, or rewrite for safer inp
How do I install it?
Run `npx skills add matlab/matlab-agentic-toolkit --skill matlab-validate-function-arguments --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From matlab/matlab-agentic-toolkit, a repository with 868 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
