agentleFS
ZacklinkkZacklinkk/svg-foundry-skill/SKILL.md

svg-craft

Skill8 starsChanged 20 days agoApache-2.0View on GitHub

Create, edit, animate, and optimize SVG icons, illustrations, diagrams, and charts; includes guidance for responsive layout, accessibility, filters, text, and web-component output. Use for SVG-specific authoring and debugging.

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. MithunWijayasiri/dotclaude★ 4same name
    2. riquelmechile/Skills-Chile★ 4same name
    3. weiweimhy/agent-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 11 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Animate: Add motion/transitions to static SVG

    line 19
  2. Distinctive:

    Follow this structured approach based on the SVG knowledge base:

    line 32
  3. Very specific:

    Always set viewBox for responsive scaling (ref: essentials ch03)

    line 35
  4. Very specific:

    Use preserveAspectRatio when aspect ratio control matters

    line 36
  5. Distinctive:

    Consider the coordinate system: SVG y-axis goes downward

    line 38
  6. Very specific:

    Consider lengthAdjust and textLength for fitted text

    line 66
  7. Very specific:

    Use transform-origin in CSS for intuitive rotation centers

    line 108
  8. Distinctive:

    Read the relevant chapter in animation (SVG Animations) for the requested animation pattern.

    line 160
  9. Distinctive:

    Prefer simple transform/opacity animation when appropriate.

    line 187
  10. Distinctive:

    Use SMIL for SVG-specific attributes (path d, gradient stops)

    line 188
  11. Very specific:

    Add will-change only for a measured need, and avoid keeping unnecessary promoted layers alive

    line 189
  12. Distinctive:

    Avoid animating filter properties (expensive)

    line 190
  13. Very specific:

    Use prefers-reduced-motion media query for accessibility

    line 191
  14. Distinctive:

    Keep every referenced ID unique per component instance, including gradients, masks, clips, titles and descriptions.

    line 216
  15. Distinctive:

    Remove editor metadata (Illustrator/Inkscape cruft)

    line 221
  16. Distinctive:

    Use CSS classes instead of inline styles for theming

    line 223
  17. Distinctive:

    Check reduced-motion behavior for animations.

    line 248
  18. Very specific:

    Use Read to load specific reference files when you need detailed syntax or examples.

    line 256

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SVG Foundry (svg-craft) — SVG Authoring & Optimization

Local reference collection drawn from SVG books (third-party source and redistribution rights require separate verification): SVG Essentials, SVG Text Layout, SVG Colors Patterns & Gradients, SVG Animations, Using SVG with CSS3 and HTML5, Modern SVG.


Step 1 — Clarify Requirements

Infer the task and output format from the request and project. Ask only when an unresolved choice materially changes the result; do not repeat questions the user already answered.

1. Task type (if not obvious from the request):

  • Create: Build SVG from scratch based on a description
  • Optimize: Improve existing SVG code (performance, accessibility, responsiveness)
  • Animate: Add motion/transitions to static SVG
  • Restyle: Change colors, gradients, patterns, filters

2. Output format (use the project framework; otherwise default to standalone SVG):

  • Pure SVG: Standalone .svg markup, embeddable anywhere
  • HTML + SVG: Complete HTML page with inline SVG + CSS animations
  • React component: JSX component with props for customization
  • Vue component: SFC with template + scoped styles

Step 2 — Design the SVG

Follow this structured approach based on the SVG knowledge base:

2.1 Canvas & Coordinate System

  • Always set viewBox for responsive scaling (ref: essentials ch03)
  • Use preserveAspectRatio when aspect ratio control matters
  • Set a useful viewBox; choose width/height or CSS sizing for the actual embedding context. Explicit intrinsic dimensions can coexist with responsive scaling.
  • Consider the coordinate system: SVG y-axis goes downward

2.2 Shape Selection

Choose the right primitives (ref: essentials ch02, ch03):

  • <rect> — rectangles, rounded rectangles (rx/ry)
  • <circle> — circles (center + radius)
  • <ellipse> — ellipses (center + rx/ry)
  • <line> — single straight line
  • <polyline> — connected line segments (open)
  • <polygon> — closed shapes from points
  • <path> — complex shapes with M/L/C/S/Q/T/A/Z commands

