mermaid-figures
Skill1 starsChanged 5 days agoMITView on GitHub
Create and update the book's diagrams by keeping Mermaid source in separate .mmd files and rendering them to PNG images that are embedded in the chapters. Use when adding, editing, or auditing diagrams in chapters/.
In this repository18 other files it gives its agents.
- arxiv-searchSkill
- bisac-categorizerSkill
- blockframe-videoSkill
- blog-searchSkill
- book-mockupSkill
- book-promo-writerSkill
- book-sales-apiSkill
- calculatorSkill
- claude-code-docsSkill
- create-blog-postSkill
- create-slideSkill
- find-skillsSkill
- mintlifySkill
- play-books-pricingSkill
- quick-chartSkill
- roll-diceSkill
- technical-book-writerSkill
- uikitsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 48
Write a `mermaid block in the target chapter, then write an image reference with descriptive alt text below the block, followed by an …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Mermaid Figures Skill
This skill controls how diagrams in the book are rendered to PNG images
embedded in the actual chapters, instead of using inline ```mermaid blocks.
Rules That Must Not Be Broken
- Never put a
```mermaidblock in a chapter file — chapters may only reference PNG images. - File names are bound to the figure number —
images/figX-Y.png= chapter X, figure Y (the Mermaid source lives atimages/figX-Y.mmd). Always include descriptive alt text and an explanatory paragraph directly below the image:
 <prose paragraph explaining the mechanism, steps, and relationships between the components in the image>- The alt text must say what the image shows; do not rely on a generic prefix such as "Diagram..." alone.
- Caption lines (e.g.
*Figure 1.1: ...*) are no longer used.
- The image style must be a vertical flowchart (
flowchart TD/graph TD), because horizontal diagrams get scaled down until they are unreadable on e-reader screens.
File Layout
| File | Role |
images/figX-Y.mmd | Mermaid source for figure X.Y (edit here when changing a diagram) |
images/figX-Y.png | Rendered image referenced by the chapters (built from the .mmd) |
references/mermaid-config.json | mermaid-cli theme (Google Sans font, white background) |
The two file-name styles differ on purpose: the
.mmdusesfigX-Y.mmd(hyphenated) while the.pngusesfigX-Y.png(unhyphenated), to stay consistent with the book's existing convention.
Adding a New Diagram
Write a
```mermaidblock in the target chapter, then write an image reference with descriptive alt text below the block, followed by an explanatory paragraph:```mermaid flowchart TD A[...] --> B[...]Image: <descriptive alt text>
Extract the block into a
.mmdfile (the image reference you already wrote is preserved):node .agents/skills/mermaid-figures/scripts/extract-mermaid.js --dry-run # preview first node .agents/skills/mermaid-figures/scripts/extract-mermaid.jsRender the image:
node .agents/skills/mermaid-figures/scripts/render-mermaid.js --jobs 4
Editing an Existing Diagram
- Edit
images/figX-Y.mmddirectly (never edit the.png). Re-render — render only the chapter you changed for speed:
node .agents/skills/mermaid-figures/scripts/render-mermaid.js --chapter 1 --jobs 4Filter options:
Option Meaning (none) Render every diagram in the book --chapter NRender only chapter N, e.g. --chapter 1--figure N.MRender only figure N.M, e.g. --figure 1.2--jobs NNumber of parallel render jobs (default 4)
Image Resolution (Important for PDF/EPUB)
references/mermaid-config.json sets useMaxWidth: false so each diagram is rendered at its
natural proportions (not stretched to fill a 1600px frame), and --scale 4 then enlarges it
to a resolution high enough for print (~200 DPI when scaled to the full page width).
If you change
useMaxWidthback totrue, you must raise--scaleaccordingly, otherwise the effective image resolution drops by half.
Validation
node .agents/skills/mermaid-figures/scripts/verify-figures.jsThis script checks that every image reference has matching .png and .mmd files, that the alt text
actually describes the diagram, that an explanatory paragraph sits below the image, that no legacy
caption lines remain, and that no mermaid blocks are left behind in the chapters.
Mermaid Syntax Warnings
Label text containing {, } or #[ must be wrapped in double quotes, otherwise the
parser treats it as a shape and the render fails.
flowchart TD
Good["Resolve {user_name} from Session State"]
AlsoGood["#[entrypoint] fn process_workflow"]
Bad[Resolve {user_name} from Session State]Building the Book After Editing
make genOutput lands in build/ebook_epub3.epub and build/output.pdf.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

