用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tools-only/X-Skills --skill diagram命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | diagram |
| context | fork |
| skill | diagram |
| model | opus |
| description | Generate architecture diagrams using Python diagrams library |
| tags | ["activity/architecture","domain/tooling","type/diagram"] |
Generate architecture diagrams in multiple formats (C4, System Landscape, Data Flow, AWS).
Use /diagram when you need to create or update architecture visualizations:
/diagram <type> [options]
| Type | Description | Use Case |
|---|---|---|
c4-context | C4 Level 1 - System context | Show external actors and system boundary |
c4-container | C4 Level 2 - System containers | Show major components (services, databases) |
c4-component | C4 Level 3 - Component level | Show detailed component interactions |
system-landscape | Enterprise system map | Show all systems and connections |
data-flow | Data movement diagram | Show how data moves through systems |
aws-architecture | AWS infrastructure | Show EC2, RDS, S3, networking |
integration-pattern | Integration architecture | Show message flows and patterns |
dependency-graph | System dependencies | Show what depends on what |
When invoked, the skill asks:
Diagram type (required)
Scope (required)
Systems to include (optional)
Styling preferences (optional)
Output format (optional)
python — PNG via Python diagrams library (default for AWS/landscape types)mermaid — Inline Mermaid (default for C4 types; renders natively in Obsidian)plantuml — C4-PlantUML with directional hints (for complex C4 layouts, >15 elements)/c4-diagram for data-driven generation from System note frontmatterOutput location (optional)
The skill generates a Python script using the diagrams package:
from diagrams import Diagram, Cluster, Edge
from diagrams.aws.compute import EKS, EC2
from diagrams.aws.database import RDS
from diagrams.aws.storage import S3
from diagrams.onprem.queue import Kafka
from diagrams.onprem.analytics import Spark
with Diagram("System Landscape", show=False, direction="TB"):
# Your architecture here
When generating Mermaid or PlantUML output (not Python):
For C4-specific layout guidance including iterative refinement and PlantUML directional hints, see the /c4-diagram skill.
The skill:
After rendering, validate against these criteria:
| Criterion | Target | How to Check |
|---|---|---|
| Edge crossings | <5 for complex, 0 for simple | Trace each relationship path visually |
| Visual hierarchy | System boundary most prominent | Is the boundary immediately identifiable? |
| Grouping | Related elements close together | Do tiers/layers appear as distinct groups? |
| Flow direction | Consistent L→R or T→B | Does data flow follow one direction? |
| Relationship traceability | Can follow each line | Trace each connection without confusion |
| Abstraction level | One level per diagram | No database tables on container diagrams |
If any criterion fails, revise the diagram before presenting to the user. For Mermaid: reorder declarations to match data flow. For PlantUML: add directional hints (Rel_Down, Lay_Right). See /c4-diagram skill for detailed refinement guidance.
| Scenario | Format | Reason |
|---|---|---|
| AWS infrastructure, cloud icons | python | Rich icon library, professional PNG output |
| System landscape, presentations | python | Best for standalone images and Confluence |
| Quick C4 diagram in Obsidian | mermaid | Native rendering, Git-friendly, fast iteration |
| C4 from System note frontmatter | mermaid | Use /c4-diagram for data-driven generation |
| Complex C4 with persistent crossings | plantuml | Directional hints fix crossings Mermaid cannot |
| >15 elements in a C4 diagram | plantuml | Layout control prevents chaos at scale |
| Formal documentation, PDF export | plantuml | Automatic legends, consistent server-side rendering |
/diagram c4-context
Scope: AlertHub (Data Integration Platform)
Systems: SAP, Kafka, Snowflake, Kong
Color scheme: classic
Output: Canvas - AlertHub C4 Context.md
Result: Creates Canvas - AlertHub C4 Context.md with C4 Level 1 diagram showing:
/diagram data-flow
Scope: SAP to Snowflake Real-time Integration
Systems: SAP, Kafka, AlertHub, Snowflake
Styling: vibrant
Output: Concept - SAP to Snowflake Real-time Flow.md
Result: Creates Concept - SAP to Snowflake Real-time Flow.md showing:
/diagram aws-architecture
Scope: Production Account (eu-west-1)
Systems: EKS, RDS, S3, ALB, Kafka
Color scheme: muted
Output: Canvas - Production AWS Architecture.md
Result: Creates Canvas - Production AWS Architecture.md showing:
The skill automatically:
Detects systems from context
Extracts data flows
Applies styling
Generates captions
Creates cross-references
/diagram <type> --style vibrant
classic - Traditional blues, grays, blacksmuted - Soft pastels, professionalvibrant - Bright colors, high contrastdark - Dark background, light text/diagram <type> --icons detailed
simple - Minimal icons, text-basedminimalist - Very simple, cleandetailed - Rich icons, realistic/diagram <type> --direction LR
TB - Top to Bottom (default)LR - Left to RightRL - Right to LeftBT - Bottom to Top/diagram <type> --metrics yes
/diagram system-landscape --criticality critical
critical - Critical systems onlyhigh - High + Criticalmedium - Medium and aboveall - All systemsThe skill generates:
type: Canvas
title: "System Landscape"
diagramType: system-landscape
scope: Enterprise
systems: [SAP, AlertHub, Snowflake, Kong, AWS]
latencyTarget: null
refreshedDate: 2026-01-14
Each generated diagram includes:
# Quality Indicators
confidence: high # Auto-generated from current data
freshness: current # Just generated
source: synthetic # Generated from note metadata
verified: false # Needs manual review
reviewed: null
Diagrams are regenerated:
/diagram command/diagram --refresh)To refresh existing diagram:
/diagram refresh Canvas - System Landscape.md
The /diagram skill works with:
/system - Links diagrams to system notes/integration - Shows data flows from integration specs/architecture - Includes in HLD documentation/scenario-compare - Generates before/after diagrams/impact-analysis - Shows affected systemsIf diagram generation fails:
These Canvas files were generated using the /diagram skill:
[[Canvas - System Landscape]] - All enterprise systems[[Canvas - C4 Context Diagram]] - AlertHub context[[Canvas - Data Flow Diagram]] - SAP to Snowflake flow[[Canvas - AWS Architecture]] - Production infrastructure[[Canvas - Scenario Comparison]] - Scenario alternativesAfter creating a diagram:
--style, --icons, --direction/canvas-annotate skill/scenario-compare/c4-diagram - Data-driven C4 diagram generation from System note frontmatter (Mermaid, flowchart, or PlantUML)/diagram-review - Analyse existing diagrams for readability and architecture quality/scenario-compare - Compare diagrams for different scenarios/impact-analysis - Analyse impacts of changes shown in diagram/architecture-report - Generate report with diagrams/system-landscape - Alternative skill specifically for system maps/dependency-graph - Focus on dependencies and risks.claude/prompts/c4-mermaid-diagrams.md — Graph drawing theory, C4 templates, and Mermaid best practices[[Reference - C4 Diagrams with AI]] — Research-backed guide to readable C4 diagramsInvoke with: /diagram <type>
Example: /diagram c4-context → Prompts for scope and options → Generates diagram