> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kubiya.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Visualization Skill

> Create Mermaid diagrams including flowcharts, sequence diagrams, ER diagrams, and Gantt charts for visual data representation.

<CardGroup cols={2}>
  <Card title="Type" icon="tag">
    `data_visualization`
  </Card>

  <Card title="Engine" icon="diagram-project">
    Mermaid.js
  </Card>
</CardGroup>

**Purpose:** The Data Visualization skill enables agents to create professional diagrams and visualizations using Mermaid syntax, ideal for documentation, architecture diagrams, and data flows.

***

## Supported Diagram Types

<CardGroup cols={3}>
  <Card icon="diagram-project">
    **Flowcharts**

    Process flows, decision trees, algorithm diagrams
  </Card>

  <Card icon="timeline">
    **Sequence Diagrams**

    API interactions, communication flows, protocols
  </Card>

  <Card icon="sitemap">
    **Class Diagrams**

    Object models, database schemas, UML diagrams
  </Card>

  <Card icon="circle-nodes">
    **State Diagrams**

    State machines, workflow states, transitions
  </Card>

  <Card icon="database">
    **ER Diagrams**

    Database relationships, entity models
  </Card>

  <Card icon="calendar-days">
    **Gantt Charts**

    Project timelines, task schedules, milestones
  </Card>
</CardGroup>

***

## Configuration

**Example Configuration:**

```json theme={null}
{
  "enable_flowchart": true,
  "enable_sequence": true,
  "enable_er_diagram": true,
  "output_format": "svg",
  "theme": "default",
  "output_directory": "/opt/diagrams"
}
```

<AccordionGroup>
  <Accordion title="📋 Full Configuration Reference" icon="gear">
    | Parameter              | Type    | Default     | Description                   |
    | ---------------------- | ------- | ----------- | ----------------------------- |
    | `enable_flowchart`     | boolean | true        | Allow flowchart diagrams      |
    | `enable_sequence`      | boolean | true        | Allow sequence diagrams       |
    | `enable_class_diagram` | boolean | true        | Allow class diagrams          |
    | `enable_state_diagram` | boolean | true        | Allow state diagrams          |
    | `enable_er_diagram`    | boolean | true        | Allow ER diagrams             |
    | `enable_gantt`         | boolean | true        | Allow Gantt charts            |
    | `output_format`        | string  | "svg"       | Output format (svg, png, pdf) |
    | `max_diagram_size`     | number  | 10000       | Max characters in diagram     |
    | `theme`                | string  | "default"   | Mermaid theme                 |
    | `output_directory`     | string  | "/diagrams" | Where diagrams are saved      |
  </Accordion>

  <Accordion title="🎨 Available Themes" icon="palette">
    * **Default**: Standard Mermaid theme with blue accents
    * **Dark**: Dark background for dark mode documentation
    * **Forest**: Green color scheme, professional look
    * **Neutral**: Minimal black and white design
  </Accordion>
</AccordionGroup>

***

## Quick Start

```bash theme={null}
# Create skill
kubiya skill create --name "Diagram Generator" --type data_visualization --enabled

# Associate with agent
kubiya skill associate agent <agent-id> <skill-id>
```

<Card title="View Complete Examples" icon="lightbulb" href="/core-concepts/skills/examples#architecture-diagrams">
  See full Mermaid examples, API flow diagrams, and database schema visualizations
</Card>

***

## Diagram Examples

### Flowchart

```mermaid theme={null}
flowchart TD
    A[Start] --> B{Is user logged in?}
    B -->|Yes| C[Show Dashboard]
    B -->|No| D[Show Login Page]
    D --> E[User enters credentials]
    E --> F{Valid credentials?}
    F -->|Yes| C
    F -->|No| G[Show Error]
    G --> D
```

**Agent Usage:**

```python theme={null}
diagram = """
flowchart TD
    A[Start] --> B{Is user logged in?}
    B -->|Yes| C[Show Dashboard]
    B -->|No| D[Show Login Page]
"""

create_diagram(diagram, "authentication-flow.svg")
```

