AgentSkillsCN

diagramming

适用于创建软件架构图、系统可视化或技术图纸。涵盖基于文本与可视化的架构沟通方式。 适用场景:图表类型的选择、图表工具的比较、架构可视化策略、以代码形式表达的图表工作流程、将图表嵌入文档中。 不适用场景:特定的图表语法(应使用 C4 图、Mermaid.js、UML、D2、PlantUML 等)、需求文档(应使用文档子技能)。

SKILL.md
--- frontmatter
name: diagramming
description: |
    Use when creating software architecture diagrams, system visualizations, or technical drawings. Covers text-based and visual diagramming approaches for architecture communication.
    USE FOR: choosing diagram types, comparing diagramming tools, architecture visualization strategy, diagrams-as-code workflows, embedding diagrams in documentation
    DO NOT USE FOR: specific diagram syntax (use c4-diagrams, mermaidjs, uml, d2, plantuml, etc.), requirements documents (use documentation sub-skills)
license: MIT
metadata:
  displayName: "Diagramming"
  author: "Tyler-R-Kendrick"
compatibility: claude, copilot, cursor

Diagramming

Overview

Architecture diagrams communicate system structure, behavior, and relationships visually. Modern "diagrams as code" tools let you version, diff, and automate diagram generation alongside your source code.

Diagram Types

Structural Diagrams

TypePurposeTools
C4 (Context, Container, Component, Code)Hierarchical system decompositionStructurizr DSL, Mermaid
Class diagramsObject structure and relationshipsUML, Mermaid, PlantUML
Component diagramsInternal structure of containersUML, C4 Level 3
Entity-Relationship (ERD)Data model relationshipsMermaid, dbdiagram.io
Package / Module diagramsCode organizationUML, Mermaid

Behavioral Diagrams

TypePurposeTools
Sequence diagramsInteraction order between actorsMermaid, PlantUML
Activity / FlowchartsProcess and decision flowsMermaid, D2, BPMN
State diagramsState machine transitionsMermaid, PlantUML
Functional / Data flowData transformation pipelinesDFD, Mermaid

Enterprise Architecture

TypePurposeTools
TOGAF ADM viewsEnterprise architecture phasesArchi, Sparx EA
ArchiMate modelsBusiness-application-technology layersArchi, Sparx EA

Diagrams-as-Code Tools

ToolLanguageRenderingBest For
MermaidMarkdown-like DSLSVG (browser, GitHub)Inline docs, PRs, wikis
D2Declarative DSLSVG, PNG, PDFArchitecture diagrams
PlantUMLText DSLPNG, SVGUML diagrams
Structurizr DSLC4-specific DSLSVG, PNGC4 model diagrams

Best Practices

  • Use "diagrams as code" tools (Mermaid, D2, PlantUML, Structurizr) so diagrams are version-controlled, diffable, and CI-renderable.
  • Start with C4 Level 1 (Context) to establish boundaries, then zoom in to Level 2 (Container) and Level 3 (Component) as needed.
  • Use Mermaid for diagrams inside Markdown files — GitHub, GitLab, and most documentation platforms render it natively.
  • Use D2 or Structurizr for standalone architecture diagrams that need advanced layout control.
  • Keep diagrams close to the code they describe — in the same repo, ideally the same directory.
  • Include a legend or title on every diagram so readers understand the notation without prior knowledge.