From eeefc69f5a74fdcfef34ca0fbd9a2a954bf68f1e Mon Sep 17 00:00:00 2001 From: wassname Date: Thu, 29 Jan 2026 20:20:14 +0800 Subject: [PATCH] init --- .claude/settings.local.json | 13 +++++++++++++ .gitignore | 4 ++++ README.md | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 .claude/settings.local.json create mode 100644 .gitignore create mode 100644 README.md diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..4d2a066 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,13 @@ +{ + "permissions": { + "allow": [ + "Bash(chmod:*)", + "Bash(curl:*)", + "Bash(sh)", + "Bash(./render_diagram.sh:*)", + "Bash(typst:*)", + "WebFetch(domain:cetz-package.github.io)", + "Bash(tree:*)" + ] + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485c17e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.png +diagrams/ +!diagrams/examples/ +!diagrams/TEMPLATE.typ diff --git a/README.md b/README.md new file mode 100644 index 0000000..b45004b --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# 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)