A collection of slash commands for MATLAB development workflows in Claude Code. These commands provide access to MATLAB development capabilities including documentation generation, testing, optimization, and code analysis.
- Commands covering documentation, testing, quality, and development workflows
- Integrated with MATLAB Best Practices from matlab/prompts and matlab/skills repositories
- Templates for tests, documentation, and code optimization
- Optimizations leveraging vectorization and built-in functions
- Error Handling patterns and input validation
Once published to the Claude Code marketplace, you can install directly:
# Install from marketplace
/plugin install matlab-slash-commands# Install directly from GitHub
/plugin install github:matlab/slash-commands- Clone this repository:
git clone https://github.com/matlab/slash-commands.git- Navigate to the repository:
cd slash-commands-
The plugin is ready to use with the provided
.claude-plugin/directory -
For system-wide installation, copy the plugin files:
# Windows
xcopy /E /I .claude-plugin %APPDATA%\Claude\plugins\matlab-slash-commands
# macOS/Linux
cp -r .claude-plugin ~/.claude/plugins/matlab-slash-commands- Restart Claude Code or reload plugins using
/plugin reload
/matlab-readme
Analyzes your MATLAB project and generates a README.md with project structure, requirements, and usage examples.
/matlab-test myFunction
Generates a test class with unit tests, edge cases, and performance benchmarks for your MATLAB function.
/matlab-optimize
Analyzes selected code and applies MATLAB-specific optimizations including vectorization, preallocation, and efficient built-in usage.
| Command | Description | Example |
|---|---|---|
/matlab-readme |
Generate project README | /matlab-readme |
/matlab-docs |
Document MATLAB function with help text | /matlab-docs functionName |
/matlab-livescript |
Create formatted Live Script | /matlab-livescript "Signal Processing Demo" |
| Command | Description | Example |
|---|---|---|
/matlab-test |
Generate unit tests for functions | /matlab-test calculateMetrics |
/matlab-property-test |
Create property-based tests | /matlab-property-test matrixOperation |
/matlab-optimize |
Optimize code performance | /matlab-optimize |
/matlab-errors |
Add error handling and validation | /matlab-errors |
| Command | Description | Example |
|---|---|---|
/matlab-explain |
Explain code functionality and algorithms | /matlab-explain |
/matlab-refine |
Refine prompts into detailed specifications | /matlab-refine "process sensor data" |
Scans your project directory and creates a README with:
- Project overview and features
- Installation instructions
- Usage examples with code
- API documentation
- Testing instructions
- License information
Generates MATLAB help text following MathWorks standards:
- H1 line and detailed description
- Input/output specifications
- Usage examples
- Error conditions
- See also references
Creates test classes using MATLAB Unit Testing Framework:
- Setup and teardown methods
- Parameterized tests
- Performance benchmarks
- Edge case validation
- Mock object suggestions
Applies MATLAB-specific optimizations:
- Vectorization of loops
- Preallocation strategies
- Built-in function usage
- Memory optimization
- Parallel computing suggestions
Adds error handling:
- Input validation with arguments blocks
- Try-catch patterns
- Custom error messages
- Warning management
- Resource cleanup
% 1. Start with requirements refinement
/matlab-refine "Create function to analyze time series data"
% 2. Implement the function based on refined specs
function results = analyzeTimeSeries(data, options)
% Implementation here
end
% 3. Add documentation
/matlab-docs analyzeTimeSeries
% 4. Optimize for performance
/matlab-optimize
% 5. Add error handling
/matlab-errors
% 6. Generate unit tests
/matlab-test analyzeTimeSeries
% 7. Create project documentation
/matlab-readme% 1. Define requirements
/matlab-refine "Statistical analysis function"
% 2. Generate tests first
/matlab-test statisticalAnalysis
/matlab-property-test statisticalAnalysis
% 3. Implement to pass tests
% ... write code ...
% 4. Optimize and document
/matlab-optimize
/matlab-docs statisticalAnalysisThese commands integrate seamlessly with:
- MATLAB Editor: Copy generated code directly
- Live Editor: Create formatted Live Scripts
- Testing Framework: Compatible with
runtestscommand - Code Analyzer: Follows mlint guidelines
- Doc Generation: Works with
publishandhelp
- Start with
/matlab-refineto clarify requirements - Use
/matlab-testearly for test-driven development - Apply
/matlab-optimizeafter functionality is complete - Always add
/matlab-errorsfor production code - Document with
/matlab-docsfor team collaboration
- Claude Code CLI
- MATLAB development environment (for running generated code)
- Optional: MATLAB toolboxes for specific functionality
We welcome contributions! See CONTRIBUTING.md for guidelines on:
- Adding new commands
- Improving existing commands
- Reporting issues
- Suggesting enhancements
- Use the template in
templates/command-template.md - Follow the established command structure
- Add comprehensive examples
- Update plugin.json
- Submit a pull request
BSD 3-Clause License - see LICENSE file.
Copyright (c) 2025, The MathWorks, Inc.
- matlab/prompts - Collection of MATLAB prompts for AI assistants
- matlab/skills - Claude Code skills for MATLAB
- Issues: GitHub Issues
- Discussions: MATLAB Central
- Documentation: Command Reference