2.3 Path Commands Mastery (ref: essentials ch04, web ch16)

  • M/m — moveto (start point)
  • L/l — lineto (straight line)
  • H/h, V/v — horizontal/vertical line
  • C/c — cubic Bezier (two control points)
  • S/s — smooth cubic Bezier (mirrored control)
  • Q/q — quadratic Bezier (one control point)
  • T/t — smooth quadratic Bezier
  • A/a — elliptical arc (rx ry rotation large-arc sweep x y)
  • Z — close path

2.4 Text Handling (ref: text; read only the relevant chapter)

  • <text> with x, y, font-family, font-size
  • <tspan> for inline formatting changes
  • <textPath href="#path-id"> for text along a path; use legacy xlink:href only when a stated compatibility target requires it
  • dominant-baseline and text-anchor for alignment
  • Consider lengthAdjust and textLength for fitted text

2.5 Colors & Fills (ref: colors; read only the relevant chapter)

  • Named colors, hex (#RRGGBB / #RGB), rgb(), hsl()
  • fill and stroke properties
  • fill-opacity, stroke-opacity, opacity
  • fill-rule: nonzero (default) vs evenodd

2.6 Gradients (ref: colors ch09-ch12)

<!-- Linear gradient -->
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
  <stop offset="0%" stop-color="#2563eb"/>
  <stop offset="100%" stop-color="#7c3aed"/>
</linearGradient>

<!-- Radial gradient -->
<radialGradient id="grad2" cx="50%" cy="50%" r="50%">
  <stop offset="0%" stop-color="#fef3c7"/>
  <stop offset="100%" stop-color="#f59e0b"/>
</radialGradient>
  • gradientUnits: objectBoundingBox (default, %) vs userSpaceOnUse (absolute)
  • spreadMethod: pad (default), reflect, repeat
  • Focal point with fx/fy on radial gradients

2.7 Patterns (ref: colors ch13-ch14)

<pattern id="pat1" width="20" height="20" patternUnits="userSpaceOnUse">
  <!-- pattern content -->
</pattern>
  • patternUnits vs patternContentUnits
  • patternTransform for rotating/scaling patterns

2.8 Transforms (ref: essentials ch06, web ch26-ch27)

  • translate(tx, ty) — move
  • scale(sx, sy) — resize (negative = flip)
  • rotate(angle, cx, cy) — rotate around point
  • skewX(angle), skewY(angle) — shear
  • matrix(a,b,c,d,e,f) — full affine transform
  • Transforms apply right-to-left when chained
  • Use transform-origin in CSS for intuitive rotation centers

2.9 Clipping & Masking (ref: essentials ch09, web ch34-ch35)

<!-- Clip: sharp boundary -->
<clipPath id="clip1"><circle cx="50" cy="50" r="40"/></clipPath>
<image clip-path="url(#clip1)" .../>

<!-- Mask: soft/graduated boundary -->
<mask id="mask1"><rect fill="white" .../><circle fill="black" .../></mask>
<image mask="url(#mask1)" .../>
  • Clip = binary (in/out), Mask = graduated (luminance-based)

2.10 Filters (ref: essentials ch11, web ch36-ch37)

Common filter primitives:

  • feGaussianBlur — blur (stdDeviation)
  • feDropShadow — drop shadow shorthand
  • feColorMatrix — color transformations
  • feMorphology — dilate/erode shapes
  • feDisplacementMap — distortion effects
  • feTurbulence + feDisplacementMap — organic textures
  • feComposite — combine with in, over, atop, xor, arithmetic
  • feBlend — blend modes (multiply, screen, overlay, etc.)
  • feMerge — layer multiple filter results
<filter id="shadow">
  <feDropShadow dx="2" dy="2" stdDeviation="3" flood-color="rgba(0,0,0,0.3)"/>
</filter>

2.11 Stroke Properties (ref: web ch30-ch31)

  • stroke-width, stroke-linecap (butt/round/square)
  • stroke-linejoin (miter/round/bevel), stroke-miterlimit
  • stroke-dasharray — dash patterns (e.g., "5,3,2")
  • stroke-dashoffset — animate for drawing effects
  • vector-effect="non-scaling-stroke" — constant stroke width when scaled

2.12 Markers (ref: web ch32-ch33)

<marker id="arrow" viewBox="0 0 10 10" refX="5" refY="5"
        markerWidth="6" markerHeight="6" orient="auto-start-reverse">
  <path d="M 0 0 L 10 5 L 0 10 z" fill="currentColor"/>
</marker>
<line marker-end="url(#arrow)" .../>

Step 3 — Add Animation (if needed)

Read the relevant chapter in animation (SVG Animations) for the requested animation pattern.

3.1 CSS Animations (preferred for simple animations)

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; transform-box: fill-box; transform-origin: center; }

