mcpField
S
svg-skill

svg-skill

github.com/linyaoskyDesign & UI684 installsUpdated 21w ago
Repository

About svg-skill

svg-skill is a guide to writing SVG source directly for development and design work involving vector graphics. It organizes drawing, accessibility, validation, and delivery guidance by scenario, and specifies not to use image-generation tools.

Key features

  1. 01Covers icons, logos, illustrations, charts, and flowcharts
  2. 02Provides SVG structure and drawing rules
  3. 03Includes accessibility guidance and quality checks
  4. 04Supports standalone SVG, React, Vue, and CSS deliverables
  5. 05Batch-validate SVG files with a script

Use cases

  1. 01Create UI icons, logos, or app icons
  2. 02Draw flowcharts, architecture diagrams, or charts
  3. 03Deliver SVG graphics as React or Vue components
  4. 04Prepare inline SVG graphics for web pages or email

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/linyaosky/svg-skill --skill svg-skill

After installing, type/svg-skillin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

CONTRIBUTING.md
.gitignore
reference.md
scenarios.md
examples.md
LICENSE
README.md
install.sh
scripts/
validate.sh
test-output/
TEST.md
preview.html
run-tests.sh
test-output/12-integration/
BellIcon.tsx
MailIcon.vue
demo.css

Details

From the project README

svg-skill

Write SVG source directly. Do not use image generation tools.

Scenario index

Match user intent, then pick a path. Details in scenarios.md, examples in examples.md.

ScenarioviewBoxKey techniqueDeliverable
UI icons (outline/filled)0 0 24 24currentColor, uniform stroke-widthfile / React component
Multi-color icons0 0 24 24separate paths + fixed fillfile
Logo / brand markbrand-specificpath outlines, safe marginSVG + optional favicon
Favicon / app icon0 0 32 32minimal, high contrastfile
Illustration / empty state0 0 100 100+flat shapesSVG / inline
Flowchart / architecturecontent-basedmarker arrows, grid alignmentUTF-8 file
Charts (bar/line/pie)data-basedcoords from scaletitle + desc
Progress ring / bar0 0 24 24 or barstroke-dasharray or rect widthanimatable
Avatar placeholder0 0 40 40circle + letter / person pathcurrentColor
Badge / labeltext-basedrounded rect + textbrand colors
Wave divider0 0 1200 120bezier path, preserveAspectRatio="none"full-width
Map pin0 0 24 24teardrop path + center dottheme or fixed color
Sprite sheetper symbol<symbol> + <use href="#id">single sprite.svg
CSS background / masksame as iconsexternal file or data URICSS snippet
Loading animation0 0 24 24CSS @keyframes or stroke-dashinline SVG
Hover interactionanyCSS :hover on fill/stroke/transforminline + style
Clip shapescontainer-based<clipPath> / <mask>defs reference
Shadow / blurany<filter> feDropShadow / feGaussianBlurdefs reference
Pattern texturesmall unit<pattern> tiledefs reference
React / Vue component0 0 24 24spread props, camelCase attrs.tsx / .vue
Email inlineminimalno style/animation/external refscompact snippet

Poor fit for SVG: photorealism, complex bitmap textures, overly detailed illustration → explain limits, suggest raster or simplified style.

Workflow

- [ ] 1. Pick scenario and deliverable from index
- [ ] 2. Set viewBox, style, colors (currentColor vs brand)
- [ ] 3. Draw: compose shapes → paths; shared assets in <defs>
- [ ] 4. A11y: decorative aria-hidden / informative title+desc
- [ ] 5. Minimize; non-ASCII text → UTF-8 + XML declaration
- [ ] 6. Write file; run validate.sh
Skeleton templates

Icon only (no text):

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" aria-hidden="true">
</svg>

Non-ASCII text (CJK, etc.):

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 120" role="img" aria-labelledby="title">
  <title id="title">Diagram title</title>
</svg>

Full-width decor (waves, etc.):

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none" aria-hidden="true">
</svg>
Drawing rules
  1. viewBox defines logic coords; display size via CSS width/height
  2. Monochrome UI assets default to currentColor
  3. Outline icons — stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
  4. Shared defs — gradients, arrows, patterns, filters in <defs>; short unique ids
  5. Charts — compute margins and scale first; summarize data in title/desc
  6. Animation — prefer CSS; SMIL only for simple cases
  7. Flat by default — gradients/shadows only when needed
Quality checklist
  • xmlns + viewBox
  • Non-ASCII text → UTF-8 + XML declaration
  • No placeholder paths or editor metadata
  • ids unique within file (sprites especially)
  • Charts have title; decorative icons use aria-hidden
  • File opens and previews standalone
bash scripts/validate.sh path/to/dir/
xmllint --noout file.svg   # required for non-ASCII text
Deliverables
FormApproach
Standalone .svgwrite to assets/ etc.
Spritemultiple <symbol> in one file; document <use> usage
Reactexport function XIcon(props: SVGProps<SVGSVGElement>) + spread
Vue<template><svg ...></svg></template>
CSS backgroundbackground: url(...) or inline data URI
CSS mask-webkit-mask: url(...); shape needs solid fill area
Inline HTMLraw <svg> fragment, no wrapper div (unless requested)

Do not

  • Use <image> to fake vectors with bitmaps (unless explicitly requested)
  • Use image generation for simple vectorizable graphics
  • Leave empty paths / TODO placeholders
  • Omit UTF-8 declaration for non-ASCII text
  • Add complex animation or external deps for email use cases

Tools & docs

ResourceDescription
scenarios.mdPer-scenario step-by-step
reference.mdPath syntax, defs, frameworks
examples.mdFull code samples
scripts/validate.shBatch validation

Comments

Markdown supported