Skip to content

Agent skill that turns natural language, code, Terraform/K8s, SQL, OpenAPI, AsyncAPI, Protobuf and GraphQL sources into editable, tested draw.io architecture diagrams: incremental sync, multi-view projection, drift diff, CI architecture tests, whiteboard derasterize, interactive HTML/PPTX/Mermaid exports.

feat: svgflow.py — animated data-flow SVG (v1.25.0) (#73)

Agents365.ai2ef573f1bcb2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c327037..c7ed5d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,20 @@ All notable changes to **drawio-skill** are documented here. The format is based
on [Keep a Changelog](https://keepachangelog.com/), and the project follows
semantic-ish versioning (the `version:` field in `skills/drawio-skill/SKILL.md`).
+## [1.25.0] — 2026-07-03
+### Added
+- **Animated data-flow SVG** (`scripts/svgflow.py`) — export a `.drawio` to SVG
+ and turn every edge into a marching-ants animation (dashes travel along each
+ connector in the arrow's direction), so the diagram shows data/flow moving
+ through it. Self-contained looping `.svg` that renders on GitHub and any
+ browser — good for a README, docs page, or slide background.
+ - `svgflow.py diagram.drawio -o flow.svg` (also takes an `.svg` directly);
+ `--speed` (seconds/cycle), `--dash` (pattern), `--reverse` (flow to source).
+ - Only real edges animate: draw.io marks connector lines with
+ `pointer-events="stroke"` (shape outlines / arrowheads use `="all"`), so
+ arrowheads and shapes stay static. SKILL.md router + READMEs updated.
+ Suite now 61.
+
## [1.24.0] — 2026-07-03
### Added
- **Diagram → PowerPoint** (`scripts/drawio2pptx.py`) — export a (multi-page)
diff --git a/README.md b/README.md
index 7eb0d86..1aead29 100644
--- a/README.md
+++ b/README.md
@@ -182,6 +182,9 @@ python3 scripts/explain.py architecture.drawio -o architecture.md
# Diagram → PowerPoint deck (one page per slide; C4 model → presentation)
python3 scripts/drawio2pptx.py c4.drawio -o c4.pptx # needs: pip install python-pptx
+# Animated data-flow SVG — edges "flow" (marching ants); renders on GitHub
+python3 scripts/svgflow.py architecture.drawio -o flow.svg
+
# any extractor → auto-layout → editable .drawio
python3 scripts/autolayout.py graph.json -o diagram.drawio
```
@@ -193,6 +196,7 @@ python3 scripts/autolayout.py graph.json -o diagram.drawio
| **Architecture time-lapse** | `timelapse.py` re-runs an importer across a repo's git history and assembles a self-contained HTML player — watch modules & edges appear over time (▶ play / ‹ › step) |
| **Diagram → Markdown** | `explain.py` reverses a `.drawio` into a structured description — components by tier, relations, per-page for C4 — for dropping an architecture summary into a README or PR |
| **Diagram → PowerPoint** | `drawio2pptx.py` turns a multi-page diagram into a 16:9 deck (one page per slide, page name as title) — a C4 model becomes a ready-to-present slideshow |
+| **Animated data-flow** | `svgflow.py` makes a diagram's edges *flow* (marching-ants animation along each arrow) — a self-contained looping SVG that renders on GitHub, in docs, or as a slide background |
| **Sequence engine** | `seqlayout.py` computes lifeline / activation-bar / arrow geometry from a message list — no Graphviz, no hand placement |
| **Auto-layout** | Graphviz places nodes and routes orthogonal edges *around* them — removes the manual-coordinate ceiling for large graphs. `--tune` tries both directions and keeps the more readable one |
| **Transitive reduction** | drops edges implied by a longer path, turning a dense hairball into a traceable graph (asyncio: 149 → 46 edges) |
diff --git a/README_CN.md b/README_CN.md
index 92e2925..8bdcbce 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -180,6 +180,9 @@ python3 scripts/explain.py architecture.drawio -o architecture.md
# 图 → PowerPoint 幻灯片(每页一张;C4 模型 → 演示稿)
python3 scripts/drawio2pptx.py c4.drawio -o c4.pptx # 需要: pip install python-pptx
+# 数据流动画 SVG —— 让边「流动」起来(marching ants);GitHub 可直接渲染
+python3 scripts/svgflow.py architecture.drawio -o flow.svg
+
# 任一提取器 → 自动布局 → 可编辑的 .drawio
python3 scripts/autolayout.py graph.json -o diagram.drawio
```
@@ -191,6 +194,7 @@ python3 scripts/autolayout.py graph.json -o diagram.drawio
| **架构时间轴** | `timelapse.py` 沿 git 历史逐个提交重跑提取器,拼成一个自包含 HTML 播放器 —— 看着模块和依赖边随时间长出来(▶ 播放 / ‹ › 单步) |
| **图 → Markdown** | `explain.py` 把一张 `.drawio` 反向描述成结构化文档 —— 按层级列出组件、关系、C4 多页分节 —— 方便把架构摘要塞进 README 或 PR |
| **图 → PowerPoint** | `drawio2pptx.py` 把多页图变成 16:9 幻灯片(每页一张、页名当标题)—— C4 模型一键变成可演示的 slideshow |
+| **数据流动画** | `svgflow.py` 让图里的边「流动」起来(沿箭头方向的 marching-ants 动画)—— 自包含循环 SVG,可在 GitHub、文档或幻灯片背景里直接播放 |
| **时序图引擎** | `seqlayout.py` 从消息列表直接算出 lifeline / 激活条 / 箭头几何 —— 不需要 Graphviz,不需要手摆 |
| **自动布局** | Graphviz 自动布点,正交连线**绕开**节点 —— 大图不再需要手动摆坐标。`--tune` 双向各排一次取更可读的 |
| **传递约简** | 删掉被更长路径蕴含的边,把密集的"毛线团"变成可读图(asyncio:149 → 46 条边) |
diff --git a/skills/drawio-skill/SKILL.md b/skills/drawio-skill/SKILL.md
index 56dd8c4..40be323 100644
--- a/skills/drawio-skill/SKILL.md
+++ b/skills/drawio-skill/SKILL.md
@@ -1,6 +1,6 @@
---
name: drawio-skill
-version: 1.24.0
+version: 1.25.0
description: Use when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, cloud architecture from Terraform or Kubernetes manifests, ML/DL model figures (Transformer/CNN/LSTM), mind maps, or any visualization. Also use proactively when explaining systems with 3+ components, complex data flows, or relationships that benefit from visual representation. Best suited when the diagram needs custom styling, rich shape vocabulary, swimlanes, or exportable images (PNG/SVG/PDF/JPG). Generates .drawio XML and exports locally via the native draw.io desktop CLI.
license: MIT
homepage: https://github.com/Agents365-ai/drawio-skill
@@ -53,6 +53,7 @@ When the workflow references one of these, read it on demand — none of them ne
| `scripts/timelapse.py` | The user wants an **architecture time-lapse / to see how a codebase's structure evolved over git history** — `timelapse.py <dir> --importer pyimports` re-runs an importer at each sampled commit and assembles a self-contained HTML player (embedded frames, play/step controls). Best on a package with real import edges (point `<dir>` at the module root) |
| `scripts/explain.py` | The user wants to **describe / document / summarize an existing `.drawio` in words** (reverse of generating one) — `explain.py diagram.drawio` emits structured Markdown: components grouped by container/tier, relations (`A —label→ B`), per-page sections for multi-page/C4. Good for a README/PR summary or a text-only read-out |
| `scripts/drawio2pptx.py` | The user wants a **PowerPoint deck / slides from a diagram** — `drawio2pptx.py diagram.drawio -o deck.pptx` puts each page on its own 16:9 slide (page name as title), so a multi-page **C4 model** becomes a ready-to-present deck. Needs `python-pptx` (`pip install python-pptx`) + the draw.io CLI |
+| `scripts/svgflow.py` | The user wants an **animated / "flowing" diagram** (data-flow, moving edges) — `svgflow.py diagram.drawio -o flow.svg` exports to SVG and makes every edge a marching-ants animation (dashes travel along the arrows). Self-contained looping `.svg` that renders on GitHub / any browser; `--speed` / `--dash` / `--reverse` |
| `scripts/sqlerd.py` | The user wants an **ER diagram from SQL DDL** — parses `CREATE TABLE` statements into per-table nodes (columns with PK/FK markers) and crow's-foot FK edges for autolayout |
| `scripts/seqlayout.py` | The user wants a **sequence diagram** — describe participants + messages as JSON and the script computes all lifeline/activation/arrow geometry deterministically (no hand-placed coordinates, no Graphviz needed) |
| `scripts/c4.py` | The user wants a **C4 model** (System Context / Container / Component) — levels JSON in, one multi-page `.drawio` out with official C4 shapes/colors and **click-to-drill-down** links between levels |
diff --git a/skills/drawio-skill/scripts/svgflow.py b/skills/drawio-skill/scripts/svgflow.py
new file mode 100644
index 0000000..288d0ed
--- /dev/null
+++ b/skills/drawio-skill/scripts/svgflow.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python3
+"""Make a diagram's edges *flow* — an animated data-flow SVG.
+
+Exports a .drawio to SVG (or takes an .svg directly) and turns every edge into a
+marching-ants animation: dashes travel along each connector in the direction of
+the arrow, so the diagram shows data/flow moving through it. The result is a
+single self-contained .svg that loops forever in any browser — nice for a README
+(GitHub renders SVG), a docs page, or a slide background.
+
+ python3 svgflow.py architecture.drawio -o architecture-flow.svg
+ python3 svgflow.py already-exported.svg -o flow.svg
+
+Edges are found by draw.io's own marker: connector *lines* carry
+`pointer-events="stroke"` (shape outlines and arrowheads use `="all"`), so only
+the real edges animate — arrowheads and shapes stay put. `--speed` sets seconds
+per cycle, `--dash` the dash pattern, `--reverse` flips the flow direction.
+
+Usage: python3 svgflow.py <file.drawio|file.svg> [-o out.svg]
+ [--speed SEC] [--dash "6 4"] [--reverse]
+"""
+import argparse
+import os
+import re
+import subprocess
+import sys
+import tempfile
+
+EDGE_PATH = re.compile(r'(<path )((?:(?!/?>)[^>])*pointer-events="stroke"(?:(?!/?>)[^>])*/?>)')
+
+
+def to_svg(path):
+ """Return SVG text for a .drawio (export via CLI) or .svg (read directly)."""
+ if path.lower().endswith(".svg"):
+ with open(path, encoding="utf-8") as f:
+ return f.read()
+ with tempfile.TemporaryDirectory() as tmp:
+ out = os.path.join(tmp, "d.svg")
+ r = subprocess.run(["drawio", "-x", "-f", "svg", "-o", out, path],
+ capture_output=True)
+ if r.returncode != 0 or not os.path.exists(out):
+ sys.exit("error: draw.io SVG export failed (is the draw.io CLI installed?)")
+ with open(out, encoding="utf-8") as f:
+ return f.read()
+
+
+def animate(svg, speed, dash, reverse):
+ """Tag edge paths and inject the flow keyframes. Returns (svg, edge_count)."""
+ svg, n = EDGE_PATH.subn(r'\1class="dio-flow" \2', svg)
+ # One dash+gap of travel per cycle => seamless loop. Reverse flips the sign.
+ period = sum(float(x) for x in dash.split()) or 10
+ offset = period if reverse else -period
+ style = (f"<style>.dio-flow{{stroke-dasharray:{dash};"
+ f"animation:dio-flow {speed}s linear infinite;}}"
+ f"@keyframes dio-flow{{to{{stroke-dashoffset:{offset:g};}}}}</style>")
+ svg = re.sub(r"(<svg\b[^>]*>)", r"\1" + style, svg, count=1)
+ return svg, n
+
+
+def main():
+ ap = argparse.ArgumentParser(description="Animate a diagram's edges into a flowing SVG.")
+ ap.add_argument("file", help=".drawio (exported to SVG) or an .svg")
+ ap.add_argument("-o", "--output", help="output .svg (default: <name>-flow.svg)")
+ ap.add_argument("--speed", type=float, default=1.2, help="seconds per flow cycle (default 1.2)")
+ ap.add_argument("--dash", default="6 4", help='dash pattern, e.g. "6 4" (default)')
+ ap.add_argument("--reverse", action="store_true", help="flow toward the source")
+ args = ap.parse_args()
+
+ if not os.path.isfile(args.file):
+ sys.exit(f"error: {args.file} not found")
+ svg = to_svg(args.file)
+ if "<svg" not in svg:
+ sys.exit("error: no <svg> element found in the exported output")
+ svg, n = animate(svg, args.speed, args.dash, args.reverse)
+ if n == 0:
+ sys.stderr.write("warning: no edges found to animate "
+ "(a diagram with no connectors?)\n")
+
+ out = args.output or os.path.splitext(args.file)[0] + "-flow.svg"
+ with open(out, "w", encoding="utf-8") as f:
+ f.write(svg)
+ sys.stderr.write(f"wrote {out} ({n} edge{'s' if n != 1 else ''} animated)\n")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tests/test_scripts.py b/tests/test_scripts.py
index 9b8641f..d3650e2 100644
--- a/tests/test_scripts.py
+++ b/tests/test_scripts.py
@@ -823,6 +823,31 @@ class TestImportersCli(unittest.TestCase):
prs = Presentation(out)
self.assertEqual(len(prs.slides), 1)
+ # An edge line (pointer-events=stroke), an arrowhead + a shape (both =all).
+ FLOW_SVG = (
+ '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="50">'
+ '<rect x="0" y="0" width="20" height="20" fill="#fff" pointer-events="all"/>'
+ '<path d="M 20 10 L 60 10" fill="none" stroke="#000" pointer-events="stroke"/>'
+ '<path d="M 60 10 L 55 7 L 55 13 Z" fill="#000000" pointer-events="all"/>'
+ "</svg>")
+
+ def test_svgflow_animates_only_edges(self):
+ sf = load("svgflow")
+ out, n = sf.animate(self.FLOW_SVG, 1.2, "6 4", reverse=False)
+ self.assertEqual(n, 1) # one edge line
+ self.assertIn("@keyframes dio-flow", out) # keyframes injected
+ self.assertIn("stroke-dashoffset:-10", out) # -(6+4) forward travel
+ self.assertEqual(out.count('class="dio-flow"'), 1)
+ # class is injected right after "<path " — only on the stroke edge
+ self.assertIn('<path class="dio-flow" d="M 20 10', out)
+ self.assertNotIn('<path class="dio-flow" d="M 60 10', out) # arrowhead untouched
+ self.assertNotIn('class="dio-flow"', out.split("<rect", 1)[1].split("/>", 1)[0])
+
+ def test_svgflow_reverse_flips_offset(self):
+ sf = load("svgflow")
+ out, _ = sf.animate(self.FLOW_SVG, 2, "8 2", reverse=True)
+ self.assertIn("stroke-dashoffset:10", out) # +(8+2), toward source
+
SQL = ("CREATE TABLE users (id INT PRIMARY KEY, email VARCHAR(255));\n"
"CREATE TABLE orders (\n"
" id INT,\n"