svg-primitives
Installation
SKILL.md
SVG Primitives
Build mm-precise SVG schematics in Python with three mechanical guarantees:
- Text never overflows its container — labeled shapes auto-size to fit measured text bbox + padding.
- Arrowheads stay tangent-correct — arrows emit
<marker orient="auto">so the renderer rotates the head along the path's terminal tangent; works on straight lines and cubic Beziers. - Paint order is deterministic — layers paint in registration order; connectors visibly pass under boxes without manual reordering.
The skill ships an end-to-end pytest suite (50+ tests) that renders SVGs and asserts these invariants on the rendered output, so the guarantees are enforced by construction rather than by hand-checking each figure.
When to use this skill
Reach for svg-primitives when:
- The figure is a schematic (boxes, arrows, labels) and you're driving it from Python — e.g. nodes come from a YAML config, or the layout depends on data.
- You need the boxes to auto-fit their labels (no hand-tuning widths).
- The figure has curved arrows that must point cleanly at their targets.
- You want deterministic z-order so connectors sit under shapes without manual element reordering.
- The output will be composed into a multi-panel figure as a panel SVG that
scientific-figure/compose.pyloads.