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.
Creates MATLAB Live Scripts (.m files) with proper rich text formatting for educational content and documentation. Use when generating MATLAB scripts with explanations, tutorials, or when users request .m files with formatted text.
/plugin marketplace add matlab/skills/plugin install matlab-matlab-skills@matlab/skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
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.
Every Live Script must end with this exact formatting:
%[appendix]{"version":"1.0"}
%---
%[metadata:view]
% data: {"layout":"inline"}
%---
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.
CORRECT format:
%%
%[text] ## Section Title
INCORRECT format (DO NOT USE):
%% Section Title
%[text] prefix%[text]Bulleted lists must have a backslash on the last item:
%[text] - bullet 1
%[text] - bullet 2
%[text] - bullet 3 \
%[text:table]
%[text] | Column A | Column B |
%[text] | --- | --- |
%[text] | Value 1 | Value 2 |
%[text] | Value 3 | Value 4 |
%[text:table]
Format equations with double backslashes:
%[text] $ e = \\sum_{\\alpha=0}^\\infty \\alpha^n/n! $
Note: All backslashes in LaTeX must be doubled.
DO NOT use fprintf for reader comments:
fprintf('This is a comment') % WRONG
Instead use rich text:
%[text] This is a comment % CORRECT
figure command to create new figuresclose all or clear commands%[text] # Sinusoidal Signals
%[text] Examples of sinusoidal signal in MATLAB.
%[text] - sine waves
%[text] - cosine waves \
x = linspace(0,8*pi);
%%
%[text] ## Sine Wave
plot(x,sin(x))
title('Sine Wave')
xlabel('x (radians)')
ylabel('sin(x)')
grid on
%%
%[text] ## Cosine Wave
plot(x,cos(x))
title('Cosine Wave')
xlabel('x (radians)')
ylabel('cos(x)')
grid on
%[text]
%[appendix]{"version":"1.0"}
%---
%[metadata:view]
% data: {"layout":"inline"}
%---
A typical Live Script follows this pattern:
Title and Introduction
%[text] # Main Title
%[text] Brief description of what this script does.
Setup Code (if needed)
variable = value;
data = load('file.mat');
Sections with Explanations
%%
%[text] ## Section Name
%[text] Explanation of what this section does.
code_goes_here();
plot(results)
Required Appendix
%[appendix]{"version":"1.0"}
%---
%[metadata:view]
% data: {"layout":"inline"}
%---
%[text] ## Theory
%[text] The discrete Fourier transform is defined as:
%[text] $ X(k) = \\sum_{n=0}^{N-1} x(n)e^{-j2\\pi kn/N} $
%%
%[text] ## Data Processing
%[text] First, we load and filter the data.
data = load('measurements.mat');
filtered = lowpass(data, 0.5); % Apply lowpass filter
%[text] Then we visualize the results.
plot(filtered)
title('Filtered Data')
Only when necessary for comparison:
%%
%[text] ## Comparison of Methods
tiledlayout(1,2)
nexttile
plot(method1)
title('Method 1')
nexttile
plot(method2)
title('Method 2')
Before finishing a Live Script, verify:
%% followed by %[text] ##figure commandsclose all or clear at startfprintf for comments (use %[text] instead)Issue: Script doesn't display rich text properly
%[text] is at the start of each text lineIssue: Equations not rendering
Issue: Sections not appearing correctly
%% on its own line, then %[text] ## on the next lineIssue: Script won't save with outputs
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.