/svg-diagram
SVG diagramming conventions blending a technical look with CJK-friendly typography. Use when creating flowcharts, architecture diagrams, and similar SVG figures. For one-shot generation, prefer invoking it from a subagent so the main context does not have to carry this skill
$ npx -y skills add bybit-exchange/svg-diagram --skill svg-diagram --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/svg-diagram
Context preview
The summary Claude sees to decide when to auto-load this skill.
SVG diagramming conventions blending a technical look with CJK-friendly typography. Use when creating flowcharts, architecture diagrams, and similar SVG figures. For one-shot generation, prefer invoking it from a subagent so the main context does not have to carry this skill
SKILL.md
svg-diagram.SKILL.mdname: svg-diagram
description: SVG diagramming conventions blending a technical look with CJK-friendly typography. Use when creating flowcharts, architecture diagrams, and similar SVG figures. For one-shot generation, prefer invoking it from a subagent so the main context does not have to carry this skill plus the SVG XML; for multi-round tweaking, use it directly in the main context.
SVG Diagramming Conventions
Output location and referencing
> Diagrams go in SVG, never ASCII art. That rule decides *whether* to draw; this skill covers *how*, starting with where the file lands.
- Put the file in an `assets/` directory next to the document (e.g. `docs/foo.md` → `docs/assets/foo-arch.svg`)
- Reference it from markdown with a relative path, ``. Do not inline SVG XML.
- When data in the document changes, the corresponding SVG must be updated too. A figure that contradicts the prose beside it is worse than no figure
Core principles
Get it right on the first pass
The first SVG you generate must already satisfy every item in the verification checklist at the end of this document. Do not rely on user feedback to fix basic layout problems (spacing, padding, alignment, viewBox clipping). After generating, walk the checklist yourself and fix anything you find before showing the result.
No overlapping elements
- Text must not sit on top of boxes or lines
- Lines must not cut through boxes (unless the line is an arrow terminating at that box)
- Keep 10–20px between text and lines
- **For spacing between sibling/adjacent boxes see the "Block spacing" section below** (single standard: ≥25px, 25–30px recommended)
- Put color-key legends outside the diagram body (bottom or side), never overlapping the content area
<!-- ✅ Correct: label sits beside the line -->
<path d="M35,200 C 35,120 ..." .../>
<text x="55" y="200">Label text</text> <!-- 20px clearance -->
<!-- ❌ Wrong: label sits on the line -->
<text x="35" y="200">Label text</text>
Visual balance
The left and right halves should carry similar visual weight; add or remove annotation boxes to even them out.
Layout rules
Centering
content width = right edge of rightmost element - left edge of leftmost element
left margin = (viewBox width - content width) / 2
**Center the title on the *content* center, not the viewBox center** (they differ whenever the content is asymmetric):
<!-- content center = (content left edge + content right edge) / 2 -->
<text x="[content center x]" y="[top_padding + font_ascent]" text-anchor="middle">Title</text>
Only when the content is left-right symmetric does `content center x = viewBox width / 2`. When it is asymmetric, center the whole group with `<g transform="translate(...)">` and update the title's `x` to the new content center as well.
Shifting everything after the fact
If you only notice asymmetric left/right (or top/bottom) padding after the SVG is finished, you do not need to touch every coordinate. Wrap the content in one `<g transform="translate(dx, dy)">`:
<svg viewBox="0 0 800 460" ...>
<defs>...</defs>
<g transform="translate(22, 0)">
<!-- all content here, coordinates unchanged -->
</g>
</svg>**Computing the offset**: `dx = (right padding - left padding) / 2`, where padding is the distance from the viewBox edge to the nearest content element.
- `dx > 0`: shift content right (use when content sits too far left)
- `dx < 0`: shift content left (use when content sits too far right)
When to use it: the content as a whole is off-center and you do not want to edit every `x` coordinate. Downside: the coordinates in the file no longer equal rendered positions, so later edits require mentally subtracting the offset — if a larger layout rework is coming, fold the offset into the individual coordinates and drop the `<g>`.
viewBox margins
The title is part of the content, so top and bottom margins are measured from the title:
title y = margin + font ascent (≈ font-size × 0.75)
viewBox height = bottom y of content + margin
**Recommended margin**: 20–25px
<!-- Example: 16px title, 20px margin -->
<!-- title y = 20 + 16×0.75 ≈ 32 -->
<!-- content bottom 270px, viewBox height = 270 + 25 = 295 -->
<svg viewBox="0 0 680 295" ...>
<text x="340" y="32" font-size="16">Title</text>
...
</svg>
Box layout
- Boxes in the same row differ in size by ≤60px; text is centered (`text-anchor="middle"`)
- Boxes in the same column share a center line
- An outer box fully encloses the inner boxes: `outer size = content size + padding × 2`
Dashed grouping boxes (containers)
Used to group related boxes together (e.g. "Server", "Client", "Employee instances").
**Style consistency**: within one diagram, every dashed grouping box must share these attributes:
- `stroke-dasharray` (recommended `6,4`)
- `rx` (corner radius, recommended 8–12)
- `fill` (recommended `#f8fafc` or `none`)
- Inner padding (recommended 15–20px)
- Title font size (recommended 11px, to distinguish it from the 12px box body text)
**Title placement**: put the group title inside the top-left corner of the box (`x = box x + 10, y = box y + 14`) using the secondary text color `#64748b`.
**Vertical-centering trap**: compute the group box's vertical position from the combined height of **title + inner content**, not from the box alone. With a title, the top of the box is occupied for roughly 20–25px, and inner boxes start below it:
<!-- ✅ Group box: title + content laid out as a whole -->
<!-- box top y=100, title takes 20px, inner boxes start at y=125 -->
<rect x="50" y="100" width="200" height="120" rx="10"
stroke="#94a3b8" stroke-dasharray="6,4" fill="#f8fafc"/>
<text x="60" y="114" font-size="11" fill="#64748b">Server</text>
<!-- inner boxes -->
<rect x="65" y="125" width="170" height="36" rx="6" .../>
<rect x="65" y="170" width="170" height="36" rx="6" .../>**Connectors point
Read more
name: svg-diagram description: SVG diagramming conventions blending a technical look with CJK-friendly typography. Use when creating flowcharts, architecture diagrams, and similar SVG figures. For one-shot generation, prefer invoking it from a subagent so the main context does not have to carry this skill plus the SVG XML; for multi-round tweaking, use it directly in the main context.
SVG Diagramming Conventions
Output location and referencing
> Diagrams go in SVG, never ASCII art. That rule decides *whether* to draw; this skill covers *how*, starting with where the file lands.
- Put the file in an `assets/` directory next to the document (e.g. `docs/foo.md` → `docs/assets/foo-arch.svg`)
- Reference it from markdown with a relative path, ``. Do not inline SVG XML.
- When data in the document changes, the corresponding SVG must be updated too. A figure that contradicts the prose beside it is worse than no figure
Core principles
Get it right on the first pass
The first SVG you generate must already satisfy every item in the verification checklist at the end of this document. Do not rely on user feedback to fix basic layout problems (spacing, padding, alignment, viewBox clipping). After generating, walk the checklist yourself and fix anything you find before showing the result.
No overlapping elements
- Text must not sit on top of boxes or lines
- Lines must not cut through boxes (unless the line is an arrow terminating at that box)
- Keep 10–20px between text and lines
- **For spacing between sibling/adjacent boxes see the "Block spacing" section below** (single standard: ≥25px, 25–30px recommended)
- Put color-key legends outside the diagram body (bottom or side), never overlapping the content area
<!-- ✅ Correct: label sits beside the line --> <path d="M35,200 C 35,120 ..." .../> <text x="55" y="200">Label text</text> <!-- 20px clearance --> <!-- ❌ Wrong: label sits on the line --> <text x="35" y="200">Label text</text>
Visual balance
The left and right halves should carry similar visual weight; add or remove annotation boxes to even them out.
Layout rules
Centering
content width = right edge of rightmost element - left edge of leftmost element left margin = (viewBox width - content width) / 2
**Center the title on the *content* center, not the viewBox center** (they differ whenever the content is asymmetric):
<!-- content center = (content left edge + content right edge) / 2 --> <text x="[content center x]" y="[top_padding + font_ascent]" text-anchor="middle">Title</text>
Only when the content is left-right symmetric does `content center x = viewBox width / 2`. When it is asymmetric, center the whole group with `<g transform="translate(...)">` and update the title's `x` to the new content center as well.
Shifting everything after the fact
If you only notice asymmetric left/right (or top/bottom) padding after the SVG is finished, you do not need to touch every coordinate. Wrap the content in one `<g transform="translate(dx, dy)">`:
<svg viewBox="0 0 800 460" ...>
<defs>...</defs>
<g transform="translate(22, 0)">
<!-- all content here, coordinates unchanged -->
</g>
</svg>**Computing the offset**: `dx = (right padding - left padding) / 2`, where padding is the distance from the viewBox edge to the nearest content element.
- `dx > 0`: shift content right (use when content sits too far left)
- `dx < 0`: shift content left (use when content sits too far right)
When to use it: the content as a whole is off-center and you do not want to edit every `x` coordinate. Downside: the coordinates in the file no longer equal rendered positions, so later edits require mentally subtracting the offset — if a larger layout rework is coming, fold the offset into the individual coordinates and drop the `<g>`.
viewBox margins
The title is part of the content, so top and bottom margins are measured from the title:
title y = margin + font ascent (≈ font-size × 0.75) viewBox height = bottom y of content + margin
**Recommended margin**: 20–25px
<!-- Example: 16px title, 20px margin --> <!-- title y = 20 + 16×0.75 ≈ 32 --> <!-- content bottom 270px, viewBox height = 270 + 25 = 295 --> <svg viewBox="0 0 680 295" ...> <text x="340" y="32" font-size="16">Title</text> ... </svg>
Box layout
- Boxes in the same row differ in size by ≤60px; text is centered (`text-anchor="middle"`)
- Boxes in the same column share a center line
- An outer box fully encloses the inner boxes: `outer size = content size + padding × 2`
Dashed grouping boxes (containers)
Used to group related boxes together (e.g. "Server", "Client", "Employee instances").
**Style consistency**: within one diagram, every dashed grouping box must share these attributes:
- `stroke-dasharray` (recommended `6,4`)
- `rx` (corner radius, recommended 8–12)
- `fill` (recommended `#f8fafc` or `none`)
- Inner padding (recommended 15–20px)
- Title font size (recommended 11px, to distinguish it from the 12px box body text)
**Title placement**: put the group title inside the top-left corner of the box (`x = box x + 10, y = box y + 14`) using the secondary text color `#64748b`.
**Vertical-centering trap**: compute the group box's vertical position from the combined height of **title + inner content**, not from the box alone. With a title, the top of the box is occupied for roughly 20–25px, and inner boxes start below it:
<!-- ✅ Group box: title + content laid out as a whole -->
<!-- box top y=100, title takes 20px, inner boxes start at y=125 -->
<rect x="50" y="100" width="200" height="120" rx="10"
stroke="#94a3b8" stroke-dasharray="6,4" fill="#f8fafc"/>
<text x="60" y="114" font-size="11" fill="#64748b">Server</text>
<!-- inner boxes -->
<rect x="65" y="125" width="170" height="36" rx="6" .../>
<rect x="65" y="170" width="170" height="36" rx="6" .../>**Connectors point
A house style for hand-written SVG diagrams your agent can follow — the layout arithmetic, the colour system, and a zero-dependency linter that proves it did.

