⏳ This skill is pending AI review.
Scores will appear once the review pipeline completes.
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 plus the SVG XML; for multi-round tweaking, use it directly in the main context.
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
Not yet listed on ClawHub or SkillsMP
// README
svg-diagram
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.
Install
Paste this to your coding agent:
Install the svg-diagram skill from https://github.com/bybit-exchange/svg-diagram
for me by running: npx skills add bybit-exchange/svg-diagram -g
Or run it yourself:
npx skills add bybit-exchange/svg-diagram -g
The CLI detects which agents you have installed and writes each one's path. Drop -g to install into the current project instead.
| Surface | Path |
|---|---|
| Claude Code | ~/.claude/skills/svg-diagram/ |
| Codex, Cursor, Gemini CLI, Copilot, opencode, Antigravity | ~/.agents/skills/svg-diagram/ — they share one directory |
| Pi | ~/.pi/skills/svg-diagram/ |
| Windsurf, Continue, Roo, Goose, Kiro, Trae and 40+ more | ~/.<agent>/skills/svg-diagram/ |
| Claude.ai | Zip the folder and upload it under Settings → Capabilities → Skills (skill text only — svg-lint needs local Node) |
Every path is named from the skill's frontmatter name, not from where the skill sits here, so moving files in this repository doesn't change them.
SKILL.md is at the repository root, so the install copies the root and svg-lint comes along with the skill text. The linter has no dependencies, so it runs from wherever it landed:
node ~/.claude/skills/svg-diagram/tools/svg-lint/bin/svg-lint.mjs diagram.svg
If you only want the skill text, take the one file the agent reads:
mkdir -p ~/.claude/skills/svg-diagram
curl -fsSL https://raw.githubusercontent.com/bybit-exchange/svg-diagram/main/SKILL.md \
-o ~/.claude/skills/svg-diagram/SKILL.md
The skill works on its own that way; svg-lint is what you give up.
Then start a new session and ask for a diagram — the agent should announce that it's using svg-diagram.
Gallery
Ten diagrams, all drawn under this skill and all lint clean. Each one is here for the rule it demonstrates.
How an agent loads a skill
Two dashed containers side by side. Connectors cross the channel between them, and a colour change marks the point where a request matches.
The authoring loop
A cross-layer loop-back line, painted after the boxes so they don't cover it.
Where the lint gate sits
A self-call that leaves its lifeline and curves back to it, its second control point sharing the end point's y so the arrowhead closes level and points at the participant rather than down the lifeline.
From a data API to a document figure
CJK labels sized from the CJK column of the width table — one full font size per character, 12px rather than 7.
The life of a skill in this repo
One semantic colour triple per state. Each forward arrow carries the colour of the state it leaves.
What's in this repository
A dashed border only where the contents are actually drawn — gallery/ and assets/ are directories too, but their members aren't in the figure, so they stay plain boxes.
One command, every agent
A one-to-many fan-out whose branch curves keep each second control point level with the end point, so every arrowhead lands pointing right.
Why the font stack cannot be dropped
A contrast pair built from two semantic triples: the working paths in green, the branch that fails in pink.
Tiered model routing behind one gateway
A symmetric fan-out and convergence, one triple per tier. Only the middle leg leaves the rule box's bottom edge; the two outer ones leave its sides.
A/B benchmark with a model as judge
A dashed group box around exactly the steps that repeat. The return edge is painted last, so it stays legible where it crosses the wall.
What the skill pins down
| Area | What's pinned down |
|---|---|
| Layout | viewBox margins of 20–25px, the title centred on the content centre rather than the viewBox, and off-centre content shifted with a single <g transform="translate(dx,0)"> |
| Boxes | Height derived from the font — one line is font-size × 3, each extra line adds font-size × 1.5 — and boxes sharing a row whose sizes differ by no more than 60px |
| Connectors | A straight L only when the two ends are co-axial, a C or Q curve for anything that turns, and no right-angle elbows |
| Arrowheads | A notched marker with markerUnits="userSpaceOnUse", sized to the line's stroke width, starting 5px clear of the source and ending 11px short of the target |
| Text | Baseline at box y + height/2 + font-size × 0.35 to centre inside a box, and at least 10px of clearance from a straight connector — 15px from a curve, with the label above a downward bend and below an upward one |
| Fonts | 16px titles, 12px box text, 10px annotations, over a stack that keeps Noto Sans CJK SC so Linux rendering doesn't fall back to tofu |
| Colours | Five semantic fill/stroke/text triples applied through presentation attributes — no CSS classes, no media queries |
| Escaping | &, <, >, " and ' escaped in text and attributes, and anything from a database or an API escaped before it's concatenated into the file |
Every diagram also paints its own white canvas rect as the first element, so it reads as a light card on GitHub's dark theme instead of dark text on a dark background. That isn't theme switching. The diagram carries one colour set, and the rect exists only so that set stays readable wherever the file is embedded.
The full rules — the character width tables, the six arrowhead colour variants, the coordinate bookkeeping, and a twenty-item verification checklist — are in SKILL.md, which is the single source of truth.
Why
- Checked on the real artifact. The linter reads the finished SVG, not an intermediate format. Nothing sits between the receipt and the file you ship.
- Zero dependencies.
svg-lintis plain Node with no packages. It runs in a fresh clone, with no install step and no lockfile. - Placed, not auto-laid-out. The skill hands the agent the arithmetic — box height, baseline offset, arrow clearance, block spacing — so every element lands somewhere chosen rather than somewhere a layout engine picked.
- Findings name the fix. A failure reports the value it found and the value it should hold:
viewBox: 11 → 20–25, not "the margin looks wrong". - **
// HOW IT'S BUILT
// FILES
2 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.
SKILL.md7.9 KBupstream ↗
--- 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 ```xml <!-- ✅ 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): ```xml <!-- 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)">`: ```xml <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 ```xml <!-- 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: ```xml <!-- ✅ 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 pointing at a group**: when a connector logically targets a set of elements rather than one of them, terminate it on the group box boundary instead of on a single member. Alternatively, wrap the elements in a grouping box and point the arrow at that box. ### Box dimensions Derive box height from the font size so there is enough inner padding: | Content | Height formula | Example (12px font) | |---------|----------------|---------------------| | One line | font-size × 3 | 36px | | Two lines | font-size × 3 + line height | 36 + 18 = 54px | | Multiple lines | font-size × 3 + (lines - 1) × line height | +18px per extra line | **Where the formula comes from**: `font-size × 3 = top padding (≈font-size) + glyph height (≈font-size) + bottom padding (≈font-size)`. Scale the same ratio for non-standard font sizes. **Recommended line height**: font-size × 1.5 (e.g. 18px for a 12px font) ### Vertically centering text in a box (baseline positioning) In SVG, `<text y=...>` is the **baseline**, not the top of the glyph. To center text optically inside a box: ``` text y = box center y + font-size × 0.35 = box y + box height/2 + font-size × 0.35 ``` The 0.35 factor is an empirical value for "optical glyph center to baseline" (roughly one third of the font size). **Keep the two factors apart**: - `font-size × 0.75` (ascent): for elements **positioned from the top**, such as titles (y = top_padding + ascent) - `font-size × 0.35` (baseline offset): for **vertical centering inside a box** ```xml <!-- One line: height = 12 × 3 = 36px --> <rect x="30" y="50" width="110" height="36" rx="6" .../> <!-- y = 50 + 36/2 + 12×0.35 = 50 + 18 + 4.2 ≈ 72 --> <text x="85" y="72" ...>Single line</text> <!-- Two lines: height = 36 + 18 = 54px --> <rect x="30" y="50" width="110" height="54" rx="6" .../> <text x="85" y="70" ...>First line</text> <text x="85" y="88" ...>Second line</text> <!-- 18px apart --> ``` ### Display size ```xml <svg viewBox="0 0 750 400" width="750" xmlns="http://wwREADME.mdupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
Plain-text copy, no login: /skill-bundles/bybit-exchange-svg-diagram.md