### Sequence Diagram

```mermaid theme={null}
sequenceDiagram
    participant Client
    participant API
    participant Database

    Client->>API: POST /users
    API->>Database: INSERT user
    Database-->>API: User ID
    API-->>Client: 201 Created
```

**Use Case:** API interaction documentation, protocol design

### ER Diagram

```mermaid theme={null}
erDiagram
    USER ||--o{ ORDER : places
    USER {
        int id PK
        string email
        string name
    }
    ORDER ||--|{ ORDER_ITEM : contains
    ORDER {
        int id PK
        int user_id FK
        string status
    }
```

**Use Case:** Database schema design, data modeling

### Gantt Chart

```mermaid theme={null}
gantt
    title Project Development Timeline
    dateFormat YYYY-MM-DD

    section Planning
    Requirements Gathering     :done, 2024-01-01, 15d
    Design Architecture       :done, 2024-01-16, 15d

    section Development
    Backend API              :active, 2024-02-01, 30d
    Frontend UI              :2024-02-15, 25d
```

**Use Case:** Project planning, task scheduling

***

## Security Best Practices

<AccordionGroup>
  <Accordion title="Limit Diagram Size" icon="ruler">
    Set `max_diagram_size` to prevent resource exhaustion.

    ```json theme={null}
    "max_diagram_size": 10000  # Limit to 10K characters
    ```
  </Accordion>

  <Accordion title="Restrict Output Directory" icon="folder-lock">
    Specify `output_directory` to control where diagrams are saved.

    ```json theme={null}
    "output_directory": "/docs/diagrams"  # Controlled location
    ```
  </Accordion>

  <Accordion title="Validate Diagram Syntax" icon="shield-check">
    Validate Mermaid syntax before rendering to prevent malformed diagrams.
  </Accordion>
</AccordionGroup>

<Tip>
  **Tip:** Use SVG format for documentation - it scales perfectly and has smaller file sizes than PNG.
</Tip>

***

## Troubleshooting & Related Skills

<AccordionGroup>
  <Accordion title="Diagram Rendering Fails" icon="triangle-exclamation">
    **Solutions:**

    * Verify Mermaid syntax using [Mermaid Live Editor](https://mermaid.live)
    * Check diagram doesn't exceed `max_diagram_size`
    * Ensure diagram type is enabled in configuration
  </Accordion>

  <Accordion title="Output File Not Created" icon="file-slash">
    **Solutions:**

    * Verify `output_directory` exists and is writable
    * Check disk space: `df -h`
    * Ensure worker user has write permissions
  </Accordion>

  <Accordion title="Complex Diagrams Too Slow" icon="hourglass">
    **Solutions:**

    * Simplify diagram by breaking into multiple smaller diagrams
    * Use PNG instead of SVG for faster rendering
    * Reduce `max_diagram_size` to enforce smaller diagrams
  </Accordion>
</AccordionGroup>

### Related Skills

<CardGroup cols={2}>
  <Card title="File Generation" icon="file-code" href="/core-concepts/skills/file-generation">
    Generate reports that include diagrams
  </Card>

  <Card title="File System Skill" icon="folder-open" href="/core-concepts/skills/file-system">
    Manage diagram files and assets
  </Card>

  <Card title="Python Skill" icon="python" href="/core-concepts/skills/python">
    Process data before visualization
  </Card>

  <Card title="View All Skills" icon="layer-group" href="/core-concepts/skills/built-in-skills">
    Return to built-in skills overview
  </Card>
</CardGroup>

***

## Additional Resources

<CardGroup cols={2}>
  <Card title="Mermaid Documentation" icon="book" href="https://mermaid.js.org">
    Official Mermaid.js documentation and examples
  </Card>

  <Card title="Mermaid Live Editor" icon="pen-to-square" href="https://mermaid.live">
    Test and preview Mermaid diagrams online
  </Card>
</CardGroup>