3.2 SVG SMIL Animations (for path morphing, gradient animation)

<animate attributeName="opacity" from="0" to="1" dur="1s" fill="freeze"/>
<animateTransform attributeName="transform" type="rotate" from="0" to="360" dur="2s" repeatCount="indefinite"/>
<animateMotion path="M0,0 C30,0 30,60 60,60" dur="3s" repeatCount="indefinite"/>

3.3 Stroke Drawing Animation

.draw-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw 2s ease forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

Calculate actual path length with getTotalLength() or estimate.

3.4 Animation Best Practices (ref: animation ch07)

  • Prefer simple transform/opacity animation when appropriate; verify actual rendering cost rather than promising GPU acceleration
  • Use SMIL for SVG-specific attributes (path d, gradient stops)
  • Add will-change only for a measured need, and avoid keeping unnecessary promoted layers alive
  • Avoid animating filter properties (expensive)
  • Use prefers-reduced-motion media query for accessibility

Step 4 — Web Integration & Responsiveness

4.1 Embedding Methods (ref: web ch04-ch08, modern ch04)

  • Inline SVG: Best for dynamic/interactive SVG in HTML
  • <img src="file.svg">: Simple, cached, no scripting
  • CSS background-image: Decorative use, no interaction
  • <object>: Interactive, own DOM, fallback content
  • <iframe>: Full isolation, communication via postMessage

4.2 Responsive SVG Pattern

<!-- Fluid width, aspect-ratio preserved -->
<svg viewBox="0 0 800 600" style="width: 100%; height: auto;">
  <!-- content -->
</svg>

4.3 Accessibility (ref: web ch39-ch40)

  • For informative inline SVG, provide an accessible name (for example <title> with aria-labelledby) and role="img" where appropriate; add a useful description for complex content.
  • For decorative inline SVG, use aria-hidden="true" and keep it out of keyboard focus; do not add redundant announced labels.
  • For an SVG embedded through <img>, supply the meaning in the image's alt attribute, or alt="" when decorative.
  • Keep every referenced ID unique per component instance, including gradients, masks, clips, titles and descriptions.

4.4 Performance Best Practices (ref: web ch45-ch47)

  • Simplify paths: reduce control points, use relative commands
  • Reuse with <use href="#id"/> and <defs>
  • Remove editor metadata (Illustrator/Inkscape cruft)
  • Minimize <filter> usage on mobile
  • Use CSS classes instead of inline styles for theming

Step 5 — Output & Deliver

Output Rules:

  1. SVG must be valid — proper namespace xmlns="http://www.w3.org/2000/svg"
  2. Include a suitable viewBox — choose explicit or fluid dimensions to match the target
  3. Choose accessibility semantics for informative or decorative use; do not force a title onto every decorative asset
  4. Use <defs> for reusable elements (gradients, patterns, filters, clips)
  5. Use semantic IDs — meaningful names, not rect1 or path23
  6. Indent properly — readable, well-structured markup
  7. Comment complex paths — explain what <path d="..."> draws

Format-Specific Output:

  • Pure SVG: Standalone <svg>...</svg> block, save as .svg
  • HTML + SVG: Full <!DOCTYPE html> page with <style> block for animations
  • React: export function SvgComponent({ size, color, ...props }) with configurable props
  • Vue: <template> + <style scoped> SFC format

Validate the actual deliverable

  • Parse standalone SVG as XML; inspect unresolved fragment references and duplicate IDs.
  • Preview at the intended dimensions and a smaller size when a renderer/browser is available. Check clipped strokes/filters, legible text and actual font availability.
  • For repeated components, check multiple instances on the same page; preserve IDs used by CSS, accessibility or external code during optimization.
  • Check reduced-motion behavior for animations. Report which checks actually ran; a valid XML parse alone does not establish visual quality or accessibility.

Current standards: SVG 2 references and legacy XLink, SVG 2 coordinate systems and sizing, WAI decorative image guidance. Consult the relevant current specification when an older book example conflicts with the target runtime.


