feat: add Excalidraw diagram agent skill for book figures (#507)

Add a project-level Agent Skill at .claude/skills/excalidraw-diagram
(symlinked from .agents/skills for other agents) that guides AI agents
to draw book figures with Excalidraw: editable .excalidraw source next
to exported SVG/PNG in v1/img/chNN, no PDF references, a palette that
stays legible on the dark-mode #e8e8e8 image backdrop, and separate
-zh variants for figures with text.

Adapted from github/awesome-copilot excalidraw-diagram-generator (MIT):
templates normalized to Excalifont and proper bound-text labels, plus a
stdlib-only check_figures.py linter for scenes and chapter image refs.
Document the skill in CONTRIBUTING_en.md and CONTRIBUTING_zh.md.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yeqi Huang
2026-10-26 02:11:55 +00:00
committed by GitHub
parent 40348fcb14
commit 9be2fb30f7
15 changed files with 3582 additions and 0 deletions

View File

@@ -78,6 +78,27 @@ After modifying source files under `zh_chapters/` or `en_chapters/`, the browser
For detailed custom syntax (math, figure labels, citations, code blocks) and figure guidelines, refer to the **[Writing Style Guide](style_en.md)**.
### Drawing Figures with AI Agents (Excalidraw Skill)
The repository includes a project-level agent skill,
[`.claude/skills/excalidraw-diagram/`](../.claude/skills/excalidraw-diagram/SKILL.md).
`.agents/skills/excalidraw-diagram` is a symlink to the same directory.
Claude Code, and other agents that support the Agent Skills format, load it
automatically when you ask them to draw a figure for the book.
The skill tells the agent to:
- keep the editable `.excalidraw` source next to the exported SVG/PNG in `v1/img/ch<NN>/`
- make separate `-zh` variants for figures that contain text
- follow a palette that stays legible in dark mode
- never reference PDF images
Lint figures and chapter references before you commit:
```bash
python3 .claude/skills/excalidraw-diagram/scripts/check_figures.py v1/img/ch06 v2/en_chapters/06_chapter_training_systems/index.md
```
---
## Submission Workflow

View File

@@ -78,6 +78,26 @@ cd v2/config/en_config && mdbook serve --open
详细的自定义语法(公式、图片标签、文献引用、代码块等)及图片规范,请参阅 **[写作样式规范](style_zh.md)**。
### 使用 AI Agent 绘图(Excalidraw Skill)
仓库内置了项目级 Agent Skill
[`.claude/skills/excalidraw-diagram/`](../.claude/skills/excalidraw-diagram/SKILL.md)。
`.agents/skills/excalidraw-diagram` 是指向同一目录的符号链接。
让 Claude Code 或其他支持 Agent Skills 格式的 Agent 为本书绘图时,它们会自动加载该 Skill。
该 Skill 要求 Agent:
- 将可编辑的 `.excalidraw` 源文件与导出的 SVG/PNG 一起放在 `v1/img/ch<NN>/`
- 为含文字的图另做 `-zh` 中文版本
- 使用在暗色模式下同样清晰的配色
- 不引用 PDF 图片
提交前可运行以下命令检查图片源文件与章节中的引用:
```bash
python3 .claude/skills/excalidraw-diagram/scripts/check_figures.py v1/img/ch06 v2/zh_chapters/06_chapter_training_systems/index.md
```
---
## 提交流程