askill
diagramming

diagrammingSafety 100Repository

Create professional diagrams using Mermaid or DOT/Graphviz. Mermaid for flowcharts, sequences, classes, ER, Gantt, architecture with semantic coloring and WCAG AA accessibility. DOT/Graphviz for pure network graphs, semantic webs, and maximum layout control.

0 stars
1.2k downloads
Updated 2/19/2026

Package Files

Loading files...
SKILL.md

Diagramming Skill

Generate professional diagrams with semantic coloring (Cagle palette) and accessibility compliance.

CRITICAL: Always Use Mermaid/DOT Over ASCII Art

NEVER use ASCII art for diagrams. When you encounter ASCII art diagrams in existing documents or when you need to create any visual representation:

  1. Replace existing ASCII diagrams with Mermaid or DOT equivalents
  2. Create new diagrams using Mermaid or DOT, never ASCII
  3. Convert on sight - if you see ASCII art representing a flow, architecture, sequence, or any visual concept, convert it to a proper diagram

ASCII art is:

  • Not accessible (screen readers can't interpret it)
  • Not maintainable (hard to modify)
  • Not portable (breaks with font changes)
  • Not professional (looks dated)

Mermaid/DOT diagrams are:

  • Accessible (with accTitle/accDescr)
  • Maintainable (text-based, version-controllable)
  • Renderable (to PNG/SVG for documentation)
  • Professional (clean, consistent styling)

Tool Selection

Use CaseToolReason
Flowcharts, sequences, ER, GanttMermaidStructured labeled relationships, markdown embedding
Pure network graphs, semantic websDOT/GraphvizCommunity standard, maximum layout control
SHACL shapes, RDF with constraintsMermaidDashed strokes, subgraphs for named graphs
Ball-and-arrow graphs, large networksDOT/GraphvizNative graph notation, better edge routing
Documentation, web embeddingMermaidGitHub/GitLab rendering, web-native

Default: Start with Mermaid. Switch to DOT when pure network topology is primary concern.


Diagram Type Router

Load only ONE guide per request. Match user intent to the most specific keywords:

User IntentLoad GuideOutput Format
Process, flow, decision tree, algorithm02-FLOWCHART-GUIDE.mdMermaid flowchart
API calls, service interaction, request/response03-SEQUENCE-DIAGRAM-GUIDE.mdMermaid sequenceDiagram
OOP, classes, interfaces, inheritance04-CLASS-DIAGRAM-GUIDE.mdMermaid classDiagram
State machine, workflow states, lifecycle05-STATE-DIAGRAM-GUIDE.mdMermaid stateDiagram-v2
Database schema, data model, entities06-ER-DIAGRAM-GUIDE.mdMermaid erDiagram
Project timeline, schedule, milestones07-GANTT-GUIDE.mdMermaid gantt
Pie, mindmap, journey, timeline, git, C4, sankey, XY08-OTHER-DIAGRAMS-GUIDE.mdMermaid various
Styling, themes, colors, accessibility09-STYLING-GUIDE.mdn/a
"What diagram should I use?"10-USE-CASE-SCENARIOS.mdn/a
System architecture, platform design12-SOLUTION-ARCHITECTURE-GUIDE.mdMermaid flowchart
Data flow, async, events, streaming13-DATA-FLOW-PATTERNS-GUIDE.mdMermaid various
Kubernetes, cloud, CI/CD, deployment14-DEPLOYMENT-ARCHITECTURE-GUIDE.mdMermaid flowchart
Design patterns, DDD, API design15-TECHNICAL-DESIGN-PATTERNS-GUIDE.mdMermaid various
Configuration options, all settings16-CONFIGURATION-REFERENCE.mdn/a
RDF, ontology, SHACL, triples, linked data, SPARQL17-LINKED-DATA-GUIDE.mdMermaid flowchart LR + ELK
Property graph, Neo4j, Cypher, graph database18-PROPERTY-GRAPH-GUIDE.mdMermaid flowchart + ELK
Pure network graph, semantic graph, Turtle→DOT19-DOT-GRAPHVIZ-GUIDE.mdDOT/Graphviz

Decision Logic (Specificity Order)

Match most specific first. Check in this order:

PriorityKeywordsGuideFormat
1DOT, Graphviz, digraph, Turtle→graph, "pure network"19-DOT-GRAPHVIZ-GUIDE.mdDOT
2RDF, ontology, SHACL, triple, linked data, SPARQL17-LINKED-DATA-GUIDE.mdMermaid
3Neo4j, Cypher, property graph, graph database18-PROPERTY-GRAPH-GUIDE.mdMermaid
4pie chart, mindmap, journey map, C4, sankey, quadrant, gitGraph08-OTHER-DIAGRAMS-GUIDE.mdMermaid
5kubernetes, docker, container, CI/CD, pipeline, helm14-DEPLOYMENT-ARCHITECTURE-GUIDE.mdMermaid
6microservice, system architecture, platform design12-SOLUTION-ARCHITECTURE-GUIDE.mdMermaid
7async, event-driven, pub/sub, streaming, message queue13-DATA-FLOW-PATTERNS-GUIDE.mdMermaid
8design pattern, DDD, domain model, factory, singleton15-TECHNICAL-DESIGN-PATTERNS-GUIDE.mdMermaid
9database, schema, entity, table, ERD06-ER-DIAGRAM-GUIDE.mdMermaid
10API, request/response, service call, HTTP03-SEQUENCE-DIAGRAM-GUIDE.mdMermaid
11state machine, lifecycle, status, workflow state05-STATE-DIAGRAM-GUIDE.mdMermaid
12class, interface, inheritance, OOP, UML class04-CLASS-DIAGRAM-GUIDE.mdMermaid
13project schedule, gantt, milestone, timeline (project)07-GANTT-GUIDE.mdMermaid
14timeline (chronology), history, evolution08-OTHER-DIAGRAMS-GUIDE.mdMermaid
15theme, styling, colors, classDef, WCAG, accessibility, Cagle palette09-STYLING-GUIDE.mdMermaid
16configuration, settings, ELK options, layout, spacing16-CONFIGURATION-REFERENCE.mdMermaid
17flowchart, process, decision tree, algorithm02-FLOWCHART-GUIDE.mdMermaid
18"what diagram should I use", help choosing10-USE-CASE-SCENARIOS.mdn/a

Default: If unclear, ask user to clarify or suggest options from 10-USE-CASE-SCENARIOS.md.


Essential Configuration (Always Available)

ELK Layout (Use for Complex Diagrams)

---
config:
  layout: elk
  elk:
    mergeEdges: false
    nodePlacementStrategy: BRANDES_KOEPF
---

When to use ELK: >10 nodes, dense connections, knowledge graphs, complex architectures

Theme Configuration (Base Theme Required)

%%{init: {
  "theme": "base",
  "themeVariables": {
    "primaryColor": "#E3F2FD",
    "primaryTextColor": "#0D47A1",
    "primaryBorderColor": "#1565C0",
    "lineColor": "#37474F"
  }
}}%%

CRITICAL: Only base theme supports customization. Only hex colors work.


Cagle Color Palette (Memorize)

Architecture Colors

TypeFillStrokeUse
Infrastructure#E3F2FD#1565C0Cloud, platforms, networks
Service#E8F5E9#2E7D32APIs, microservices
Data#FFF8E1#F57F17Databases, storage
User/Actor#F3E5F5#7B1FA2People, roles
Process#E1F5FE#0277BDWorkflows, actions
Security#E0F2F1#00695CAuth, encryption
External#ECEFF1#455A64Third-party systems

Status Colors

StatusFillStroke
Success#C8E6C9#2E7D32
Warning#FFF9C4#F9A825
Error#FFCDD2#C62828
Info#BBDEFB#1565C0

Knowledge Graph Colors (Semantic)

EntityFillStroke
Class/Type#E1BEE7#6A1B9A
Instance#B3E5FC#0277BD
Property#F8BBD9#AD1457
Literal#FFF9C4#F57F17

classDef Template (Copy-Paste Ready)

classDef infra fill:#E3F2FD,stroke:#1565C0,stroke-width:2px,color:#0D47A1
classDef service fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px,color:#1B5E20
classDef data fill:#FFF8E1,stroke:#F57F17,stroke-width:2px,color:#E65100
classDef user fill:#F3E5F5,stroke:#7B1FA2,stroke-width:2px,color:#4A148C
classDef process fill:#E1F5FE,stroke:#0277BD,stroke-width:2px,color:#01579B
classDef security fill:#E0F2F1,stroke:#00695C,stroke-width:2px,color:#004D40
classDef external fill:#ECEFF1,stroke:#455A64,stroke-width:2px,color:#263238
classDef success fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px,color:#1B5E20
classDef warning fill:#FFF9C4,stroke:#F9A825,stroke-width:2px,color:#F57F17
classDef error fill:#FFCDD2,stroke:#C62828,stroke-width:2px,color:#B71C1C

Output Format

When generating diagrams, always:

  1. Use backticks (``` ) not tildes (~~~) for code fences - required for renderer compatibility
  2. Start with configuration if using ELK or custom theme
  3. Declare classDef styles before using them
  4. Use semantic colors based on entity type
  5. Add comments for complex diagrams explaining structure
  6. Include the complete diagram - never truncate

CRITICAL: Always use triple backticks (```) for mermaid/dot code blocks, never triple tildes (~~~). Renderers and export tools require backtick fences.

Document Structure (After Export)

After exporting diagrams to PNG/SVG, the document should have:

  1. The rendered image
  2. A collapsible <details> block containing the mermaid source
![diagram-name](diagrams/doc/diagram-name.png)

<details>
<summary>Mermaid Source</summary>

` ``mermaid
flowchart LR
    A --> B
` ``

</details>

This preserves the source for future editing while keeping the document clean.

Standard Output Structure

---
config:
  layout: elk  # Only if needed
---
%%{init: {"theme": "base", "themeVariables": {...}}}%%
diagramType
    accTitle: Brief diagram title for screen readers
    accDescr: One-line description of what the diagram shows

    %% Style definitions
    classDef type1 fill:...,stroke:...

    %% Diagram content
    Node1[Label]:::type1
    Node1 --> Node2

Accessibility Directives

Always include accessibility metadata for screen readers:

flowchart LR
    accTitle: User Authentication Flow
    accDescr: Shows login request from client through API gateway to auth service

    %% For multi-line descriptions:
    accDescr {
        Detailed description spanning
        multiple lines for complex diagrams
    }

    Client --> Gateway --> AuthService

Quality Checklist

Before returning any diagram:

  • Correct diagram type for the use case?
  • ELK enabled if >10 nodes or complex relationships?
  • Semantic colors applied consistently?
  • All nodes labeled clearly (≤30 characters for readability)?
  • Relationships have meaningful labels where needed?
  • Configuration block properly formatted?
  • No syntax errors (test mentally)?
  • Accessibility: accTitle and accDescr included?

Loading Secondary Guides

When you need detailed syntax or patterns beyond this entry point:

  1. Match user request to the Decision Logic table above
  2. Use the Read tool to load the guide from the same directory as this SKILL.md file
  3. Apply patterns from the guide to user's specific need
  4. Use Cagle colors from this file (always available)

Load only ONE guide per request to minimize context usage.


Example Interactions

User: "Create a database schema for a blog"

Action: Load 06-ER-DIAGRAM-GUIDE.md, generate erDiagram with USER, POST, COMMENT, TAG entities

User: "Show me how a REST API request flows"

Action: Load 03-SEQUENCE-DIAGRAM-GUIDE.md, generate sequenceDiagram with Client, Gateway, Service, Database

User: "Architecture diagram for a microservices platform"

Action: Load 12-SOLUTION-ARCHITECTURE-GUIDE.md, generate flowchart with ELK, using service/data/infra colors

User: "What diagram should I use for showing order states?"

Action: Recommend State Diagram, load 05-STATE-DIAGRAM-GUIDE.md

User: "I need to show project milestones"

Action: Load 07-GANTT-GUIDE.md, generate gantt with milestones

User: "Visualize this RDF ontology"

Action: Load 17-LINKED-DATA-GUIDE.md, generate flowchart LR with ELK, class/instance/literal colors

User: "Show a Neo4j social network model"

Action: Load 18-PROPERTY-GRAPH-GUIDE.md, generate flowchart with labeled relationships (:KNOWS, :FOLLOWS)

User: "Generate a DOT graph from this Turtle data"

Action: Load 19-DOT-GRAPHVIZ-GUIDE.md, generate DOT digraph with semantic colors

User: "I need a pure network graph visualization"

Action: Load 19-DOT-GRAPHVIZ-GUIDE.md, generate DOT with layout attributes


Default Behaviors

  • ELK layout: Enable for >10 nodes or dense connections
  • LR direction: Use for semantic/knowledge graphs (S-P-O structure)
  • Semantic colors: Apply consistently from Cagle palette above
  • Accessibility: Always include accTitle and accDescr
  • Namespaces: Document as comments (%% @prefix ex: <...>)
  • Ambiguity: Ask user to clarify rather than guess

Post-Creation Export Workflow (MANDATORY)

CRITICAL: After creating or editing ANY mermaid/DOT diagram in a markdown document, you MUST run the export command to render the diagram to an image. This is NOT optional.

Automatic Export Rule

ALWAYS run the export command immediately after:

  • Adding a new mermaid or DOT code block to a document
  • Modifying an existing diagram in a document
  • Replacing ASCII art with a mermaid/DOT diagram

DO NOT leave mermaid code blocks unrendered in documents. The final document must contain:

  1. The rendered image (PNG/SVG)
  2. The source code in a collapsible <details> block

Export Commands

For Mermaid diagrams (```mermaid blocks):

node ~/.claude/tools/mermaid-renderer/process-document.js <document-path> --verbose

For DOT/Graphviz diagrams (```dot, ```graphviz, ```gv blocks):

node ~/.claude/tools/dot-renderer/process-document.js <document-path> --verbose

Result Structure

document.md
diagrams/
└── document/
    ├── diagram-1.svg
    ├── architecture-overview.svg
    └── data-flow.svg

What Export Does

  1. Extracts all diagram code blocks from the document
  2. Renders each to SVG in diagrams/{document-name}/
  3. Replaces code blocks with image references: ![name](diagrams/doc/name.svg)
  4. Preserves original code in <details> block for future editing

Post-Export Document Format

<!-- Before -->
` ``mermaid
flowchart LR
    A --> B
` ``

<!-- After -->
![diagram-1](diagrams/document/diagram-1.svg)

<details>
<summary>Mermaid Source</summary>

` ``mermaid
flowchart LR
    A --> B
` ``

</details>

Re-editing Workflow

  1. Find the <details> block containing the mermaid source
  2. Copy the mermaid code block above the image reference
  3. Edit the diagram
  4. Re-run the export command
  5. New SVG replaces the old one, <details> block is updated

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

90/100Analyzed 2/25/2026

Highly comprehensive diagramming skill with excellent structure, decision tables, color palettes, and accessibility guidance. Covers Mermaid and DOT/Graphviz comprehensively with clear routing logic, configuration examples, and quality checklist. Located in dedicated skills folder with good metadata. Minor扣分 for referencing external guides that may not be present. Overall excellent reusable technical reference."

100
90
90
88
92

Metadata

Licenseunknown
Version-
Updated2/19/2026
Publishersparkling

Tags

apici-cddatabasegithubgithub-actionsllmsecuritytesting