Add SVG Skill
Add SVG assets to draw.io research figures as evidence-aware visual elements,
not decorative stickers. This skill follows the nature-figure and
research-drawio-skill philosophy: establish the scientific message and visual
role first, decide the SVG source explicitly, then integrate only assets that
serve the diagram's logic and pass layout/export QA.
Mandatory Source Gate
Before doing any SVG search, drawing, download, file edit, or draw.io insertion,
ask exactly one blocking question and stop:
SVG 来源选择:网络搜索,还是自行绘制?
Do this on every invocation. Continue only after the user answers. The answer
sets source_mode:
network / 网络搜索: search the web for multiple SVG candidates.
self_design / 自行绘制: design new SVGs from vector primitives.
If the user already describes a preference in the same message, still confirm
briefly before execution unless the conversation already contains an explicit
answer to this exact source gate for the current invocation.
Routing Protocol
- Read manifest.yaml.
- Read every file listed under
always_load:
static/core/contract.md
static/core/stance.md
- Ask the mandatory source gate and wait for the user's answer.
- Load the reference file for the chosen mode:
- network search:
references/network-svg-search.md
- self design:
references/self-design-svg.md
- Load
references/drawio-svg-integration.md before editing .drawio.
- Load
references/svg-qa-contract.md before final delivery.
Core Workflow
After the source gate is answered, create a compact SVG contract:
Scientific message:
Target draw.io file:
SVG role:
Source mode:
Needed concepts:
Candidate plan:
Integration targets:
Style constraints:
License/provenance notes:
Fallback plan:
QA checks:
Network Mode
Search for multiple SVG candidates for each requested concept. Keep candidates
for later user selection rather than silently choosing one. For each candidate,
record:
- concept
- preview/name
- source URL
- direct SVG URL if available
- license or usage note
- style fit for Nature-style draw.io figures
- any required attribution
If no suitable SVG is found for a concept, mark it as self-designed fallback
and create a simple original SVG following references/self-design-svg.md.
Self-Design Mode
Create original SVGs from simple vector primitives. Keep them restrained,
editable, and compatible with draw.io. Use one neutral family, one signal
family, and one accent family. Avoid complex illustration, gradients, shadows,
bitmap effects, and decorative detail.
Draw.io Integration Rules
- Preserve the user's existing
.drawio content and layout.
- Insert SVGs as editable/vector-friendly draw.io image cells when possible.
- Encode SVG image values as draw.io-safe URL-encoded
data:image/svg+xml,
URIs. Do not use raw data:image/svg+xml;base64,... inside style=, because
the semicolon in svg+xml;base64 breaks mxGraph style parsing.
- Treat an inserted SVG as the visual glyph for that concept. Do not also draw
duplicate draw.io primitive glyphs for the same object unless the user asks for
a hybrid editable reconstruction.
- After SVG insertion, re-balance the layout and remove empty placeholder zones
so the figure remains compact rather than leaving the old self-drawn glyph
space unused.
- Keep SVG labels separate from the icon body unless text is a scientific mark.
- Match the diagram's grid, spacing, color semantics, and connector rules.
- Run available QA checks and export a draw.io PNG/SVG preview when
research-drawio-skill/scripts/export_drawio_preview.py is available. Do not
treat XML validity as sufficient for SVG insertion; the exported preview must
show the SVG assets rendered, nonblank, unclipped, and not overlapping labels.
Related Files
| File |
Open when |
references/network-svg-search.md |
User chooses network search |
references/self-design-svg.md |
User chooses self-designed SVGs or network search fails |
references/drawio-svg-integration.md |
Need to insert, encode, or edit SVGs in .drawio |
references/svg-qa-contract.md |
Before final delivery or candidate handoff |
scripts/svg_data_uri.py |
Need to convert a local SVG into a draw.io data URI |
1---2name: add-svg-23description: Add, collect, design, audit, and integrate SVG elements into editable diagrams.net/draw.io scientific figures. Use when the user asks to supplement a draw.io diagram with SVG icons, mechanisms, biological objects, model components, pathway symbols, instruments, graphical abstract elements, or publication-style vector assets. Every execution must first ask the user to choose the SVG source mode: network search or self-designed SVG. For network mode, search for multiple relevant SVG candidates for later user selection, record sources and license notes, and fall back to self-designed SVG for concepts with no suitable result. For self-design mode, create restrained, editable, Nature-style SVGs from simple vector primitives. Use with .drawio, SVG, diagrams.net, 科研流程图, 论文示意图, SVG补图, 图标补充, and draw.io配图.4---56# Add SVG Skill78Add SVG assets to draw.io research figures as evidence-aware visual elements,9not decorative stickers. This skill follows the `nature-figure` and10`research-drawio-skill` philosophy: establish the scientific message and visual11role first, decide the SVG source explicitly, then integrate only assets that12serve the diagram's logic and pass layout/export QA.1314## Mandatory Source Gate1516Before doing any SVG search, drawing, download, file edit, or draw.io insertion,17ask exactly one blocking question and stop:1819```text20SVG 来源选择:网络搜索,还是自行绘制?21```2223Do this on every invocation. Continue only after the user answers. The answer24sets `source_mode`:2526- `network` / `网络搜索`: search the web for multiple SVG candidates.27- `self_design` / `自行绘制`: design new SVGs from vector primitives.2829If the user already describes a preference in the same message, still confirm30briefly before execution unless the conversation already contains an explicit31answer to this exact source gate for the current invocation.3233## Routing Protocol34351. Read [manifest.yaml](manifest.yaml).362. Read every file listed under `always_load`:37 - `static/core/contract.md`38 - `static/core/stance.md`393. Ask the mandatory source gate and wait for the user's answer.404. Load the reference file for the chosen mode:41 - network search: `references/network-svg-search.md`42 - self design: `references/self-design-svg.md`435. Load `references/drawio-svg-integration.md` before editing `.drawio`.446. Load `references/svg-qa-contract.md` before final delivery.4546## Core Workflow4748After the source gate is answered, create a compact SVG contract:4950```text51Scientific message:52Target draw.io file:53SVG role:54Source mode:55Needed concepts:56Candidate plan:57Integration targets:58Style constraints:59License/provenance notes:60Fallback plan:61QA checks:62```6364## Network Mode6566Search for multiple SVG candidates for each requested concept. Keep candidates67for later user selection rather than silently choosing one. For each candidate,68record:6970- concept71- preview/name72- source URL73- direct SVG URL if available74- license or usage note75- style fit for Nature-style draw.io figures76- any required attribution7778If no suitable SVG is found for a concept, mark it as `self-designed fallback`79and create a simple original SVG following `references/self-design-svg.md`.8081## Self-Design Mode8283Create original SVGs from simple vector primitives. Keep them restrained,84editable, and compatible with draw.io. Use one neutral family, one signal85family, and one accent family. Avoid complex illustration, gradients, shadows,86bitmap effects, and decorative detail.8788## Draw.io Integration Rules8990- Preserve the user's existing `.drawio` content and layout.91- Insert SVGs as editable/vector-friendly draw.io image cells when possible.92- Encode SVG image values as draw.io-safe URL-encoded `data:image/svg+xml,`93 URIs. Do not use raw `data:image/svg+xml;base64,...` inside `style=`, because94 the semicolon in `svg+xml;base64` breaks mxGraph style parsing.95- Treat an inserted SVG as the visual glyph for that concept. Do not also draw96 duplicate draw.io primitive glyphs for the same object unless the user asks for97 a hybrid editable reconstruction.98- After SVG insertion, re-balance the layout and remove empty placeholder zones99 so the figure remains compact rather than leaving the old self-drawn glyph100 space unused.101- Keep SVG labels separate from the icon body unless text is a scientific mark.102- Match the diagram's grid, spacing, color semantics, and connector rules.103- Run available QA checks and export a draw.io PNG/SVG preview when104 `research-drawio-skill/scripts/export_drawio_preview.py` is available. Do not105 treat XML validity as sufficient for SVG insertion; the exported preview must106 show the SVG assets rendered, nonblank, unclipped, and not overlapping labels.107108## Related Files109110| File | Open when |111|---|---|112| `references/network-svg-search.md` | User chooses network search |113| `references/self-design-svg.md` | User chooses self-designed SVGs or network search fails |114| `references/drawio-svg-integration.md` | Need to insert, encode, or edit SVGs in `.drawio` |115| `references/svg-qa-contract.md` | Before final delivery or candidate handoff |116| `scripts/svg_data_uri.py` | Need to convert a local SVG into a draw.io data URI |