Architecture Diagram Generation Skill
Create professional technical architecture diagrams, output as standalone HTML files containing inline SVG graphics and CSS styles.
Trigger Conditions
Proactively use this skill when users mention any of the following scenarios:
- "Draw an architecture diagram" / "Generate an architecture diagram" / "Draw a diagram"
- "System architecture" / "Deployment architecture" / "Technical architecture"
- "Draw a flowchart" / "Component relationship diagram" / "Topology diagram"
- "infrastructure diagram" / "architecture diagram"
- Users paste code and request architecture analysis
- Users describe system components and their relationships
Workflow
Step 1: Collect Information
If users do not provide a complete architecture description, proactively ask for the following information:
- What main components/services does the system include?
- Connection relationships and data flow between components?
- Which tech stacks and cloud services are used?
- Are there security groups, network partitions, or other boundaries?
If users provide code repositories or project files, analyze and extract architecture information automatically.
Step 2: Generate Architecture Diagram
Generate HTML files using this skill's design specifications and templates based on the collected information.
Step 3: Output Results
Output a complete
file that can be directly opened in a browser.
Design System
Theme System
Architecture diagrams support Dark and Light two themes, with one-click switching via the toggle button on the right side of the header. User preferences are saved to localStorage and automatically restored on next opening.
Implementation: CSS custom properties +
attribute switching. SVG elements adapt to themes via CSS classes (
,
,
,
,
).
Key Principles:
- Component stroke colors (cyan/green/purple/amber/rose/Orange) remain unchanged in both themes to ensure visual consistency
- Only switch basic colors such as background, text, grid, and borders
- Use CSS to achieve smooth switching animations
Dark Theme (Default)
Combines Cursor's warm dark background + Claude's warm white text. Warm and not cold,告别冷蓝色 slate.
| Element | Color |
|---|
| Page Background | (Warm near-black) |
| Card Background | |
| Mask Background | (Warm dark) |
| Border | (oklab warm border) |
| Primary Text | (Ivory warm white) |
| Secondary Text | (Warm silver) |
| Grid Line | |
| Arrowhead | |
Light Theme
Combines Claude's parchment
+ Airtable's dark navy text.
| Element | Color |
|---|
| Page Background | (Parchment) |
| Card Background | rgba(250, 249, 245, 0.85)
|
| Mask Background | (Ivory) |
| Border | (Warm cream) |
| Primary Text | (Warm near-black) |
| Secondary Text | (Olive gray) |
| Grid Line | (Warm cream) |
| Arrowhead | (Lime gray) |
Component Color Scheme
Use semantic colors by component type:
| Component Type | Fill Color (rgba) | Stroke Color | Typical Use Cases |
|---|
| Frontend | | (Cyan) | Client applications, UI, browsers |
| Backend | | (Emerald green) | Servers, APIs, microservices |
| Database | | (Purple) | Databases, storage, caching |
| Cloud Services | | (Amber) | AWS/AliCloud/Tencent Cloud services |
| Security Components | | (Rose red) | Authentication, security groups, encryption |
| Message Queue | | (Orange) | Kafka, RabbitMQ, event buses |
| External/General | | (Slate gray) | External systems, third-party services |
| AI/Intelligent | | (Bright purple) | AI services, LLM, models |
Font Specifications
All text uses JetBrains Mono monospaced font (technical style):
html
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
Typesetting specifications (refer to Cursor's compact spacing + Claude's loose line height):
- Title: ,
- Subtitle:
- Font sizes: 12px for component names, 9px for sub-labels, 8px for comment text, 7px for tiny labels
Visual Elements
Background: Dark mode
(Warm near-black) / Light mode
(Parchment), with subtle grid texture:
svg
<pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
<path d="M 40 0 L 0 0 0 40" fill="none" class="grid-line" stroke-width="0.5"/>
</pattern>
Component Boxes: Rounded rectangles (
), 1.5px stroke, semi-transparent fill.
Shadow System (Claude ring shadow + Cursor ambient):
- Dark mode:
rgba(0,0,0,0.14) 0px 4px 16px, rgba(38,37,30,0.1) 0px 0px 0px 1px
- Light mode:
rgba(0,0,0,0.05) 0px 4px 24px, rgba(38,37,30,0.08) 0px 0px 0px 1px
Rounded Corner System:
- Component boxes: (Cursor standard)
- Card/diagram containers: (Airtable button / Claude comfortable rounded corners)
- Label badges: (Webflow compact)
Security Groups: Dashed stroke (
), transparent fill, rose red.
Area Boundaries: Large dashed stroke (
), amber,
.
Arrows: Define arrowheads using SVG marker:
svg
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" class="arrowhead-color" />
</marker>
Arrow Hierarchy (Z-order): Connection arrows should be drawn earlier in the SVG (after the background grid), so they render beneath component boxes. SVG elements are drawn in document order.
Transparent Fill Mask Technique: Component boxes use semi-transparent fill, so arrows behind will show through. To completely cover arrows, draw an opaque background rectangle before the semi-transparent style rectangle. Use
to adapt to themes:
svg
<!-- Opaque background covers arrows (auto theme adaptation) -->
<rect x="X" y="Y" width="W" height="H" rx="6" class="mask-bg"/>
<!-- Semi-transparent style component overlayed on top -->
<rect x="X" y="Y" width="W" height="H" rx="6" fill="rgba(76, 29, 149, 0.4)" stroke="#a78bfa" stroke-width="1.5"/>
Authentication/Security Flows: Rose red dashed lines (
).
Message Queue/Event Bus: Small connection elements between components, orange (
stroke,
fill):
svg
<rect x="X" y="Y" width="120" height="20" rx="4" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1"/>
<text x="CENTER_X" y="Y+14" fill="#fb923c" font-size="7" text-anchor="middle">Kafka / RabbitMQ</text>
Spacing Rules
Key: Ensure correct spacing when stacking components vertically to avoid overlap:
- Standard Component Height: 60px for services, 80-120px for larger components
- Minimum Vertical Spacing Between Components: 40px
- Inline Connectors (Message Queue): Place in gaps between components, do not overlap
Example Layout:
Component A: y=70, height=60 → Ends at y=130
Gap: y=130 to y=170 → 40px gap, message queue placed at y=140 (20px height)
Component B: y=170, height=60 → Ends at y=230
Legend Placement
Key: Legends must be placed outside all boundary boxes (area boundaries, cluster boundaries, security groups).
- Calculate the end position of all boundaries (y coordinate + height)
- Place legends at least 20px below the lowest boundary
- Extend SVG viewBox height if needed
Page Layout Structure
- Header - Project title (with pulse indicator animation), subtitle
- Main SVG Architecture Diagram - Contained in a rounded border card
- Information Summary Cards - 3-card grid below the diagram, displaying key architecture details
- Footer - Minimized metadata line
Component Box Template
svg
<!-- Complete component box with theme adaptation -->
<rect x="X" y="Y" width="W" height="H" rx="6" class="mask-bg"/>
<rect x="X" y="Y" width="W" height="H" rx="6" fill="FILL_COLOR" stroke="STROKE_COLOR" stroke-width="1.5"/>
<text x="CENTER_X" y="Y+20" class="text-primary" font-size="11" font-weight="600" text-anchor="middle">Component Name</text>
<text x="CENTER_X" y="Y+36" class="text-secondary" font-size="9" text-anchor="middle">Technical Description</text>
Key: Use CSS classes instead of hard-coded color values to support theme switching:
- - Opaque mask background (Dark: , Light: )
- - Primary text (Dark: , Light: )
- - Secondary text (Dark: , Light: )
- - Grid line stroke
- - Arrowhead fill
- Component stroke colors and color labels (e.g., ) do not use classes, remain unchanged in both themes
Information Summary Card Template
html
<div class="card">
<div class="card-header">
<div class="card-dot COLOR"></div>
<h3>Card Title</h3>
</div>
<ul>
<li>- Key Point 1</li>
<li>- Key Point 2</li>
</ul>
</div>
Chinese Adaptation Rules
Text Typography
- All component labels, comments, and card content use Chinese
- Technical terms remain in English (e.g., PostgreSQL, Kubernetes, OAuth 2.0)
- No spaces between Chinese characters, add spaces between Chinese and English characters when mixing
Text Width
- Chinese characters are approximately twice as wide as English characters, component box widths need to be increased accordingly
- Recommended width for standard Chinese label components: 140-180px (110-140px for English)
- Use for center alignment
Diagram Title
- Header title format: "[Project Name] System Architecture" or "[Project Name] Deployment Architecture"
- Subtitle briefly describes system type and key features
Information Cards
- The three cards respectively display:
- Tech Stack Overview (core technology selection)
- Key Design Decisions (architecture characteristics)
- Security and Operation Key Points (security, monitoring, etc.)
Using Templates
Copy and customize the
template. Key customization points:
- Update and header text
- Adjust SVG viewBox dimensions as needed (default: )
- Add/remove/reposition component boxes
- Draw connection arrows between components
- Update the three summary cards
- Update footer metadata
Output Requirements
Always generate a standalone
file containing:
- Inline CSS (no external stylesheets except Google Fonts)
- CSS custom properties defining dual themes (dark/light)
- Inline SVG (no external images), SVG text uses CSS classes to adapt to themes
- Minimal JavaScript for theme switching and localStorage persistence
- Sun/moon icon toggle button on the right side of the header
- File can be directly opened in any modern browser
Common Architecture Type References
Web Application Architecture
Frontend framework + Backend API + Database + Cache + Authentication
Microservices Architecture
API Gateway + Multiple Microservices + Message Queue + Service Discovery + Distributed Database
Cloud-Native Architecture
CDN + Load Balancing + Container Orchestration + Cloud Database + Object Storage + Monitoring
Serverless Architecture
API Gateway + Function Compute + Cloud Database + Object Storage + Message Queue
Data Flow Architecture
Data Source + Data Collection + Stream Processing + Data Warehouse + Visualization