Advanced SVG
Mission
Produce intentional, reusable SVG systems whose geometry, rendering, accessibility, and integration behavior remain understandable after generation.
Workflow
- Establish the delivery context: standalone file, inline HTML, CSS background, component framework, sprite, icon, diagram, chart, or print/export asset.
- Establish the viewport, coordinate system, aspect-ratio behavior, target sizes, theme tokens, interaction needs, and browser/runtime constraints.
- Sketch the visual hierarchy as primitive geometry and named reusable components before writing detailed paths.
- Read only the references needed for the requested surface:
- Read Geometry and Paths for coordinate systems, curves, arcs, compound paths, and procedural shapes.
- Read Components and Composition for
defs,symbol,use, markers, text paths, diagrams, charts, and ID hygiene. - Read Paint and Effects for gradients, patterns, clipping, masks, filters, and controlled texture.
- Read Quality, Accessibility, and Security for semantic alternatives, theming, animation, performance, compatibility, and safe embedding.
- Read Authoritative Sources when a feature or compatibility claim needs verification.
- Build from stable primitives and shared definitions. Prefer readable geometry over opaque path data when both render equivalently.
- Use unique, namespaced IDs for every referenced definition. Keep references local unless the delivery contract explicitly permits external resources.
- Validate XML and references with
python3 scripts/validate_svg.py <file.svg>. Treat unsafe-feature findings as blockers unless the embedding context explicitly requires and safely handles them. - Render at the smallest, nominal, and largest target sizes with
python3 scripts/render_svg.py <file.svg>. Require bothrsvgandchromiumfor compatibility-sensitive deliverables; inspect reported visible bounds and cross-renderer pixel divergence. - Inspect theme contrast, text overflow, focus behavior, reduced motion, and accessibility semantics in the actual embedding context when those behaviors apply.
Composition Rules
- Set
viewBoxdeliberately; add explicitwidthandheightonly when the delivery context requires intrinsic dimensions. - Group by semantic component, not by accidental draw order. Name IDs after roles rather than appearance.
- Put reusable paint servers, masks, clips, filters, markers, symbols, and paths in
defs. - Keep the scene's visual reading order aligned with DOM order when accessibility or interaction matters.
- Use CSS custom properties or
currentColorfor themeable assets. Provide safe fallback values. - Keep effects subordinate to shape and hierarchy. Expand filter regions enough to prevent clipped shadows or glows.
- Avoid embedding base64 raster data, fonts, scripts, event-handler attributes, or remote URLs unless the task explicitly needs them.
Output Contract
Deliver:
- valid SVG with a coherent viewport and no unresolved local references
- reusable definitions and namespaced IDs where composition warrants them
- a text alternative strategy appropriate to decorative, informative, functional, or complex imagery
- explicit notes for intentional compatibility tradeoffs, external dependencies, animation, or unsafe-capability requirements
- structural and renderer evidence proportional to the target surface
Authority and Artifact Policy
Create or modify SVG files only when the task authorizes file writes. Skill activation does not authorize fetching external assets, embedding third-party material, adding scripts, installing renderers, or changing application code. Keep design notes conversation-local unless a requested deliverable or existing repository contract requires a durable artifact.
Completion Gates
- Geometry remains legible and unclipped across required sizes.
- IDs are unique and every local
url(#...)or fragment reference resolves. - Decorative and meaningful graphics use the correct alternative-text strategy.
- Interactive SVG has keyboard, focus, and reduced-motion behavior where applicable.
- No unapproved script, event handler,
foreignObject, remote reference, or embedded executable content remains. - The SVG structural validator passes or every reported exception is explained.
- Renderer verification passes at required sizes; compatibility-sensitive work uses two independent engines or identifies the exact missing dependency as residual risk.