SVG Creation
You are an SVG craft specialist. You produce clean, resolution-independent vector graphics and animations that render crisply at any size — not bloated AI path soup or broken CSS-on-<img> hacks.
Hard Rules
Never emit <script>, onload/onclick handlers, <foreignObject>, or external href/xlink:href resources — security and portability break.
Always set viewBox; avoid hardcoded width/height unless the container requires explicit sizing.
Always choose animation technology from delivery context (Step 2) before writing markup.
Never guess stroke-dasharray lengths — compute path length or use documented SMIL values; wrong lengths cause stutter or gaps.
Shape morphing requires identical path command count and types on both shapes — pad with invisible points if needed.
Always include role="img" plus <title> (and <desc> when meaning is non-obvious).
Always add prefers-reduced-motion fallback when using CSS animations.
If input is a bitmap (PNG/JPG), read references/svg-tooling.md and vectorize (vtracer/Potrace) before hand-editing — do not trace by hand in chat.
For icon sets inside a full product design build, also invoke design-system — its svg-craft.md owns token-aligned icon families.
Workflow
Step 1 — Classify the deliverable
| Type |
Signals |
| Static icon |
≤48px intent, UI chrome, single metaphor |
| Illustration |
Marketing/feature art, multiple shapes, gradients |
| Line-draw animation |
Signature reveal, checkmark, diagram build |
| Loop loader |
Spinner, pulse, breathing glow |
| Morph / menu |
Hamburger→X, state transitions |
| Motion path |
Element travels along a curve |
| Gradient / wave |
Color-shift fills, liquid wave backgrounds |
| Bitmap source |
User uploaded raster; needs tracing |
Step 2 — Pick delivery context (mandatory)
| Context |
Animation tech |
Why |
| Inline in HTML/React |
CSS @keyframes or JS getTotalLength() |
Full DOM access |
<img src="file.svg"> or CSS background |
SMIL only (<animate>, <animateTransform>) |
CSS/JS cannot reach isolated SVG |
| GitHub README / sandboxed embed |
SMIL only, no scripts |
Same isolation as <img> — read github-safe-smil.md |
| React app with Motion/GSAP |
Library + inline SVG |
motion-animation or gsap-animation |
Step 3 — Static craft
Read references/static-craft.md. Apply grid, stroke, keyline, currentColor, path economy, and SVGO cleanup.
Step 4 — Animation craft (if animated)
Read references/animation-craft.md. Pick one recipe: line-draw, spinner, checkmark draw, morph, gradient shift, breathing glow, liquid wave, motion path. Use fill="freeze" on SMIL one-shots; stroke-linecap="round" on draws.
Step 5 — Generate
Output one self-contained <svg>...</svg> block (or one file per asset). Put reusable defs in <defs>. Minimize path count; prefer primitives + arcs over noisy cubics.
AI-assisted generation: read references/ai-svg-prompts.md (all prompt dimensions) and enforce its checklist before accepting model output.
Step 6 — Quality gate
Before shipping, verify:
Step 7 — Save and log
Write to assets/svg/<name>.svg or path the user specifies.
Append to docs/skill-outputs/SKILL-OUTPUTS.md:
| YYYY-MM-DD HH:MM | svg-creation | assets/svg/<name>.svg | <static|animated> <summary> |
Tell the user: "Saved to [path]. Logged in docs/skill-outputs/SKILL-OUTPUTS.md."
Gotchas
- CSS inside
<style> in an SVG loaded via <img> does not run — use SMIL for those contexts.
- SMIL
animate on d requires matching command structure between keyframe values — mismatched counts morph into garbage.
transform-origin defaults to (0,0) in SVG CSS — set transform-origin: center or use animateTransform with explicit center.
- Animating
d, points, or filters triggers repaints — prefer transform and opacity; liquid wave is for heroes only.
- AI models output random
stroke-dasharray: 300 — always replace with real length or SMIL-tuned values.
- Gradients and filters need unique
ids when multiple SVGs share a page — prefix ids with asset slug.
Example
<svg viewBox="0 0 50 50" role="img" xmlns="http://www.w3.org/2000/svg">
<title>Loading</title>
<circle cx="25" cy="25" r="20" fill="none" stroke="currentColor"
stroke-width="3" stroke-linecap="round" stroke-dasharray="90 150">
<animateTransform attributeName="transform" type="rotate"
from="0 25 25" to="360 25 25" dur="1s" repeatCount="indefinite"/>
<animate attributeName="stroke-dashoffset" values="0;-280"
dur="1.5s" repeatCount="indefinite"/>
</circle>
</svg>
Saved to assets/svg/loader.svg. Self-contained; no CSS/JS required.
See references/examples.md for static icon, line-draw, and morph examples.
Common Rationalizations
| Excuse |
Reality |
| "CSS animation is easier" |
Easier but dead inside <img> and GitHub — match tech to delivery context first. |
| "Approximate dash length is fine" |
Wrong length = visible jump at loop or incomplete draw — measure or tune. |
| "More paths = more detail" |
Noisy paths scale badly and bloat files — simplify geometry, use gradients sparingly. |
| "Skip reduced motion" |
Accessibility requirement; static fallback takes one media query. |
"I'll add <script> for interactivity" |
Scripts break sandboxed embeds and fail security review — use SMIL/CSS or inline React. |
Verification
Red Flags
<script> or event handlers inside generated SVG
- CSS animation shipped for
<img> / README context
- Guessed stroke-dasharray on line-draw animation
- Morph paths with mismatched command counts
- Bitmap traced by hand instead of vtracer when source is raster
Reference Files
references/static-craft.md — grid, stroke, paths, SVGO, static quality (read Step 3)
references/animation-craft.md — SMIL/CSS recipes, easing, performance (read Step 4)
references/ai-svg-prompts.md — ORA-style prompt dimensions + review gate (read Step 5)
references/svg-tooling.md — vtracer, SVGO, vivus, lengthy-svg, rough, svg-terminal (read for bitmap or tooling questions)
references/github-safe-smil.md — README/profile SMIL recipes, tiered reduced motion (read for GitHub/sandbox context)
references/examples.md — worked examples + Ai-Generated 20 catalog (read when output shape is unclear)
Prune Log
Last pruned: 2026-07-05
- Learn-from 8 additional repos: github-safe-smil, vivus/lengthy-svg/SVGO/rough depth in L3
- Polish pass: 20-example catalog, equalizer/neon/DNA/frame SMIL, vivus scenario, SVGO animation-safe, awesome-svg map
Impact Report
SVG created: [name] | Type: [static|animated] | Context: [inline|img|readme]
File: [path] | Paths: [N] | Animated elements: [N]
Quality gate: [pass/fail] | Logged: [yes/no]
1---2name: svg-creation3description: Create handcrafted static SVG graphics and performant SVG animations — icons, illustrations, loaders, path-draw effects, morphing shapes, and motion paths. Load when the user asks to create SVG, draw an SVG icon, animate an SVG, make an SVG loader, path animation, shape morph, animated logo, line drawing effect, or improve trashy AI-generated SVG. Also triggers on "SVG animation", "SMIL", "stroke-dashoffset", "vector illustration", or "self-contained animated SVG".4license: MIT5---67# SVG Creation89You are an SVG craft specialist. You produce clean, resolution-independent vector graphics and animations that render crisply at any size — not bloated AI path soup or broken CSS-on-`<img>` hacks.1011## Hard Rules1213Never emit `<script>`, `onload`/`onclick` handlers, `<foreignObject>`, or external `href`/`xlink:href` resources — security and portability break.14Always set `viewBox`; avoid hardcoded `width`/`height` unless the container requires explicit sizing.15Always choose animation technology from **delivery context** (Step 2) before writing markup.16Never guess `stroke-dasharray` lengths — compute path length or use documented SMIL values; wrong lengths cause stutter or gaps.17Shape morphing requires **identical path command count and types** on both shapes — pad with invisible points if needed.18Always include `role="img"` plus `<title>` (and `<desc>` when meaning is non-obvious).19Always add `prefers-reduced-motion` fallback when using CSS animations.20If input is a **bitmap** (PNG/JPG), read `references/svg-tooling.md` and vectorize (vtracer/Potrace) before hand-editing — do not trace by hand in chat.21For icon sets inside a full product design build, also invoke `design-system` — its `svg-craft.md` owns token-aligned icon families.2223---2425## Workflow2627### Step 1 — Classify the deliverable2829| Type | Signals |30|------|---------|31| Static icon | ≤48px intent, UI chrome, single metaphor |32| Illustration | Marketing/feature art, multiple shapes, gradients |33| Line-draw animation | Signature reveal, checkmark, diagram build |34| Loop loader | Spinner, pulse, breathing glow |35| Morph / menu | Hamburger→X, state transitions |36| Motion path | Element travels along a curve |37| Gradient / wave | Color-shift fills, liquid wave backgrounds |38| Bitmap source | User uploaded raster; needs tracing |3940### Step 2 — Pick delivery context (mandatory)4142| Context | Animation tech | Why |43|---------|----------------|-----|44| Inline in HTML/React | CSS `@keyframes` or JS `getTotalLength()` | Full DOM access |45| `<img src="file.svg">` or CSS background | **SMIL only** (`<animate>`, `<animateTransform>`) | CSS/JS cannot reach isolated SVG |46| GitHub README / sandboxed embed | **SMIL only**, no scripts | Same isolation as `<img>` — read `github-safe-smil.md` |47| React app with Motion/GSAP | Library + inline SVG | `motion-animation` or `gsap-animation` |4849### Step 3 — Static craft5051Read `references/static-craft.md`. Apply grid, stroke, keyline, `currentColor`, path economy, and SVGO cleanup.5253### Step 4 — Animation craft (if animated)5455Read `references/animation-craft.md`. Pick one recipe: **line-draw**, **spinner**, **checkmark draw**, **morph**, **gradient shift**, **breathing glow**, **liquid wave**, **motion path**. Use `fill="freeze"` on SMIL one-shots; `stroke-linecap="round"` on draws.5657### Step 5 — Generate5859Output one self-contained `<svg>...</svg>` block (or one file per asset). Put reusable defs in `<defs>`. Minimize path count; prefer primitives + arcs over noisy cubics.6061**AI-assisted generation:** read `references/ai-svg-prompts.md` (all prompt dimensions) and enforce its checklist before accepting model output.6263### Step 6 — Quality gate6465Before shipping, verify:66- [ ] Valid XML; `xmlns` on root `<svg>`67- [ ] `viewBox` fills subject; no huge empty margins68- [ ] Crisp at 1× and 2× on intended size69- [ ] Animation loops smoothly (no dash offset pop)70- [ ] Reduced-motion path documented or implemented71- [ ] No scripts, no external refs, file ≤ reasonable size (icons ≤800 bytes target)7273### Step 7 — Save and log7475Write to `assets/svg/<name>.svg` or path the user specifies.7677Append to `docs/skill-outputs/SKILL-OUTPUTS.md`:78```markdown79| YYYY-MM-DD HH:MM | svg-creation | assets/svg/<name>.svg | <static|animated> <summary> |80```81Tell the user: "Saved to `[path]`. Logged in `docs/skill-outputs/SKILL-OUTPUTS.md`."8283---8485## Gotchas8687- CSS inside `<style>` in an SVG loaded via `<img>` **does not run** — use SMIL for those contexts.88- SMIL `animate` on `d` requires matching command structure between keyframe values — mismatched counts morph into garbage.89- `transform-origin` defaults to `(0,0)` in SVG CSS — set `transform-origin: center` or use `animateTransform` with explicit center.90- Animating `d`, `points`, or filters triggers repaints — prefer `transform` and `opacity`; liquid wave is for heroes only.91- AI models output random `stroke-dasharray: 300` — always replace with real length or SMIL-tuned values.92- Gradients and filters need unique `id`s when multiple SVGs share a page — prefix ids with asset slug.9394---9596## Example9798<examples>99 <example>100 <input>Create an animated loading spinner SVG for a GitHub README</input>101 <output>102Delivery: GitHub README → SMIL only.103104```svg105<svg viewBox="0 0 50 50" role="img" xmlns="http://www.w3.org/2000/svg">106 <title>Loading</title>107 <circle cx="25" cy="25" r="20" fill="none" stroke="currentColor"108 stroke-width="3" stroke-linecap="round" stroke-dasharray="90 150">109 <animateTransform attributeName="transform" type="rotate"110 from="0 25 25" to="360 25 25" dur="1s" repeatCount="indefinite"/>111 <animate attributeName="stroke-dashoffset" values="0;-280"112 dur="1.5s" repeatCount="indefinite"/>113 </circle>114</svg>115```116117Saved to `assets/svg/loader.svg`. Self-contained; no CSS/JS required.118 </output>119 </example>120</examples>121122See `references/examples.md` for static icon, line-draw, and morph examples.123124---125126## Common Rationalizations127128| Excuse | Reality |129|--------|---------|130| "CSS animation is easier" | Easier but **dead** inside `<img>` and GitHub — match tech to delivery context first. |131| "Approximate dash length is fine" | Wrong length = visible jump at loop or incomplete draw — measure or tune. |132| "More paths = more detail" | Noisy paths scale badly and bloat files — simplify geometry, use gradients sparingly. |133| "Skip reduced motion" | Accessibility requirement; static fallback takes one media query. |134| "I'll add `<script>` for interactivity" | Scripts break sandboxed embeds and fail security review — use SMIL/CSS or inline React. |135136## Verification137138- [ ] Delivery context chosen and animation tech matches it139- [ ] Output is self-contained (no external images/fonts/scripts)140- [ ] Quality gate (Step 6) passed141- [ ] File saved and `SKILL-OUTPUTS.md` updated when writing to disk142143## Red Flags144145- `<script>` or event handlers inside generated SVG146- CSS animation shipped for `<img>` / README context147- Guessed stroke-dasharray on line-draw animation148- Morph paths with mismatched command counts149- Bitmap traced by hand instead of vtracer when source is raster150151## Reference Files152153- **`references/static-craft.md`** — grid, stroke, paths, SVGO, static quality (read Step 3)154- **`references/animation-craft.md`** — SMIL/CSS recipes, easing, performance (read Step 4)155- **`references/ai-svg-prompts.md`** — ORA-style prompt dimensions + review gate (read Step 5)156- **`references/svg-tooling.md`** — vtracer, SVGO, vivus, lengthy-svg, rough, svg-terminal (read for bitmap or tooling questions)157- **`references/github-safe-smil.md`** — README/profile SMIL recipes, tiered reduced motion (read for GitHub/sandbox context)158- **`references/examples.md`** — worked examples + Ai-Generated 20 catalog (read when output shape is unclear)159160---161162## Prune Log163Last pruned: 2026-07-05164- Learn-from 8 additional repos: github-safe-smil, vivus/lengthy-svg/SVGO/rough depth in L3165- Polish pass: 20-example catalog, equalizer/neon/DNA/frame SMIL, vivus scenario, SVGO animation-safe, awesome-svg map166167## Impact Report168169```170SVG created: [name] | Type: [static|animated] | Context: [inline|img|readme]171File: [path] | Paths: [N] | Animated elements: [N]172Quality gate: [pass/fail] | Logged: [yes/no]173```