ASD

Beautiful Mermaid

Renderiza diagramas Mermaid como SVG y PNG usando la librería Beautiful Mermaid. Úsalo cuando el usuario pida renderizar un diagrama Mermaid.

Estrellas
281

en todo el repo

Actividad
28

0–100, la ruta de este skill

Actualizado
hace 6 meses

último commit aquí

Commits
0

últimos 90 días

Contexto
1.3k tok

32 tok en reposo

Paquete
4 archivos

19 KB

Instalar

Funciona con cualquier agente que lea SKILL.md

npx -y skills add intellectronica/agent-skills --skill beautiful-mermaid --agent claude-code

Se instala solo en este repositorio.

Este skill reads environment config.

Qué hace

  • Genera o valida código Mermaid y lo renderiza a SVG con scripts/render.ts
  • Crea un wrapper HTML del SVG para poder capturarlo
  • Usa agent-browser para capturar el diagrama como PNG en 4K
  • Elimina los archivos intermedios (HTML, .mmd temporales) al terminar

Úsalo cuando

  • El usuario pide renderizar un diagrama Mermaid
  • El usuario describe un diagrama y necesita el código Mermaid generado y renderizado

No lo uses cuando

    Qué lo activa

    Di cualquiera de estas frases y el agente debería cargar este skill.

    • Renderiza este diagrama Mermaid en SVG y PNG
    • Genera un diagrama de flujo Mermaid con tema tokyo-night
    • Convierte este flujo OAuth en un diagrama de secuencia Mermaid

    SKILL.md

    En inglés

    Beautiful Mermaid Diagram Rendering

    Render Mermaid diagrams as SVG and PNG images using the Beautiful Mermaid library.

    Dependencies

    This skill requires the agent-browser skill for PNG rendering. Load it before proceeding with PNG capture.

    Supported Diagram Types

    • Flowchart - Process flows, decision trees, CI/CD pipelines
    • Sequence - API calls, OAuth flows, database transactions
    • State - State machines, connection lifecycles
    • Class - UML class diagrams, design patterns
    • Entity-Relationship - Database schemas, data models

    Available Themes

    Default, Dracula, Solarized, Zinc Dark, Tokyo Night, Tokyo Night Storm, Tokyo Night Light, Catppuccin Latte, Nord, Nord Light, GitHub Dark, GitHub Light, One Dark.

    If no theme is specified, use default.

    Common Syntax Patterns

    Flowchart Edge Labels

    Use pipe syntax for edge labels:

    A -->|label| B
    A ---|label| B
    

    Avoid space-dash syntax which can cause incomplete renders:

    A -- label --> B   # May cause issues
    

    Node Labels with Special Characters

    Wrap labels containing special characters in quotes:

    A["Label with (parens)"]
    B["Label with / slash"]
    

    Workflow

    Step 1: Generate or Validate Mermaid Code

    If the user provides a description rather than code, generate valid Mermaid syntax. Consult references/mermaid-syntax.md for full syntax details.

    Step 2: Render SVG

    Run the rendering script to produce an SVG file:

    bun run scripts/render.ts --code "graph TD; A-->B" --output diagram --theme default
    

    Or from a file:

    bun run scripts/render.ts --input diagram.mmd --output diagram --theme tokyo-night
    

    Alternative runtimes:

    npx tsx scripts/render.ts --code "..." --output diagram
    deno run --allow-read --allow-write --allow-net scripts/render.ts --code "..." --output diagram
    

    This produces <output>.svg in the current working directory.

    Step 3: Create HTML Wrapper

    Run the HTML wrapper script to prepare for screenshot:

    bun run scripts/create-html.ts --svg diagram.svg --output diagram.html
    

    This creates a minimal HTML file that displays the SVG with proper padding and background.

    Step 4: Capture High-Resolution PNG with agent-browser

    Use the agent-browser CLI to capture a high-quality screenshot. Refer to the agent-browser skill for full CLI documentation.

    # Set 4K viewport for high-resolution capture
    agent-browser set viewport 3840 2160
    
    # Open the HTML wrapper
    agent-browser open "file://$(pwd)/diagram.html"
    
    # Wait for render to complete
    agent-browser wait 1000
    
    # Capture full-page screenshot
    agent-browser screenshot --full diagram.png
    
    # Close browser
    agent-browser close
    

    For even higher resolution on complex diagrams, increase the viewport further or use the --padding option when creating the HTML wrapper to give the diagram more space.

    Step 5: Clean Up Intermediary Files

    After rendering, remove all intermediary files. Only the final .svg and .png should remain.

    Files to clean up:

    • The HTML wrapper file (e.g., diagram.html)
    • Any temporary .mmd files created to hold diagram code
    • Any other files created during the rendering process
    rm diagram.html
    

    If a temporary .mmd file was created, remove it as well.

    Output

    Both outputs are always produced:

    • SVG: Vector format, infinitely scalable, small file size
    • PNG: High-resolution raster, captured at 4K (3840×2160) viewport with minimum 1200px diagram width

    Files are saved to the current working directory unless the user explicitly specifies a different path.

    Theme Selection Guide

    Theme Background Best For
    default Light grey General use
    dracula Dark purple Dark mode preference
    tokyo-night Dark blue Modern dark aesthetic
    tokyo-night-storm Darker blue Higher contrast
    nord Dark arctic Muted, calm visuals
    nord-light Light arctic Light mode with soft tones
    github-dark GitHub dark Matches GitHub UI
    github-light GitHub light Matches GitHub UI
    catppuccin-latte Warm light Soft pastel aesthetic
    solarized Tan/cream Solarized colour scheme
    one-dark Atom dark Atom editor aesthetic
    zinc-dark Neutral dark Minimal, no colour bias

    Troubleshooting

    Theme not applied

    Check the render script output for the bg and fg values, or inspect the SVG's opening tag for --bg and --fg CSS custom properties.

    Diagram appears cut off or incomplete

    • Check edge label syntax — use -->|label| pipe notation, not -- label -->
    • Verify all node IDs are unique
    • Check for unclosed brackets in node labels

    Render produces empty or malformed SVG

    • Validate Mermaid syntax at https://mermaid.live before rendering
    • Check for special characters that need escaping (wrap in quotes)
    • Ensure flowchart direction is specified (graph TD, graph LR, etc.)

    Reproducido de intellectronica/agent-skills bajo licencia CC0-1.0. Leer esta página en markdown.

    Archivos

    4 archivos en el paquete. Solo se lee SKILL.md al activarse — las referencias se cargan si el skill decide que las necesita.

    Antes de instalar

    Requiere el skill agent-browser para la captura PNG, además de bun (o npx tsx / deno) para ejecutar los scripts.

    Necesita en el PATH:bunnpx

    Variables de entorno:THEMES

    Detalles

    Categoría
    Diseño y UI
    Licencia
    CC0-1.0
    Recursos incluidos
    scripts en typescript + referencias
    Código fuente
    Ver SKILL.md

    Etiquetas

    Más de intellectronica/agent-skills

    Este repo incluye 22 skills. Si instalas uno, normalmente ya tienes los demás.

    Úsalo cuando el usuario quiera operar Google Workspace desde la línea de comandos con gog/gogcli: Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Apps Script, Chat, Classroom, Contacts, Tasks, Groups, Admin, Keep y auth.

    Costo de contexto al activarse
    2.2k tok
    Tamaño del paquete
    9 archivos
    Última actualización
    hace 3 meses
    automatizacion

    Úsalo para leer o buscar notas de Monologue mediante su API REST: autenticación con MONOLOGUE_API_KEY, listado, paginación, filtros y manejo de errores, todo por HTTP directo con curl.

    Costo de contexto al activarse
    1.4k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 3 meses
    desarrollo apis

    Ayuda con el trabajo del GitHub Copilot SDK en Node.js/TypeScript, Python, Go, .NET y Java: setup, autenticación, permisos, streaming, tools personalizadas, custom agents, servidores MCP, hooks, skills y persistencia de sesiones.

    Costo de contexto al activarse
    3.2k tok
    Tamaño del paquete
    5 archivos
    Última actualización
    hace 4 meses
    desarrollo apis

    Genera y edita imágenes con Nano Banana 2 (Gemini 3.1 Flash Image Preview) de Google, para iteración rápida y control de aspect-ratio y resolución de 512px a 4K.

    Costo de contexto al activarse
    977 tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 5 meses
    diseno ui

    Inicializa un repositorio git con instrucciones opcionales de commit para el agente y un .gitignore.

    Costo de contexto al activarse
    790 tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 6 meses
    herramientas desarrollo

    Instrucciones para interactuar con Todoist mediante la CLI td: operaciones CRUD sobre tareas, proyectos, secciones, etiquetas y comentarios, con confirmación previa a acciones destructivas.

    Costo de contexto al activarse
    2.3k tok
    Tamaño del paquete
    3 archivos
    Última actualización
    hace 6 meses
    productividad

    Skills relacionados

    Úsalo al completar tareas, implementar features mayores, o antes de mergear, para verificar que el trabajo cumple los requisitos.

    Costo de contexto al activarse
    739 tok
    Tamaño del paquete
    2 archivos
    Última actualización
    anteayer
    testing qa

    Úsalo antes de afirmar que un trabajo está completo, corregido o pasando, antes de hacer commit o crear PRs: exige ejecutar comandos de verificación y confirmar la salida antes de cualquier afirmación de éxito.

    Costo de contexto al activarse
    912 tok
    Tamaño del paquete
    1 archivo
    Última actualización
    el mes pasado
    testing qa

    Úsalo al empezar trabajo de feature que necesita aislamiento del workspace actual, o antes de ejecutar planes de implementación: asegura un workspace aislado vía herramientas nativas o fallback a git worktree.

    Costo de contexto al activarse
    1.7k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    el mes pasado
    herramientas desarrollo