# /baoyu-diagram: Draw clean SVG diagrams that work in dark and light themes

Source: https://trendhub.net/skills/jimliu-baoyu-skills/baoyu-diagram
Skill folder: https://github.com/JimLiu/baoyu-skills/tree/main/skills/baoyu-diagram
Pack: Baoyu Skills (https://trendhub.net/skills/jimliu-baoyu-skills)
Works with: Any agent (npx skills), Claude Code, ClawHub / OpenClaw

Unlike the image skills in this pack, this one has the agent write SVG by hand. Every colour is a CSS variable, so one source file switches between dark, light and custom themes. The skill sets fonts, spacing, layering and component patterns, then uses bundled scripts to produce a light variant and 2x PNG exports.

## When to use it

- You need an architecture, sequence or flow diagram for documentation or a blog post.
- Your site has dark and light modes and the diagram must look right in both.
- You want diagrams in your brand colours without editing every shape by hand.

## How it works

1. **Choose the diagram type**: The agent identifies whether the job is architecture, flowchart, sequence, structural, mind map, timeline, state machine or similar, and reads that type's reference.
2. **Plan the layout**: It lists components, groups and flow direction and works out positions before drawing.
3. **Write layered SVG**: It paints background, regions, arrows, masks, boxes, labels, legend and title in a fixed order, with all colours as theme variables.
4. **Check spacing**: It verifies minimum gaps, label clearance and viewBox padding so nothing overlaps.
5. **Export variants**: It runs the theme-switch script for a light SVG and the PNG script for 2x images of both themes.

## What it steers the agent away from

- Hard-coded colours that break theme switching.
- Remote fonts or assets that make the SVG render differently offline.
- Arrows showing through semi-transparent boxes, by drawing an opaque mask under each one.

## What it can touch

It writes SVG and PNG files into a diagram folder and runs bundled bun scripts; PNG export needs the sharp package, which it asks you to install rather than installing itself.

## Pairs well with

- `/baoyu-article-illustrator`
- `/baoyu-slide-deck`

## Questions

### Does it call an image model?

No. The README says no image model is involved; the agent writes the SVG markup and computes the layout itself.

### Can I add my own theme?

Yes. Drop a JSON file of CSS variable values into the themes folder and pass its name with --theme.