References Index — When to Load Which Chapter

Use Read to load specific reference files when you need detailed syntax or examples.

Book 1: SVG Essentials (essentials-*)

FileTopicLoad when...
ch01Cover + TOCUnderstanding book structure
ch02Ch1: Basic shapesDrawing rect, circle, ellipse, line, polygon
ch03Ch2: CoordinatesViewport, viewBox, units, coordinate systems
ch04Ch3: PathsPath commands (M, L, C, Q, A, Z)
ch05Ch4: Document structure<g>, <use>, <defs>, <symbol>
ch06Ch5: Transformstranslate, rotate, scale, skew, matrix
ch07Ch6: Text<text>, <tspan>, font properties
ch08Ch7: Stroke & fillColors, gradients basics, patterns basics
ch09Ch8: Clip & maskclipPath, mask elements
ch10Ch9: ImagesEmbedding raster images in SVG
ch11Ch11: FiltersAll filter primitives (blur, shadow, color, composite)
ch14Ch14: AdvancedSVG + JavaScript interaction

Book 2: SVG Text Layout (text-*)

FileTopicLoad when...
ch04Ch1: Text basics<text>, positioning, styling
ch08Ch5: textPathText on a path
ch11-ch13Ch8-10: AdvancedMulti-line, wrapping, international text

Book 3: SVG Colors, Patterns & Gradients (colors-*)

FileTopicLoad when...
ch05Ch2: Painter's modelfill/stroke rendering order
ch06Ch3: Color valuesHex, RGB, HSL, named colors
ch07Ch4: Opacityfill-opacity, stroke-opacity, group opacity
ch09Ch6: Linear gradientslinearGradient basics
ch10Ch7: Gradient sizinggradientUnits, gradientTransform
ch11Ch8: RepeatingspreadMethod: pad/reflect/repeat
ch12Ch9: Radial gradientsradialGradient, focal point
ch13Ch10: Patternspattern basics, tiles, textures
ch14Ch11: Advanced patternspatternTransform, nested patterns
ch15Ch12: Text paintingTextured/gradient text
ch16Ch13: StrokesStroke gradients, stroke patterns

Book 4: SVG Animations (animation-*)

FileTopicLoad when...
ch03Ch1: SVG anatomySVG structure for animation
ch04Ch2: CSS animation@keyframes, transitions on SVG
ch05Ch3: SpritesSVG sprite sheets, hand-drawn animation
ch06Ch4: Responsive spritesResponsive animated SVGs
ch07Ch5: UI/UX animationLoading, hover, micro-interactions
ch08Ch6: Data viz animationChart animation, data-driven motion

Book 5: Using SVG with CSS3 and HTML5 (web-*)

FileTopicLoad when...
ch06Ch1: SVG overviewSVG on the web, history
ch08Ch2: SVG + webEmbedding methods, browser support
ch10Ch3: CSS + SVGStyling SVG with CSS, cascading rules
ch12Ch4: ToolsEditor tools, optimization tools
ch15Ch5: Basic shapesDetailed shape attributes
ch16Ch6: Custom pathsAdvanced path techniques
ch18Ch7: Text layoutGraphical text in web context
ch21Ch8: Coordinate systemsviewBox deep dive, preserveAspectRatio
ch23Ch9: CroppingViewport clipping, overflow
ch25Ch10: Reuse<use>, <symbol>, shadow DOM
ch27Ch11: TransformsCSS transforms on SVG elements
ch29Ch12: FillsGradients + patterns (comprehensive)
ch31Ch13: StrokesAll stroke properties
ch33Ch14: MarkersArrow markers, custom markers
ch35Ch15: Clip + maskClipping and masking techniques
ch37Ch16: FiltersFilter effects with CSS blend modes
ch40Ch17: AccessibilityARIA, <title>, <desc>, roles
ch42Ch18: InteractivityEvents, hover, click, scripting
ch44Ch19: AnimationCSS + SMIL animation techniques
ch47Ch20: Best practicesPerformance, optimization, patterns

Book 6: Modern SVG (modern-*)

FileTopicLoad when...
ch04Ch1: SVG in web pagesModern embedding best practices
ch05Ch2: ToolsModern SVG tool chain
ch06Ch3: Advanced pathsAdvanced curves and shapes
ch07Ch4: ColorsModern color techniques

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.