56 results available
Sign in
Skills directory

matlab-live-script

matlab

·

Last changed
Hardened

This skill has been hardened by Chainguard

Last changed

This version passed the hardening gate. Hardening applied 2 targeted changes and preserved all other text. Classified findings before hardening: 1. Classified findings closed: 0. Classified findings remaining: 1. Unclassified scanner findings remaining: 0. Review findings closed: 4. Review findings remaining: 6.


Open before hardening

1

Low
Open after hardening

1

Low

Expand
File
Group
Subtype
Severity
Status
LICENSE

Excessive Agency & Rogue Autonomy

—

Low
Open

1 finding


SKILL.md

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:

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

Formatting Rules

Section Headers

CORRECT format:

%%
%[text] ## Section Title

INCORRECT format (DO NOT USE):

%% 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:

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

Tables

%[text:table]
%[text] | Column A | Column B |
%[text] | --- | --- |
%[text] | Value 1 | Value 2 |
%[text] | Value 3 | Value 4 |
%[text:table]

LaTeX Equations

Format equations with double backslashes:

%[text] $ e = \\sum_{\\alpha=0}^\\infty \\alpha^n/n! $

Note: All backslashes in LaTeX must be doubled.

Comments for Readers

DO NOT use fprintf for reader comments:

fprintf('This is a comment')  % WRONG

Instead use rich text:

%[text] This is a comment

Code Guidelines

Figures and Plots

  • Use implicit figure creation (just call plot, histogram, etc.)
  • DO NOT use the figure command to create new figures
  • Put no more than one plot per section (unless using tiled layouts)
  • Only use tiled plots when especially important to the illustration

Script Initialization

  • DO NOT start scripts with close all or clear commands
  • Let MATLAB handle workspace management

Complete Example

%[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"}
%---

Structure Pattern

A typical Live Script follows this pattern:

  1. Title and Introduction

    %[text] # Main Title
    %[text] Brief description of what this script does.
  2. Setup Code (if needed)

    variable = value;
    data = load('file.mat');
  3. Sections with Explanations

    %%
    %[text] ## Section Name
    %[text] Explanation of what this section does.
    code_goes_here();
    plot(results)
  4. Required Appendix

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

Common Patterns

Mathematical Explanations with Equations

%[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} $

Code with Inline Comments

%%
%[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')

Checklist

Before finishing a Live Script, verify:

  • File has .m extension
  • Sections use %% followed by %[text] ##
  • No blank lines in the file
  • Bulleted lists end with backslash
  • LaTeX uses double backslashes
  • No figure commands
  • No close all or clear at start
  • Appendix is present and correctly formatted
  • No fprintf for comments (use %[text] instead)

Troubleshooting

Issue: Script doesn't display rich text properly

  • Solution: Ensure %[text] is at the start of each text line

Issue: Equations not rendering

  • Solution: Check that all backslashes are doubled in LaTeX

Issue: Sections not appearing correctly

  • Solution: Use %% on its own line, then %[text] ## on the next line

Issue: Script won't save with outputs

  • Solution: Verify appendix is exactly as specified, with proper indentation

Install

Install with chainctl
chainctl skill install public/matlab/matlab-live-script:latest
Get started with chainctl
View source

Harden your own skills

Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.

Provenance

Upstream sourcehttps://github.com/matlab/skills
Upstream commitd88a98ab5beb7b36ae4573dab38c84786017cd67
OCI reference

skills.cgr.dev/public/github.com/matlab/skills/matlab-live-script:latest

License

BSD-2-Clause

Files

HARDENING.md

LICENSE

SKILL.md


The trusted source for open source

Talk to an expert
PrivacyTerms

Product

Chainguard ContainersChainguard LibrariesChainguard VMsChainguard OS PackagesChainguard ActionsChainguard Agent SkillsIntegrationsPricing
© 2026 Chainguard, Inc. All Rights Reserved.
Chainguard® and the Chainguard logo are registered trademarks of Chainguard, Inc. in the United States and/or other countries.
The other respective trademarks mentioned on this page are owned by the respective companies and use of them does not imply any affiliation or endorsement.