figure.create_tikz
Generate a TikZ 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 TikZ code for an image or a description
03 SKILL.md 正文
Goal
- Convert images or textual descriptions into publication-quality TikZ LaTeX code
- Generate a compilable LaTeX file, render it to PNG, and iteratively refine the output to match the input precisely
When to Use
- Use this skill when you need to:
- Create publication-quality diagrams, plots, or visualizations
- Convert hand-drawn sketches or existing images into reproducible TikZ code
- Generate diagrams for inclusion in LaTeX documents
When NOT to Use
- Do not use this skill for:
- Complex photographs requiring photorealistic rendering
- Plots from large datasets (use dedicated plotting libraries instead)
- Diagrams requiring advanced 3D visualization
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
- Pick the diagram structure that fits the input:
- FLOWCHART: sequential steps, decision branches, pipelines
- STRUCTURAL: containment (things inside other things), architecture
- ILLUSTRATIVE: plots, physical cross-sections, or abstract spatial metaphors
Generate TikZ Code
- Generate valid LaTeX code using the TikZ package. Wrap the code in a complete
minimal working example:
\documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} ... \end{tikzpicture} \end{document}
Preserve layout accurately
- If converting from an image
<IMAGE>, reproduce the layout precisely - Preserve proportions, relative positions, and symmetry
- Use coordinates and scaling where appropriate
- Approximate complex curves with TikZ paths when needed
Follow the TikZ conventions
- Generate the diagram using the conventions from
.claude/skills/tikz.rules.md - Key sections to follow: Colors, Typography, Layout, Reusable Patterns, Polish
Handle ambiguity
- Make reasonable assumptions about unclear inputs
- Prioritize clarity and visual correctness over perfection
Save the File
- Save the generated LaTeX code to
./tikz_figure.texin the current directory (not in.claude/). Output only valid TikZ code without markdown formatting or explanations
Render to Image
-
Generate a PNG image using the rendering script:
> ./helpers_root/dev_scripts_helpers/dockerize/dockerized_tikz_to_bitmap.py \ -i tikz_figure.tex \ -o 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
./tikz_figure.texto 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)
Examples
- Bad: Attempting to convert a photograph of a natural scene into TikZ (infeasible; use image inclusion instead)
- Good: Converting a circuit diagram sketch into TikZ with accurate node positioning, labeled connections, and proper symmetry
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