Back to Skills

matlab-live-script

verified

Create MATLAB plain text Live Scripts (.m files) following specific formatting rules. Use when generating MATLAB scripts, educational MATLAB content, Live Scripts, or when the user requests .m files with rich text formatting.

View on GitHub

Marketplace

matlab-skills

matlab/skills

Plugin

matlab-skills

Repository

matlab/skills
22stars

skills/matlab-live-script/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/matlab/skills/blob/main/skills/matlab-live-script/SKILL.md -a claude-code --skill matlab-live-script

Installation paths:

Claude
.claude/skills/matlab-live-script/
Powered by add-skill CLI

Instructions

# MATLAB Plain Text Live Script Generator

This skill provides comprehensive guidelines for creating properly formatted MATLAB plain text Live Scripts. These scripts combine executable MATLAB code with rich text documentation in a single .m file.

## When to Use This Skill

- Creating new MATLAB Live Scripts in plain text format
- Generating educational MATLAB content with explanations
- When the user requests .m files with documentation
- Converting code examples into Live Script format
- Creating tutorial or example scripts

## Critical Rules

### File Format
- **ALWAYS** use the .m suffix for plain text Live Scripts
- **NEVER** create .mlx scripts (binary format)
- **MUST** close every script with the required appendix

### Required Appendix
Every Live Script must end with this exact formatting:

```matlab
%[appendix]{"version":"1.0"}
%---
%[metadata:view]
%   data: {"layout":"inline"}
%---
```

### Reading Live Scripts (Token Optimization)
When reading a Live Script file to pass back to the language model, you can save significant token count by ignoring everything below the appendix marker (which begins with `%[appendix]`). This optimization avoids passing large embedded images that are stored in the appendix section. All working code and text content appears before the appendix, so no functional information is lost.

## Formatting Rules

### Section Headers
**CORRECT format:**
```matlab
%%
%[text] ## Section Title
```

**INCORRECT format (DO NOT USE):**
```matlab
%% Section Title
```

### Rich Text
- Normal text uses `%[text]` prefix
- Text intended for a single paragraph should appear on a single line
- Use Markdown formatting after `%[text]`
- **DO NOT** leave blank lines in the file

### Bulleted Lists
Bulleted lists must have a backslash on the last item:

```matlab
%[text] - bullet 1
%[text] - bullet 2
%[text] - bullet 3 \
```


### Tables

```matlab
%[text:table]
%[text] | Column A | Column B |
%[text] | --- | --- |
%[text] | Value 1 | Value 2 |
%[text] 

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
5479 chars