figure.create_svg
Generate a SVG code for an image or a description
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- model
- sonnet
- description
- Generate a SVG code for an image or a description
03 SKILL.md 正文
Goal
- You are a technical illustrator creating publication-quality figures for a technical book
- Generate clean SVG diagrams from either an image or a textual description of a concept
When to Use
- Use this skill when you need to:
- Create publication-quality diagrams, flowcharts, or illustrative figures
- Convert hand-drawn sketches or existing images into reproducible SVG code
- Generate figures with dark-mode-aware, semantic coloring for a book or web page
When NOT to Use
- Do not use this skill for:
- Complex photographs requiring photorealistic rendering
- Quantitative data charts (use Chart.js or D3 instead, per
Figure Types) - Entity-relationship or class diagrams (use mermaid.js instead, per
Figure Types)
Workflow
Receive and Understand the Input
- You receive either:
- An image of a diagram
- A textual description of a concept or situation
Choose Figure Type
- Follow the section
Figure Typesfrom.claude/skills/svg.rules.mdto select the appropriate diagram type (FLOWCHART, STRUCTURAL, ILLUSTRATIVE, etc.)
Generate SVG Code
-
Generate the diagram as clean SVG using the conventions from
.claude/skills/svg.rules.md -
Key sections to follow:
- Canvas & Layout (viewBox dimensions and safe drawing areas)
- Typography (font sizes, weights, and text styling)
- Color System (use of ramp classes for semantic meaning)
- Strokes & Geometry (paths, arrows, and box styling)
- Accessibility (role attributes and descriptions)
- Dark Mode (class-based color handling)
- Advanced Patterns (for special diagram types)
-
If converting from an image
<IMAGE>, reproduce the layout precisely: preserve proportions, relative positions, and symmetry
Save the File
- Save the generated SVG code to
./svg_figure.svgin the current directory (not in.claude/). Output only valid SVG code without markdown formatting or explanations
Render to Image
-
Render the SVG to a PNG for inspection:
> inkscape svg_figure.svg --export-type=png --export-filename=output.png -
Open the generated image to inspect the output:
> open output.png
Iterate and Refine
- Compare the generated PNG to the original input. If there are significant
differences:
- Identify layout discrepancies
- Update
./svg_figure.svgto better match the input - Re-render and verify the result
Compare for User
- Once it's done, build a side-by-side comparison image and open it:
> montage <ORIGINAL_IMAGE> output.png -tile 2x1 -geometry 500x+10+10 \ -background white comparison.png > open comparison.png - Remove
comparison.pngafter the user has seen it, it is a temp file, not a deliverable
Verification
- [ ] Confirm all lines connect cleanly to box edges with no overlap
- [ ] Confirm the diagram closely matches the original (same layout, colors, and semantics)
- [ ] Confirm every item in the
What NOT to Dosection of.claude/skills/svg.rules.mdis avoided
Examples
- Bad: Attempting to convert a photograph of a natural scene into SVG (infeasible; use image inclusion instead)
- Good: Converting an architecture sketch into SVG with accurate box positioning, labeled connections, and semantic color ramps
04 同仓库更多 Skills
tutorial_in_60_mins.propagate_docker_changes
Sync tutorial and class-project Docker files to match project_template
tutorial_in_60_mins.merge_markdown
Merge the content of a markdown file into a Jupyter notebook
tutorial_in_60_mins.format
Format a directory to follow the "Learn X in 60 Minutes" tutorial conventions
tutorial_in_60_mins.create
Create a tutorial directory for the Learn X in 60 Minutes conventions
todo.reorg_in_progress
Reorganize ai_task_queue.md so in-progress tasks, not-started tasks, and mislabeled topic headers sit under the right H1 stage
todo.reorg_headers
Reorganize ai_task_queue.md .md so every H2 topic matches ALL TOPICS and every H3 task sits under the right topic, keeping its H1 stage