meta-diagram-triangulation
GitHub扫描代码库并分类最佳图表类型,并行生成PlantUML源码与draw.io XML,最终合成架构文档。适用于RFC或入职文档,兼顾文本审查与可编辑视图需求。
Trigger Scenarios
Install
npx skills add opensquilla/opensquilla --skill meta-diagram-triangulation -g -y
SKILL.md
Frontmatter
{
"kind": "meta",
"name": "meta-diagram-triangulation",
"always": false,
"triggers": [
"diagram triangulation",
"triangulate diagrams",
"架构三视图",
"出双视图架构图"
],
"provenance": {
"origin": "opensquilla-original",
"license": "Apache-2.0"
},
"composition": {
"steps": [
{
"id": "scan_repo",
"kind": "agent",
"with": {
"task": "Scan the target path identified in the user's invocation for\narchitectural structure. Extract:\n * Top-level modules \/ packages under the target path\n * Inter-module import dependencies (who imports who)\n * Hotspot files (most-changed in the last 90 days)\n * Public surface: classes, functions, protocols exported via __init__.py\n\nUser invocation (target path is somewhere in this string):\n{{ inputs.user_message | xml_escape | truncate(400) }}\n\nReply with a structured summary, max 1500 chars:\n ## Target path\n <resolved absolute path>\n\n ## Modules (top-level)\n - <module\/>: <one-line description>\n\n ## Dependencies\n <module> → <module>\n ...\n\n ## Hotspots\n - <file>: <commit count last 90d>\n\n ## Public surface\n - <ClassName>: <one-line role>\n"
},
"skill": "history-explorer"
},
{
"id": "classify_kind",
"kind": "llm_classify",
"with": {
"task": "Based on this codebase scan, which diagram kind is most informative\nfor an architecture doc? Pick ONE of:\n - class: data structures \/ OO hierarchy dominant\n - sequence: cross-module call flows dominant\n - component: module-level boxes + arrows dominant\n - deploy: infra \/ process layout dominant\n - flow: data pipeline \/ staged processing dominant\n\nScan output:\n{{ outputs.scan_repo | truncate(1500) }}\n"
},
"depends_on": [
"scan_repo"
],
"output_choices": [
"class",
"sequence",
"component",
"deploy",
"flow"
]
},
{
"id": "render_plantuml",
"kind": "agent",
"with": {
"task": "Generate a PlantUML diagram source of kind `{{ outputs.classify_kind }}`\nfrom this codebase scan. Use idiomatic PlantUML syntax bracketed by\n`@startuml` ... `@enduml`. Aim for 10-20 boxes\/arrows; do not over-render.\n\nScan output:\n---\n{{ outputs.scan_repo | truncate(2000) }}\n---\n\nWrite the source to: `{{ inputs.workspace_dir }}\/diagrams\/arch.puml`\n(create parent dir if missing; overwrite OK).\n\nReply with the absolute output path on a single line, no preamble.\n"
},
"skill": "sub-agent",
"depends_on": [
"scan_repo",
"classify_kind"
]
},
{
"id": "render_drawio",
"kind": "agent",
"with": {
"task": "Generate a draw.io XML diagram of kind `{{ outputs.classify_kind }}`\nfrom this codebase scan. Use valid draw.io XML:\n <mxfile><diagram><mxGraphModel><root>\n <mxCell id=\"0\"\/><mxCell id=\"1\" parent=\"0\"\/>\n <mxCell id=\"N\" value=\"...\" style=\"...\" vertex=\"1\" parent=\"1\">\n <mxGeometry ...\/>\n <\/mxCell>\n <mxCell ... edge=\"1\" source=\"...\" target=\"...\" parent=\"1\">\n <mxGeometry ...\/>\n <\/mxCell>\n <\/root><\/mxGraphModel><\/diagram><\/mxfile>\n\nAim for 10-20 boxes\/edges to mirror the PlantUML side; layout can be\nsimple grid since the user is expected to re-arrange in draw.io.\n\nScan output:\n---\n{{ outputs.scan_repo | truncate(2000) }}\n---\n\nWrite the XML to: `{{ inputs.workspace_dir }}\/diagrams\/arch.drawio`\n(create parent dir if missing; overwrite OK).\n\nReply with the absolute output path on a single line, no preamble.\n"
},
"skill": "sub-agent",
"depends_on": [
"scan_repo",
"classify_kind"
]
},
{
"id": "compose_doc",
"kind": "agent",
"with": {
"task": "Compose an architecture document that references both diagram\ndeliverables. The doc body should contain three sections:\n\n1. **Scope** — restate the user's invocation target.\n User invocation: {{ inputs.user_message | xml_escape | truncate(200) }}\n2. **Diagram kind** — `{{ outputs.classify_kind }}` (one paragraph\n justifying why this kind was chosen).\n3. **Deliverables** — two bullet items linking the files:\n - PlantUML source: {{ outputs.render_plantuml }}\n - draw.io file: {{ outputs.render_drawio }}\n\nSave to: `{{ inputs.workspace_dir }}\/diagrams\/arch.docx`. Reply\nwith the absolute output path on a single line, no preamble."
},
"skill": "docx",
"depends_on": [
"render_plantuml",
"render_drawio"
]
},
{
"id": "persist",
"kind": "tool_call",
"tool": "memory_save",
"tool_args": {
"mode": "append",
"path": "memory\/architecture-snapshots.md",
"content": "=== diagram triangulation ===\ninvocation: {{ inputs.user_message | xml_escape | truncate(200) }}\ndiagram_kind: {{ outputs.classify_kind }}\nplantuml: {{ outputs.render_plantuml | truncate(200) }}\ndrawio: {{ outputs.render_drawio | truncate(200) }}\ndocx: {{ outputs.compose_doc | truncate(200) }}"
},
"depends_on": [
"compose_doc"
],
"tool_allowlist": [
"memory_save"
]
}
]
},
"description": "Scan a target codebase path, classify the most informative diagram kind, then render it as BOTH a PlantUML source file AND a draw.io XML in parallel, and compose them into a single architecture doc. Use when writing an RFC or onboarding doc and you want a text-friendly (PlantUML) and an editable (drawio) view of the same architecture.",
"meta_priority": 55
}
Diagram Triangulation (Meta-Skill)
A classifier + parallel render meta-skill. After scanning a target
path, an llm_classify step picks the most informative diagram kind
(one of class | sequence | component | deploy | flow), then two
independent render branches synthesize PlantUML source and draw.io
XML for the same scan — running in parallel because they are
independent tools serving different downstream uses (git-friendly text
review vs. editable canvas).
Trigger surface
Fire by saying diagram triangulation or one of the localized triggers listed
in the frontmatter, with the target path or module reference in the same turn.
Fallback
If either render step fails, compose_doc should still produce the
docx referencing whichever render succeeded; manually re-run the
failed render via sub-agent with the same scan output as input.
Version History
- 7f72a32 Current 2026-07-05 18:40


