Agent Skillsmastra-ai/mastra › docs-diagrams

docs-diagrams

GitHub

将文档中的图表图片转换为 Mermaid 代码,或为 Mastra 文档编写新图表。遵循样式指南,通过查找引用、分析节点边、编写代码及双模式验证等步骤,实现文档图表的标准化与可维护性。

.claude/skills/docs-diagrams/SKILL.md mastra-ai/mastra

Trigger Scenarios

转换 Excalidraw 或 PNG/JPG/SVG 图片为 Mermaid 为文档页面创建新图表 修复图表在亮/暗模式下的渲染问题 审计并替换文档中的图片图表

Install

npx skills add mastra-ai/mastra --skill docs-diagrams -g -y
More Options

Non-standard path

npx skills add https://github.com/mastra-ai/mastra/tree/main/.claude/skills/docs-diagrams -g -y

Use without installing

npx skills use mastra-ai/mastra@docs-diagrams

指定 Agent (Claude Code)

npx skills add mastra-ai/mastra --skill docs-diagrams -a claude-code -g -y

安装 repo 全部 skill

npx skills add mastra-ai/mastra --all -g -y

预览 repo 内 skill

npx skills add mastra-ai/mastra --list

SKILL.md

Frontmatter
{
    "name": "docs-diagrams",
    "description": "Convert existing docs diagram images to Mermaid, and author new Mermaid diagrams for Mastra docs. Use when replacing an Excalidraw or PNG\/JPG\/SVG diagram with Mermaid, when a docs page needs a new diagram, when a diagram renders wrong in light or dark mode, or when auditing which docs images should become Mermaid. Triggers on: convert diagram, Excalidraw, mermaid, flowchart, diagram image, diagram styling, diagram looks wrong."
}

Docs Diagrams

Read docs/styleguides/DIAGRAM.md first. It is the shape, color, and layout language. This skill is the process for applying it to an image that already exists.

Decide whether to convert

Answer in order. Stop at the first yes.

  1. Is it a screenshot of a UI? → Keep the image. Mermaid draws graphs, not product surfaces.
  2. Does meaning live in where things sit rather than what connects to what? → Keep the image. ELK places nodes automatically and will move them. The agents overview image, where tool, LLM, and memory sit deliberately beneath the agent, loses its point the moment a layout engine touches it.
  3. Is it boxes joined by arrows, and would it survive being redrawn by someone who only read the node and edge labels? → Convert.

A diagram that only converts by fighting the layout engine is a diagram that should stay an image. Do not add invisible spacer nodes, padding spaces in labels, or a hand-tuned elk block to force a shape. The next writer will not know why they are there.

Convert

1. Find every reference before touching anything

grep -rn "<image-filename>" docs/src

Docs images are shared across pages more often than expected. The suspend and resume images appear on both the human-in-the-loop and suspend-and-resume pages. Converting one page does not free the asset.

2. Read the image and name the nodes and edges

Write down each node, its job, and each edge with its label. Work from that list, not from the picture. The list is what maps onto the shape decision tree in DIAGRAM.md; the picture tempts you into copying a hand-drawn layout that ELK will not reproduce.

3. Write the diagram

Main path first, then branches. Apply shapes from the decision tree, semantic classes for outcomes only, accTitle and accDescr always.

Match the story to the sentence above the diagram. A page section about resuming a workflow gets a diagram that starts at the paused state, not one that replays the entire run with resume tacked on. When a diagram tries to show a full suspend and resume loop, ELK pushes the paused node left of the step and crosses the two dotted edges. Show the leg the section is about.

4. Verify in the browser, in both modes

cd docs && pnpm dev --port 3005

Check each of these. They are the failures that actually happen:

  • The main path is a straight line. If it bends, a branch was declared too early.
  • No node is more than twice the width of its neighbors. If one is, break its label with <br/>.
  • Every edge label sits on its edge, not in open space.
  • Toggle light and dark. Text stays readable on both, and no node keeps a fill from the other mode.

A screenshot is not verification. Render it.

5. Delete the asset only when nothing references it

Re-run the grep from step 1. Zero results, delete the file. Any results, leave it, and say which pages still use it.

Extend the color language

Three classes exist: accent, pending, danger. Adding a fourth requires light and dark palette values in docs/src/theme/Mermaid/mastra-mermaid-theme.ts, plus registrations through semanticClassCSS(...) for nodes and semanticEdgeCSS(...) for edges. Add the class to the DIAGRAM.md table too. Never add a color by writing hex in a diagram; it will be wrong in one of the two modes.

Check the work

  • pnpm lint:remark in docs/
  • pnpm build in docs/, because a Mermaid parse error fails the build rather than degrading

Version History

  • 8da7066 Current 2026-08-29 05:01

Same Skill Collection

.agents/skills/label-core-bugs/SKILL.md
.claude/skills/debugging-difficult-bugs/SKILL.md
.claude/skills/docs-audit/SKILL.md
.claude/skills/e2e-tests-studio/SKILL.md
.claude/skills/label-core-bugs/SKILL.md
.claude/skills/mastra-docs/SKILL.md
.claude/skills/mastra-frontend/SKILL.md
.claude/skills/mastra-smoke-test/SKILL.md
.claude/skills/pr-explainer/SKILL.md
.claude/skills/pr-splitter/SKILL.md
.claude/skills/ralph-plan/SKILL.md
.claude/skills/react-best-practices/SKILL.md
.claude/skills/smoke-test/SKILL.md
.claude/skills/tailwind-v4/SKILL.md
.claude/skills/testing-core-processors/SKILL.md
.claude/skills/testing-mastracode-tui/SKILL.md
.mastracode/skills/gh-bulk-issues/SKILL.md
.mastracode/skills/herdr-kit-workflows/SKILL.md
.mastracode/skills/herdr-manager-query/SKILL.md
.mastracode/skills/label-core-bugs/SKILL.md
.mastracode/skills/understand-issue/SKILL.md
.mastracode/skills/understand-pr/SKILL.md
mastracode/factory/factory-skills/configure-factory-rules/SKILL.md
mastracode/factory/factory-skills/factory-complete-issue/SKILL.md
mastracode/factory/factory-skills/factory-plan/SKILL.md
mastracode/factory/factory-skills/factory-rereview/SKILL.md
mastracode/factory/factory-skills/factory-review/SKILL.md
mastracode/factory/factory-skills/factory-triage/SKILL.md
templates/template-claw-assistant/workspace/skills/general-tasks/SKILL.md
templates/template-claw-assistant/workspace/skills/research-tasks/SKILL.md
templates/template-github-review-agent/workspace/skills/code-standards/SKILL.md
templates/template-github-review-agent/workspace/skills/performance-review/SKILL.md
templates/template-github-review-agent/workspace/skills/security-review/SKILL.md
.claude/skills/builder-smoke-test/SKILL.md
.claude/skills/playground-msw-tests/SKILL.md
.mastracode/skills/triage-issue/SKILL.md

Metadata

Files
0
Version
8da7066
Hash
fdb99306
Indexed
2026-08-29 05:01

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-29 07:44
浙ICP备14020137号-1 $Carte des visiteurs$