gpsaggese/helpers / .claude/skills/figure.create_tikz
figure.create_tikz
VerifiedGenerate a TikZ code for an image or a description
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.5 KB |
SKILL.md
View on GitHub---
description: Generate a TikZ code for an image or a description
model: sonnet
---
# Goal
- Convert images or text descriptions into publication-quality TikZ LaTeX code
- Generate a compilable LaTeX file, render it to PNG, and refine the output until
it matches the input
## When to Use
- Use this skill to:
- Create publication-quality diagrams, plots, or visualizations
- Convert hand-drawn sketches or images into reproducible TikZ code
- Generate diagrams for LaTeX documents
## When NOT to Use
- Do not use this skill for:
- Complex photographs needing photorealistic rendering
- Plots from large datasets (use dedicated plotting libraries)
- Advanced 3D visualizations
# Workflow
## Receive and Understand the Input
- You receive either:
1. An image of a diagram
2. A text 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 with the TikZ package, as a complete minimal working
example:
```latex
\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**
- Follow `.claude/skills/tikz.rules.md`, especially Colors, Typography, Layout,
Reusable Patterns, and Polish
**Handle ambiguity**
- Make reasonable assumptions about unclear inputs
- Prioritize clarity and visual correctness over perfection
## Save the File
- Save the LaTeX code to `./tikz_figure.tex` in the current directory (not in
`.claude/`). Output only valid TikZ code, with no markdown formatting or
explanations
- Add this comment at the top of the file, saying how it was generated:
```latex
% Generated by `.claude/skills/figure.create_tikz/SKILL.md`
```
## Render to Image
- Generate a PNG with the rendering script:
```bash
> ./helpers_root/dev_scripts_helpers/dockerize/dockerized_tikz_to_bitmap.py \
-i tikz_figure.tex \
-o output.png
```
- Open the image to inspect it:
```bash
> open output.png
```
## Iterate and Refine
- If the PNG differs from the original in significant ways:
- Identify layout discrepancies
- Update `./tikz_figure.tex` to match the input better
- Re-render and verify
## Compare for User
- Build a side-by-side comparison and open it:
```bash
> montage <ORIGINAL_IMAGE> output.png -tile 2x1 -geometry 500x+10+10 \
-background white comparison.png
> open comparison.png
```
- Remove `comparison.png` after the user has seen it. It is a temp file, not a
deliverable
# Verification
- [ ] All lines connect cleanly to box edges with no overlap
- [ ] The diagram closely matches the original (same layout, colors, semantics)
- [ ] The TikZ file says that it was generated by
`.claude/skills/figure.create_tikz/SKILL.md`
# Examples
- **Bad**: Converting 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
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |