Agent Skillsmatlab/matlab-agentic-toolkit › matlab-document-toolbox

matlab-document-toolbox

GitHub

用于生成MATLAB工具箱的完整文档工件,包括README、函数签名、入门指南和示例。遵循MathWorks最佳实践,自动发现项目结构并生成符合规范的文档文件,确保内容基于实际代码且不覆盖现有文件。

skills-catalog/matlab-software-development/matlab-document-toolbox/SKILL.md matlab/matlab-agentic-toolkit

Trigger Scenarios

document this toolbox create documentation add examples generate function signatures getting started guide README make this ready to share

Install

npx skills add matlab/matlab-agentic-toolkit --skill matlab-document-toolbox -g -y
More Options

Non-standard path

npx skills add https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/matlab-software-development/matlab-document-toolbox -g -y

Use without installing

npx skills use matlab/matlab-agentic-toolkit@matlab-document-toolbox

指定 Agent (Claude Code)

npx skills add matlab/matlab-agentic-toolkit --skill matlab-document-toolbox -a claude-code -g -y

安装 repo 全部 skill

npx skills add matlab/matlab-agentic-toolkit --all -g -y

预览 repo 内 skill

npx skills add matlab/matlab-agentic-toolkit --list

SKILL.md

Frontmatter
{
    "name": "matlab-document-toolbox",
    "license": "MathWorks BSD-3-Clause",
    "metadata": {
        "author": "MathWorks",
        "version": "1.0"
    },
    "description": "Generates all documentation artifacts for a MATLAB toolbox: README.md,\nfunctionSignatures.json, GettingStarted.m, and publishable examples with\ndemos.xml help integration. Follows mathworks\/toolboxdesign best practices.\nUse when asked: \"document this toolbox\", \"create documentation\", \"add examples\",\n\"generate function signatures\", \"getting started guide\", \"README\",\n\"make this ready to share\", \"add tab completion\".\n"
}

matlab-document-toolbox — Toolbox Documentation Generator

You produce all documentation artifacts needed for a well-documented MATLAB toolbox: README, function signatures, getting started guide, and examples. You follow the mathworks/toolboxdesign conventions throughout.

When to Use

  • After matlab-create-project has set up the project structure
  • User says "document this toolbox" or "add documentation"
  • User says "create examples" or "generate function signatures"
  • User says "getting started guide" or "README"
  • Before matlab-assess-toolbox to satisfy documentation checks (1, 2, 10, 12, 15)
  • User says "make this ready to share"

When NOT to Use

  • Writing or fixing MATLAB code — this skill generates documentation only
  • Building or packaging the toolbox — use matlab-build-toolbox
  • Assessing readiness — use matlab-assess-toolbox (which may delegate here)
  • Writing tests — tests are handled by test-generation skills, not documentation

Inputs

Input Required Description
Project path Yes Absolute path to the toolbox project root
Scope No Which artifacts to generate: all (default), readme, signatures, gettingstarted, examples
Toolbox folder No Path to the distributable content folder (default: auto-detected — toolbox/, or project root if no toolbox/ exists)

Rules

  • NEVER overwrite existing files. Before creating any file, check if it already exists. If it does, show what you'd change and ask the user.
  • Never move or rename existing files.
  • Evidence-based only. Only document functions that actually exist. Never fabricate function names, signatures, or descriptions.
  • Follow mathworks/toolboxdesign layout. README at project root; GettingStarted.m in toolbox/doc/ (or doc/ if no toolbox/ folder); examples in toolbox/examples/ (or examples/); functionSignatures.json in resources/ per placement rules.
  • Read-only until approved. Present the full plan of what will be created, wait for user confirmation before writing anything.

Workflow

Step 1 — Discover Project Structure

Scan the project to understand what exists:

- Project root: README.md? license.txt? images/?
- Toolbox folder location: toolbox/ or project root?
- Existing docs: GettingStarted.m or GettingStarted.mlx? demos.xml? info.xml?
- Function signatures: resources/functionSignatures.json?
- Examples: examples/ folder? *.m or *.mlx examples?
- Source files: .m functions (public, private, internal, namespaced)
- Contents.m: authoritative function list and categories?

Determine the toolbox folder:

  1. If toolbox/ subfolder exists → that's the toolbox folder (design-guidelines layout)
  2. Otherwise → the project root IS the toolbox folder (flat layout)

Step 2 — Analyze Functions

For each .m file in the toolbox folder:

  • Extract function name, signature, H1 line, input/output arguments
  • Read arguments blocks for type constraints and validators
  • Classify: public (on path), private (private/), internal (internal/ or +pkg.internal), namespaced (+pkg/)
  • Identify categories from Contents.m, folder structure, or function themes
  • Note which functions are scripts vs. functions vs. classdefs

Step 3 — Present Plan

Show the user what will be generated:

## Documentation Plan — [Toolbox Name]

