๐ŸŽ Get the FREE AI Skills Starter Guide โ€” Subscribe โ†’
BytesAgainBytesAgain
๐Ÿฆ€ ClawHub

SVG Architecture Diagram

by @wujiaming88

Create professional, publication-quality technical architecture diagrams using pure SVG in HTML, then screenshot via Playwright. Produces crisp, pixel-perfec...

Versionv1.2.0
Downloads372
TERMINAL
clawhub install svg-architecture-diagram

๐Ÿ“– About This Skill


name: svg-architecture-diagram description: >- Create professional, publication-quality technical architecture diagrams using pure SVG in HTML, then screenshot via Playwright. Produces crisp, pixel-perfect diagrams with precise connection lines, color-coded modules, and clear text at any resolution. Use when: (1) user asks for a system architecture diagram, (2) user wants a technical component diagram or flow chart, (3) user needs a data flow or pipeline visualization, (4) any diagram requiring accurate text labels and precise connecting lines. Triggers: "architecture diagram", "ๆžถๆž„ๅ›พ", "ๆŠ€ๆœฏๆžถๆž„", "system diagram", "component diagram", "flow diagram", "ๆ•ฐๆฎๆตๅ›พ", "ๆจกๅ—ๅ›พ", "draw architecture", "็”ปๆžถๆž„ๅ›พ", "technical diagram". Prefer this over AI image generation for any diagram with text labels.

SVG Architecture Diagram

Create professional technical architecture diagrams using pure SVG, rendered to high-res PNG via Playwright.

Why SVG (not CSS positioning or AI image generation)

| Approach | Lines/Arrows | Text Quality | Precision | |----------|-------------|-------------|-----------| | SVG (this skill) | โœ… Perfect: , , | โœ… Crisp at any size | โœ… Pixel-perfect | | CSS absolute positioning | โŒ Hacky: borders, pseudo-elements | โœ… OK | โŒ Hard to align | | AI image generation | โŒ No control | โŒ Garbled text | โŒ No precision |

Quick Start

Step 1: Plan the diagram

Identify:

  • Modules โ€” group related components (color-coded)
  • Hierarchy โ€” top-to-bottom flow (user โ†’ core โ†’ subsystems โ†’ output)
  • Connections โ€” data flow (solid lines), feedback (dashed lines)
  • Step 2: Create the HTML file

    Write a single HTML file with an inline SVG. Standard canvas: 1600ร—1000px.

    
    
    
    
    
    
      
        
        
          
        
        
        
          
        
      

    Step 3: Build the diagram using these SVG patterns

    Filled header card (module title):

    
    ๐Ÿ”„ Module Name
    

    Outlined detail card (sub-component):

    
    Component Title
    Description line 1
    Metadata / specs
    

    Connection line (with arrow):

    
    

    Curved connection (L-shape or bend):

    
    

    Dashed feedback line:

    
    

    Connection label:

    label text
    

    Step 4: Screenshot with Playwright

    from playwright.sync_api import sync_playwright
    with sync_playwright() as p:
        browser = p.chromium.launch()
        page = browser.new_page(
            viewport={"width": 1600, "height": 1000},
            device_scale_factor=4,  # 4x ultra-high res (default)
        )
        page.goto("file:///path/to/diagram.html", wait_until="networkidle")
        page.wait_for_timeout(1500)
        page.screenshot(path="diagram.png", full_page=True)
        browser.close()
    

    Or use the bundled script: scripts/screenshot.py [output.png]

    Design System

    See references/design-system.md for the complete color palette, card styles, arrow markers, and text sizing rules.

    Critical Rules (prevent common issues)

    Text Overflow Prevention

    1. Max characters per line at font-size 11px โ‰ˆ 7px/char: - 300px container โ†’ max 37 chars - 340px container โ†’ max 43 chars - 440px container โ†’ max 57 chars 2. Long text โ†’ split into multiple elements with Y offset +15px each 3. Always leave 20px padding on each side of text inside cards 4. Test at 1x scale before generating final 4x screenshot

    Connection Line Rules

    1. Never use CSS for connections โ€” always SVG or 2. One per color โ€” define in , reference with marker-end 3. Straight lines when possible; use L-segments for bends 4. Avoid crossing lines โ€” rearrange layout if lines would cross 5. Label every connection โ€” brief verb/noun near the midpoint 6. โš ๏ธ Minimum 20px gap between vertically stacked cards โ€” Arrow markers are 8px long. If the gap between cards is less than 20px, the arrow will completely cover the line, making it look like "arrow only, no line". Use card height 34px + gap 22px = 56px per step. 7. Connection line length must be at least 17px โ€” This ensures 9px visible line + 8px arrow marker. Example: card bottom at y=324, next card top at y=346, line from y1=324 to y2=343 (19px). 8. Never make line length < marker size (8px) โ€” The line will be invisible.

    Layout Rules

    1. Top-to-bottom primary flow (input at top, output at bottom/right) 2. Left-right symmetry when possible 3. Group related modules vertically (e.g., memory layers stacked) 4. Minimum 20px gap between vertically stacked cards (see Connection Line Rules) 5. Color-code by function โ€” see design system for standard palette 6. Include a legend (bottom-right corner) explaining colors and line types 7. Include a title (top center) and source attribution (bottom center)

    Font Rules

    1. Font family: font-family="Inter, 'PingFang SC', 'Microsoft YaHei', sans-serif" โ€” set on root or first 2. Load Inter via Google Fonts in