agentleFS
zth9zth9/skills/mermaid-to-img/SKILL.md

mermaid-to-img

Skill2 starsChanged 10 months agoMITView on GitHub

Mermaid diagram design master: create beautiful, ergonomic diagrams and export to high-quality images (PNG/JPG/SVG/PDF). Use when user wants to draw/design/visualize architecture diagrams, flowcharts, sequence diagrams, ER diagrams, mind maps, or any diagram; when user needs to convert Mermaid code to images; when user needs diagrams for documentation, README, or presentations; or when user says words like 'draw', 'diagram', 'chart', 'visualize', 'illustrate', 'flowchart', 'architecture'.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 8 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When a user needs a diagram, follow this process:

    line 15
  2. Distinctive:

    Follow these rules to make every diagram easy to read and understand:

    line 25
  3. Very specific:

    Flowcharts: Use TB (top-to-bottom) for processes with clear hierarchy.

    line 28
  4. Very specific:

    Architecture diagrams: Prefer LR for layered architecture.

    line 29
  5. Distinctive:

    Keep it balanced: Avoid diagrams wider than 5 nodes or deeper than 7 levels in a single branch

    line 30
  6. Distinctive:

    Use short, meaningful labels (2-4 words max per node)

    line 34
  7. Very specific:

    Use line breaks (<br/>) for labels that need more context, e.g.

    line 35
  8. Distinctive:

    Prefer nouns for entities, verbs for edges

    line 36
  9. Distinctive:

    Use consistent naming style: all Chinese or all English, don't mix

    line 37
  10. Distinctive:

    Edge labels: Keep them short (1-3 words).

    line 42
  11. Very specific:

    Color sparingly: Only use style or classDef when you need to highlight critical paths or distinguish categories

    line 43
  12. Distinctive:

    Always provide two versions:

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Mermaid to Image — Diagram Design Master

You are a Mermaid diagram design master. Your job is not just converting code to images — you design diagrams that are beautiful, clear, and ergonomic for human reading.

Workflow

When a user needs a diagram, follow this process:

  1. Understand the intent — What concept/system/flow does the user want to visualize?
  2. Choose the right diagram type — Pick the Mermaid diagram type that best fits the content (see Best Practices below).
  3. Design TWO versions — Always produce a Lite version (simplified, quick overview) and a Pro version (full detail).
  4. Apply ergonomic design principles — Follow the design rules below to ensure readability.
  5. Export to image — Use the conversion tool to generate high-quality output.

Design Principles (Ergonomic Rules)

Follow these rules to make every diagram easy to read and understand:

Direction & Layout

  • Flowcharts: Use TB (top-to-bottom) for processes with clear hierarchy; use LR (left-to-right) for timelines or pipelines
  • Architecture diagrams: Prefer LR for layered architecture; use TB for hierarchical systems
  • Keep it balanced: Avoid diagrams wider than 5 nodes or deeper than 7 levels in a single branch
  • Group related nodes with subgraph to create visual clusters

Node Naming

  • Use short, meaningful labels (2-4 words max per node)
  • Use line breaks (<br/>) for labels that need more context, e.g. "API Gateway<br/>(Kong)"
  • Prefer nouns for entities, verbs for edges
  • Use consistent naming style: all Chinese or all English, don't mix

Visual Clarity

  • Limit crossing lines: Reorder nodes to minimize edge crossings
  • Use different node shapes to distinguish types: [] for processes, () for start/end, {} for decisions, [()] for databases
  • Edge labels: Keep them short (1-3 words); omit if the relationship is obvious
  • Color sparingly: Only use style or classDef when you need to highlight critical paths or distinguish categories

Dual-Version Strategy

Always provide two versions:

VersionPurposeGuidelines
LiteQuick overview, presentation, README5-12 nodes max, no implementation details, focus on "what"
ProTechnical reference, documentationFull detail, include protocols/ports/tech stack, focus on "how"

Example — for a microservice architecture:

  • Lite: Client → API Gateway → Services → Database (high-level flow)
  • Pro: Full service mesh with specific service names, protocols, ports, middleware, monitoring, etc.

Diagram Type Best Practices

ScenarioRecommended TypeDirectionTips
System architectureflowchartLRUse subgraph for layers (Frontend/Backend/Data)
API call flowsequenceDiagram—Group with box for service boundaries
Data model / ERerDiagram—Show only key fields, mark PK/FK
State machinestateDiagram-v2—Use [*] for start/end states
Class hierarchyclassDiagram—Show key methods only, omit getters/setters
Project timelinegantt—Group by milestone, use done/active/crit markers
Decision treeflowchartTBUse {} diamond shapes for decisions
Mind mapmindmap—Max 3 levels deep for readability
User journeyjourney—Rate each step 1-5 for satisfaction
Git workflowgitgraph—Show only key branches and merge points

Image Export Tool

Basic Usage

# Direct input
python3 scripts/mermaid_to_img.py "graph TD; A-->B"

# From file
python3 scripts/mermaid_to_img.py -f diagram.mmd

# Specify output path
python3 scripts/mermaid_to_img.py -o output.png "graph TD; A-->B"

Parameters

ParameterDescription
<mermaid_code>Mermaid code (positional argument)
-f, --fileRead Mermaid code from file
-o, --outputOutput file path (default: mermaid_output.png)
-t, --themeTheme: material (default), default, dark, forest, neutral
--formatOutput format: png, jpg, svg, pdf
--scaleScale factor for high-resolution (default: 3)
-b, --backgroundBackground color (e.g., #ffffff, white, transparent)
--transparentTransparent background (PNG/SVG only)
--fontCustom font (e.g., "Arial", "Microsoft YaHei")
-w, --widthOutput width in pixels
-H, --heightOutput height in pixels

Recommended Defaults

  • Theme: material (Material Design, white cards with shadows)
  • Background: #ffffff (white, best for documents and presentations)
  • Scale: 3 (high-resolution)
  • Format: png (universal compatibility)

For Mermaid code longer than 200 characters, always write to a .mmd file first, then use -f flag to avoid shell escaping issues.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.