### Artifacts to Generate

| # | Artifact | Location | Status |
|---|----------|----------|--------|
| 1 | README.md | <root>/README.md | NEW / EXISTS (skip) |
| 2 | functionSignatures.json | <toolbox>/resources/functionSignatures.json | NEW / EXISTS (merge?) |
| 3 | GettingStarted.m | <toolbox>/doc/GettingStarted.m | NEW / EXISTS (skip) / .mlx EXISTS (skip) |
| 4 | Examples (N scripts) | <toolbox>/examples/ | NEW |
| 5 | demos.xml | <toolbox>/examples/demos.xml | NEW |

### Functions Covered

| Function | Category | Example? | Signature Entry? |
|----------|----------|----------|-----------------|
| add | Arithmetic | Yes | Yes |
| multiply | Arithmetic | Yes | Yes |
| helperFormat | (internal) | No | No |

Which artifacts to generate?
> A) **All** — generate everything listed above
> B) **Select** — pick specific artifact numbers (e.g., "1, 2, 5")
> C) **Skip existing** — generate only NEW artifacts, skip those marked EXISTS

Wait for user confirmation before generating anything.

Step 4 — Generate README.md

Use references/readme-template.md for the structure and conventions. Key points:

  • README at project root, NOT inside toolbox/
  • User-focused summary above the fold
  • Function table from Contents.m or H1 lines
  • Point to GettingStarted.m

Step 5 — Generate functionSignatures.json

See references/function-signatures-rules.md for placement rules, type mapping, extraction from arguments blocks, and validation.

Key points:

  • Always include "_schemaVersion": "1.0.0" at the top level
  • Placement depends on namespacing (regular vs. +pkg vs. @class)
  • Validate with validateFunctionSignaturesJSON via MATLAB MCP
  • Accuracy over completeness — omit type rather than guess

Step 6 — Generate GettingStarted.m

Location: toolbox/doc/GettingStarted.m (MATLAB auto-presents this on toolbox install via ToolboxGettingStartedGuide)

If a GettingStarted.mlx already exists, skip this step — the existing .mlx is valid and should not be replaced.

If the project has no toolbox/ folder, use doc/GettingStarted.m at the project root level.

Use scripts/getting-started-template.m as the starting structure. Key rules:

  • Must run without user interaction
  • Keep computations fast (< 5 seconds total)
  • Show the most impactful 3-5 functions, not all functions
  • Include at least one visualization if the toolbox produces visual output
  • Use %% section breaks (renders as rich document in the Live Editor)
  • Name it exactly GettingStarted.m (case-sensitive — MATLAB looks for this name)

Step 7 — Generate Examples

See references/examples-conventions.md for naming, structure, conversion, and rules.

Step 8 — Generate demos.xml

Use references/demos-xml-template.xml for the structure. Key rules:

  • <source> is the filename WITHOUT the .m/.mlx extension
  • Group examples into logical <demosection> categories
  • Use descriptive <label> text (include the function name in parentheses)
  • Order sections: Getting Started first, then fundamental → advanced
  • Include the GettingStarted guide as the first demo item

Step 9 — Add to MATLAB Project

If a MATLAB project exists, add all generated files:

proj = openProject(projectRoot);
% Add new files and doc/examples folders to the project path

Step 10 — Report Results

## Documentation Complete — [Toolbox Name]

### Generated Artifacts

