# draw_diag CeTZ/Typst diagrams with Claude Code iteration loop. ## Setup ```bash sudo snap install typst ``` ## Usage ```bash ./render_diagram.sh diagrams/example/my_diagram.typ ``` ## Claude Code iteration workflow 1. Read source code, create `.typ` file with source docs in comments 2. Render: `./render_diagram.sh diagram.typ` 3. **Use a sub-agent to review the PNG** (critical - avoids confirmation bias): ``` Task tool, subagent_type: general-purpose "Look at this PNG and explain what concept it conveys. No context - just describe what you see. Maybe give constructive criticism and describe any issues you have with the task" ``` 4. Fix issues based on sub-agent feedback 1. Each time make a new file: `diagram_v2.typ`, `diagram_v3.typ`, etc. So we can visualize the changes over time. 5. Repeat until sub-agent correctly understands the diagram without hints ## References - [CeTZ docs](https://cetz-package.github.io/docs/) - [CeTZ gallery](https://github.com/typst/packages/tree/main/packages/preview/cetz/0.4.2/gallery) ![example of usage](img/README-1769681321214-image.png)