Install
git clone https://github.com/matlab/rulesInstall command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →MATLAB AI Coding Rules
MATLAB coding rules and guidelines for AI coding assistants like Cursor, Windsurf, Claude Code, and GitHub Copilot.
Overview
Rule files for AI coding assistants to generate MATLAB code that follows coding standards.
Available Rules
matlab-coding-standards.md
Comprehensive MATLAB coding standards covering:
- Naming conventions for variables, functions, classes, and properties
- Statement and expression guidelines
- Formatting rules and whitespace conventions
- Function and class authoring best practices
- Error handling patterns
Use this rule when: Writing or reviewing any MATLAB code for standards compliance
live-script-generation.md
Guidelines for generating MATLAB Live Scripts in plain text .m format:
- Plain text Live Script formatting rules
- Section structure and documentation
- Mathematical notation and LaTeX support
- Visualization best practices
- Version control compatibility
Use this rule when: Creating MATLAB Live Scripts that need to be version-controlled or AI-generated
matlab-performance-optimization.md
Performance optimization guidelines for MATLAB development:
- Profiling and benchmarking techniques
- Vectorization and implicit expansion
- Memory management and pre-allocation
- Parallel computing with parfor and parfeval
- App Designer performance optimization
- JIT compiler optimization patterns
- File I/O performance strategies
Use this rule when: Writing performance-critical MATLAB code, optimizing existing code, or building responsive applications
Quick Start
Choose your AI coding tool and follow the appropriate setup instructions:
Cursor
Option 1: Project Rules (Recommended)
- Create a
.cursor/rulesdirectory in your project - Copy the rule files you want to use:
mkdir .cursor/rules cp matlab-coding-standards.md .cursor/rules/ cp live-script-generation.md .cursor/rules/ cp matlab-performance-optimization.md .cursor/rules/ - Cursor will automatically load these rules for your project
Option 2: Reference with @
In your Cursor chat, reference rules directly:
@matlab-coding-standards.md Write a function to calculate eigenvalues
Option 3: Global Rules
Add to Cursor Settings > General > Rules for AI:
When writing MATLAB code, follow the standards at @matlab-coding-standards.md
Windsurf
Option 1: Workspace Rules
- Create a
.windsurf/rulesdirectory in your workspace - Copy the rule files:
mkdir .windsurf/rules cp matlab-coding-standards.md .windsurf/rules/ cp live-script-generation.md .windsurf/rules/ cp matlab-performance-optimization.md .windsurf/rules/ - Windsurf will automatically apply these rules to your workspace
Option 2: Global Rules
Add to your global_rules.md:
# MATLAB Development
When working with MATLAB code:
1. Follow naming conventions: lowerCamelCase for functions, UpperCamelCase for classes
2. Use arguments blocks for input validation
3. Limit function inputs to 6 or fewer
4. Use spaces (4 per indent), not tabs
5. Keep lines <= 120 characters
For complete standards, reference: [path/to/matlab-coding-standards.md]
Claude Code
Option 1: Project CLAUDE.md (Recommended)
Create a CLAUDE.md file in your project root:
# MATLAB Project Rules
Similar plugs
Multi-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, Google Antigravity, and Pi
The Developer Tool for Visual Engineers • An Open-Source AI-First Design tool • Visually build, style, and edit your code with AI • World's best, top-most agent recommended #1…
A powerful GUI app and Toolkit for Claude Code - Create custom agents, manage interactive Claude Code sessions, run secure background agents, and more.