| Artifact | Location | Functions Covered |
|----------|----------|-------------------|
| README.md | <root>/README.md | All (summary table) |
| functionSignatures.json | toolbox/resources/functionSignatures.json | N public functions |
| GettingStarted.m | toolbox/doc/GettingStarted.m | Top 5 functions |
| Examples (M files) | toolbox/examples/*.m | N functions |
| demos.xml | toolbox/examples/demos.xml | All examples |

### Validation
- functionSignatures.json: VALID (N functions, 0 errors)
- GettingStarted.m: Runs without error
- Examples: M/M run successfully

### Packaging Integration
- ToolboxGettingStartedGuide → toolbox/doc/GettingStarted.m
- All artifacts inside toolbox/ folder → will ship in .mltbx
- README.md at project root → will NOT ship (developer-facing)

### Next Steps
- Review generated examples for accuracy
- Run `matlab-assess-toolbox` to check remaining gaps
- Customize GettingStarted.m with domain-specific narrative

Checkpoint

Yes — presents the full plan (Step 3) before generating anything. User can select which artifacts to generate, skip existing ones, or customize the scope.

Key Rules

  • README at root, not in toolbox/. The README is for GitHub/developers. End users get GettingStarted.m inside the toolbox.
  • GettingStarted.m in toolbox/doc/. This exact path is what ToolboxGettingStartedGuide points to. MATLAB auto-presents it on install.
  • Examples in toolbox/examples/. They ship inside the .mltbx and appear in the Help Browser via demos.xml.
  • functionSignatures.json in resources/. Follows MATLAB's resource folder convention. Placement rules differ for namespaces — the JSON goes in the parent of +pkg/.
  • Plain-text .m for user-facing docs. Write as plain-text .m with %% section breaks — these render as rich documents in the Live Editor and are version-control friendly.
  • Everything must run. GettingStarted and all examples must execute without error or user interaction.
  • Don't fabricate. Only document functions that exist. Only generate signatures for arguments you can verify from the source.
  • Accuracy over completeness. An incomplete but correct functionSignatures.json is better than a complete but wrong one. Omit type rather than guess.
  • Single pass. Generate all documentation in one workflow. Don't require the user to invoke separate skills for each artifact.
  • Respect existing work. If README, signatures, or examples already exist, show what you'd add/change and ask first.

Next Steps

  • /matlab-create-buildfile — define the build plan with code checks, tests, and packaging tasks
  • /matlab-assess-toolbox — validate readiness across all checks before building

Copyright 2026 The MathWorks, Inc.


Version History

  • 2026.07.16 Current 2026-07-24 16:20

Same Skill Collection

skills-catalog/ai-and-statistics/matlab-create-experiment/SKILL.md
skills-catalog/ai-and-statistics/matlab-use-machine-learning-apps/SKILL.md
skills-catalog/automotive/roadrunner-asset-mapping/SKILL.md
skills-catalog/automotive/roadrunner-convert-lanelet2-to-rrhd/SKILL.md
skills-catalog/automotive/roadrunner-core/SKILL.md
skills-catalog/automotive/roadrunner-import-scene/SKILL.md
skills-catalog/automotive/roadrunner-rrhd-authoring/SKILL.md
skills-catalog/automotive/roadrunner-scenario-authoring/SKILL.md
skills-catalog/code-generation/matlab-deploy-embedded-code/SKILL.md
skills-catalog/code-generation/matlab-optimize-gpu-codegen/SKILL.md
skills-catalog/code-generation/matlab-review-fi-code/SKILL.md
skills-catalog/code-generation/matlab-review-fi-object-code/SKILL.md
skills-catalog/computational-biology/matlab-build-simbiology-model/SKILL.md
skills-catalog/computational-biology/matlab-fit-simbiology-model/SKILL.md
skills-catalog/computational-biology/matlab-simulate-simbiology-model/SKILL.md
skills-catalog/computational-finance/matlab-access-datafeed/SKILL.md
skills-catalog/computational-finance/matlab-use-spreadsheet-link/SKILL.md
skills-catalog/control-systems/matlab-extract-battery-features/SKILL.md
skills-catalog/control-systems/matlab-extract-rotating-machinery-features/SKILL.md
skills-catalog/control-systems/matlab-identify-linear-system/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-display-image/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-display-volume/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-model-optics/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-point-cloud-file-io/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-point-cloud-registration/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-process-large-images/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-read-write-point-cloud-file/SKILL.md
skills-catalog/image-processing-and-computer-vision/matlab-register-point-clouds/SKILL.md
skills-catalog/math-and-optimization/matlab-solve-optimization/SKILL.md
skills-catalog/matlab-core/matlab-create-live-script/SKILL.md
skills-catalog/matlab-core/matlab-debug-code/SKILL.md
skills-catalog/matlab-core/matlab-debugging/SKILL.md
skills-catalog/matlab-core/matlab-install-products/SKILL.md
skills-catalog/matlab-core/matlab-list-products/SKILL.md
skills-catalog/matlab-core/matlab-read-doc/SKILL.md
skills-catalog/matlab-core/matlab-read-documentation/SKILL.md
skills-catalog/matlab-core/matlab-review-code/SKILL.md
skills-catalog/matlab-core/matlab-testing/SKILL.md
skills-catalog/matlab-core/matlab-write-test/SKILL.md
skills-catalog/matlab-data-import-and-analysis/matlab-analyze-data/SKILL.md
skills-catalog/matlab-data-import-and-analysis/matlab-import-export-data/SKILL.md
skills-catalog/matlab-environment-and-settings/matlab-migrate-settings/SKILL.md
skills-catalog/matlab-external-language-interfaces/matlab-call-python/SKILL.md
skills-catalog/matlab-software-development/matlab-analyze-dependencies/SKILL.md
skills-catalog/matlab-software-development/matlab-assess-toolbox/SKILL.md
skills-catalog/matlab-software-development/matlab-build-toolbox/SKILL.md
skills-catalog/matlab-software-development/matlab-create-buildfile/SKILL.md
skills-catalog/matlab-software-development/matlab-create-project/SKILL.md
skills-catalog/matlab-software-development/matlab-define-toolbox-api/SKILL.md

Metadata

Files
0
Version
2026.07.16
Hash
3f6cee45
Indexed
2026-07-24 16:20

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 10:29
浙ICP备14020137号-1 $Гость$