askill
pretty-diagrams

pretty-diagramsSafety 95Repository

Create and render beautiful diagrams using Mermaid markup. Use when producing architecture diagrams, flowcharts, sequence, state, class, or ER diagrams — especially when visual output (SVG) or terminal-friendly ASCII is needed. Covers diagram type selection, markup best practices, and rendering with mmd-render (beautiful-mermaid SVG / box-of-rain ASCII) or mermaid CLI (full type fallback).

0 stars
1.2k downloads
Updated 2/22/2026

Package Files

Loading files...
SKILL.md

Pretty Diagrams

Three-tier rendering stack for Mermaid diagrams: ASCII previews, themed SVG exports, and full-type fallback.

When to Use

  • User asks for an architecture diagram, flowchart, sequence, state, class, or ER diagram
  • Need to visualize data flows, system relationships, processes, or state machines
  • Embedding diagrams in docs, PRs, Obsidian, or terminal output
  • User wants a "pretty" or "rendered" version, not just a code block

Tool Selection

By Output Context

ContextTool
Terminal previewmmd-render --ascii (flowchart/sequence only)
Pretty SVG exportmmd-render (beautiful-mermaid)
GitHub/Obsidian embedRaw mermaid code block (rendered natively)
Unsupported diagram typemmdc (mermaid CLI)

By Diagram Type

Typemmd-render SVGmmd-render ASCIImmdc
Flowchart
Sequence
State
Class
ER
Gantt / Pie / Git / XY

Default choice: mmd-render for anything needing visual output. Use --ascii only when the user explicitly wants terminal output.

Writing Mermaid Markup

General Rules

  • Keep to 10–15 nodes max — beyond that, split into multiple diagrams
  • Always specify direction in flowcharts (flowchart LR not just flowchart)
  • Use meaningful labels, not A, B, C
  • Prefer flowchart over graph (newer syntax)

Flowcharts

Use LR for pipelines/data flows, TD for hierarchies/trees.

flowchart LR
    Input[User Request] --> Validate{Valid?}
    Validate -->|yes| Process[Process Request]
    Validate -->|no| Error[Return Error]
    Process --> Store[(Database)]
    Store --> Output[Response]

Node shapes:

  • [text] — rectangle
  • (text) — rounded corners
  • {text} — diamond / decision
  • [(text)] — cylinder / database
  • ([text]) — stadium / pill
  • [[text]] — subroutine / double-border
  • {{text}} — hexagon

Edge types:

  • --> — arrow
  • --- — line (no arrow)
  • -.-> — dashed arrow
  • ==> — thick arrow
  • --> |label| — labeled edge

Sequence Diagrams

sequenceDiagram
    actor User
    participant API
    participant DB

    User->>API: POST /login
    API->>DB: SELECT WHERE email=?
    DB-->>API: user record
    API-->>User: 200 JWT
  • Use actor for humans, participant for systems
  • Keep to 3–5 participants — more gets unreadable
  • -->> for return messages (dashed = response convention)

State Diagrams

stateDiagram-v2
    [*] --> Pending
    Pending --> Processing : start
    Processing --> Complete : success
    Processing --> Failed : error
    Failed --> Pending : retry
    Complete --> [*]
  • Use stateDiagram-v2 (not v1)
  • [*] for entry/exit points
  • Label transitions with : event

Class Diagrams

classDiagram
    class User {
        +String id
        +String email
        +login() bool
    }
    class Order {
        +String userId
        +Float total
        +place() void
    }
    User "1" --> "0..*" Order : places

Visibility prefixes: + public, - private, # protected

ER Diagrams

erDiagram
    USER ||--o{ ORDER : places
    ORDER ||--|{ LINE_ITEM : contains
    USER {
        string id PK
        string email
        timestamp created_at
    }

Cardinality syntax: ||--o{ = one-to-many. Left side is the "one".

Rendering

mmd-render (primary)

mmd-render is installed at ~/bin/mmd-render. It wraps beautiful-mermaid (SVG) and box-of-rain (ASCII).

# SVG — beautiful-mermaid, default tokyo-night theme
mmd-render diagram.mmd

# SVG — explicit output path + theme
mmd-render --theme nord diagram.mmd output.svg
open output.svg

# ASCII — box-of-rain (flowchart/sequence), falls back to beautiful-mermaid ASCII
mmd-render --ascii diagram.mmd

# Help
mmd-render --help

Available themes: tokyo-night · dracula · catppuccin · nord · github · github-dark (+ 9 more)

Source: ~/.local/share/mmd-render/index.ts · Dependencies: beautiful-mermaid, box-of-rain

Mermaid CLI (all types)

Use when diagram type isn't supported by mmd-render (Gantt, pie, git, xychart, etc.).

# Install once
bun add -g @mermaid-js/mermaid-cli

# Render
mmdc -i diagram.mmd -o diagram.svg
mmdc -i diagram.mmd -o diagram.png -t dark
mmdc -i diagram.mmd -o diagram.svg -w 1200

Default Workflow

  1. Write the Mermaid markup based on what the user describes
  2. Embed a raw fenced code block in the response — works in GitHub, Obsidian, and most doc tools natively
  3. Offer rendering options:
    • "Want me to render this as a themed SVG? (mmd-render --theme nord diagram.mmd)"
    • For flowchart/sequence: "Or an ASCII preview? (mmd-render --ascii diagram.mmd)"
  4. Save .mmd to docs/diagrams/ if working in a project codebase

Anti-Patterns

  • ❌ Using mmd-render SVG for Gantt/pie/git/xychart (not supported — use mmdc)
  • ❌ Using mmd-render ASCII for state/class/ER (not supported — use SVG mode)
  • ❌ Diagrams with 20+ nodes — split or summarize
  • ❌ Bare letters as node names (A --> B) without labels
  • ❌ Forgetting flowchart direction (flowchart without LR/TD/RL/BT)
  • ❌ Using graph keyword instead of flowchart (legacy syntax)

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

88/100Analyzed 2/24/2026

High-quality skill document covering Mermaid diagram creation with clear tool selection guidance, comprehensive examples for 5 diagram types, and practical rendering instructions. Well-structured with When to Use section, tables for tool/diagram compatibility, and anti-patterns. Scores high on clarity, actionability, and safety. Minor gap is lack of troubleshooting section. Suitable for broad reuse.

95
90
85
85
90

Metadata

Licenseunknown
Version-
Updated2/22/2026
Publishercameronsjo

Tags

apidatabasegithubgithub-actions