Diagramagic – Création de diagrammes SVG

VérifiéSûr

Générez et éditez des diagrammes SVG à l'aide de svg++ et de l'outil CLI diagramagic. Idéal pour créer des diagrammes riches et détaillés.

Spar Skills Guide Bot
DeveloppementIntermédiaire
2024/07/2026
Claude Code
#svg-diagrams#auto-layout#visualization#graph-layout#diagramming

Recommandé pour

Notre avis

Cette compétence permet de générer et modifier des diagrammes SVG en utilisant le langage svg++ et l'outil CLI diagramagic, avec des extensions de mise en page automatique.

Points forts

  • Simplifie la création de diagrammes complexes en automatisant le positionnement et le routage.
  • Support de plusieurs types de mise en page (flex, graph avec layouts hiérarchiques, radiaux, circulaires).
  • Permet des diagrammes riches avec texte multiligne, flèches étiquetées et inclusion de sous-fichiers.
  • Flux de travail itératif avec rendu PNG pour vérification avant compilation SVG finale.

Limites

  • Nécessite que Graphviz soit installé pour les layouts circulaires et radiaux.
  • Les fichiers SVG peuvent devenir volumineux avec de nombreuses inclusions et sous-graphes.
  • Courbe d'apprentissage pour maîtriser la syntaxe svg++ et les règles de mise en page.
Quand l'utiliser

Utilisez cette compétence lorsque vous devez créer des diagrammes techniques détaillés (architectures, flux, graphes de dépendances) où la mise en page automatique fait gagner du temps.

Quand l'éviter

Évitez-la pour des diagrammes très simples ou des croquis rapides où une saisie manuelle SVG serait plus rapide, ou si vous ne pouvez pas installer Graphviz.

Analyse de sécurité

Sûr
Score qualité88/100

The skill only instructs using the 'diagramagic' CLI tool with safe commands (cheatsheet, patterns, render, compile). No destructive actions, exfiltration, or arbitrary command execution are instructed.

Aucun point d'attention détecté

Exemples

Create a flowchart
Create a diagram showing the request flow from client to server with authentication and database. Use layered graph layout with ortho routing.
Design a system architecture
Design a system architecture diagram for a microservice application with a gateway, three services, and a message queue. Use flex layout for the overall structure and include detailed service cards.
Auto-layout dependency graph
Create a circular layout graph illustrating the dependency relationships between the modules in our application.

name: diagramagic description: Generate and edit SVG diagrams using svg++ and the diagramagic CLI allowed-tools: Bash(diagramagic *), Read, Write, Glob

diagramagic — svg++ Diagram Skill

Diagramagic helps LLMs create better, larger diagrams more easily by keeping SVG familiar and adding minimal layout extensions.

You generate diagrams using svg++ (SVG with diag: layout extensions) and the diagramagic CLI tool.

Setup (first use per session)

Run these commands and use their output as your syntax reference:

  • !diagramagic cheatsheet
  • !diagramagic patterns

Workflow (required)

  1. Create or edit a .svg++ file
  2. Run diagramagic render <file>.svg++ to generate PNG
  3. View the PNG to verify correctness
  4. If incorrect, fix the source and render again
  5. When satisfied, run diagramagic compile <file>.svg++ for final SVG

Quality Standard

You are writing SVG. The diag: extensions handle layout and sizing — they do not replace your responsibility to create rich, detailed, information-dense diagrams. Write with the same visual quality and detail you would if generating raw SVG. The diag: features save you from coordinate math, not from doing the actual design work.

Layout Rules

  • Use <diag:diagram> root with xmlns="http://www.w3.org/2000/svg" and xmlns:diag="https://diagramagic.ai/ns"
  • Use diag:flex for layout structure (stacks, rows, grids of cards) — but fill those containers with rich, detailed content
  • Use diag:graph for auto-layout when topology matters (flowcharts, dependency graphs) — but treat it as scaffolding, not the complete design
  • Choose graph layout deliberately:
    • layout="layered" for flowcharts, request pipelines, dependency chains
    • layout="radial" for hub-and-spoke systems
    • layout="circular" for peer/cyclic systems
  • Choose routing deliberately:
    • routing="auto" as default
    • routing="ortho"/"polyline" for dense technical diagrams where readability matters most
    • routing="curved" for lighter conceptual diagrams; avoid it for dense feedback-heavy graphs
  • Keep graph nodes content-rich (title + details), not just single-line labels
  • For title+body graph nodes, set diag:node gap="6" to gap="12" to avoid cramped text blocks
  • If graph output gets crowded, split into multiple subgraphs with diag:include or switch to a hybrid flex + arrows structure
  • Use diag:wrap="true" on <text> for multi-line text (wrapping is a text feature, not a diag:node feature)
  • Use diag:arrow with id-tagged elements for connectors
  • Use label-rotate="horizontal" for readable arrow/edge labels by default; use follow only when line-following text is intentionally desired
  • Use diag:anchor for precise named points (sequence diagrams, etc.)
  • Use diag:include to compose large diagrams from sub-files
  • Use diag:template when you have 3+ visually identical elements (e.g., entity cards, service boxes)
  • Mix raw SVG freely: <rect>, <line>, <circle>, <path> for decorative elements, region backgrounds, custom shapes
  • Do NOT stop at first compile — iterate until the render matches intent
  • layout="circular" and layout="radial" require system Graphviz (dot) on PATH; layered layout can fall back if unavailable

Error Recovery

  • E_PARSE_XML: fix malformed XML and retry
  • E_SVGPP_SEMANTIC: fix svg++ structure/ids and retry
  • E_INCLUDE_ID_COLLISION: rename conflicting ids between parent and included files
  • E_GRAPH_UNKNOWN_NODE: ensure every diag:edge from/to id exists as a diag:node in the same graph
  • E_GRAPH_SELF_EDGE: remove or redesign self-referential diag:edge (from == to)
  • E_GRAPH_TOO_LARGE: split the graph into smaller sections or compose with diag:include
  • Always attempt at least one fix before asking for help
Skills similaires