Skip to content
Back to skills

Ml Diagrams

ASecurity

Draw publication-quality diagrams of machine-learning / AI model architectures, especially computer-vision networks drawn in the classic CNN style with oblique 3D boxes (parallelepipeds sized by H×W×C), stacked feature-map sheets, kernel / receptive-field cones, U-Net encoder-decoder layouts, residual skips, and flat blocks for transformer parts. Use this skill whenever the user wants to draw, sketch, visualize or illustrate a neural network, model architecture, CNN, ResNet/VGG/U-Net/YOLO/ViT...

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 11, 2026
ai-agentspythonbashnode

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned November 11, 2026

npx -y skills add ruzhylopv/ml-diagrams-skill --skill ml-diagrams --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ml Diagrams?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ml Diagrams
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ruzhylopv-ml-diagrams/badge)](https://www.skillsdirectory.com/skills/ruzhylopv-ml-diagrams)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ml-diagrams
description: Draw publication-quality diagrams of machine-learning / AI model architectures, especially computer-vision networks drawn in the classic CNN style with oblique 3D boxes (parallelepipeds sized by H×W×C), stacked feature-map sheets, kernel / receptive-field cones, U-Net encoder-decoder layouts, residual skips, and flat blocks for transformer parts. Use this skill whenever the user wants to draw, sketch, visualize or illustrate a neural network, model architecture, CNN, ResNet/VGG/U-Net/YOLO/ViT/autoencoder/GAN pipeline, a layer-by-layer tensor-shape figure, or an explanatory figure of convolution, pooling, stride, padding or patch embedding — for a paper, thesis, slides, blog post or lecture — even if they just say "make a figure of my model" or paste PyTorch code and ask for a picture of it.
---

# ML / computer-vision architecture diagrams

This skill produces the kind of figure seen in CV papers: tensors drawn as
oblique 3D boxes whose height, depth and thickness follow H, W and C, layers
glued together inside a stage, arrows between stages, dashed cones that show
what a kernel sees. A bundled renderer (`scripts/nn3d.py`) turns a short JSON
spec into SVG plus PNG or PDF. Using it gives consistent geometry: correct
oblique projection, face shading, painter's-order occlusion and dimension labels.
Getting those right by hand in raw SVG is slow and error-prone.

## Workflow

1. **Understand the model and the point of the figure.** Work out the layer
   sequence and the tensor shape after every stage. If the user gave code
   (PyTorch/Keras) or a paper name, derive the shapes yourself. For conv,
   `out = floor((in + 2p - k) / s) + 1`. Wrong shapes in a published figure are
   embarrassing, so double-check them. Then decide what the figure must
   emphasise: the overall pipeline, the spatial shrink / channel growth, a skip
   connection, how a kernel maps to an output pixel. One figure, one message.

2. **Choose the visual vocabulary** (see "Design conventions" below): boxes or
   sheets, what gets glued together, what gets a kernel cone, where flat 2D
   blocks are clearer than 3D.

3. **Write the spec** as a JSON file in the working directory. Read
   `references/spec.md` for every field. Look at `assets/examples/*.json` for
   VGG-16, LeNet-5 (sheets and kernel cones), U-Net (two-level layout and
   skips), a ResNet block (residual arc and add node), ViT (tokens and blocks)
   a convolution explainer with numeric grids (`conv_op`), a
   receptive-field explainer with glass tensors and callouts
   (`conv_receptive_field`), a thesis-style ResNet-18 with brace groups and
   serif font (`resnet18`), a model drawn from PyTorch code with `H×W×C`
   shape labels (`cifar_cnn`), and a two-row Faster R-CNN + FPN detector
   (`faster_rcnn_fpn`, where P-levels are placed under their C-levels with
   explicit `x`). Starting from the closest
   example is usually fastest.

4. **Render and check:**
   ```bash
   python <skill-dir>/scripts/nn3d.py fig.json -o fig.svg --png --check
   ```
   Add `--pdf` when the figure is for LaTeX or a paper, since a vector PDF
   drops straight into `\includegraphics`. `--check` lists text labels that
   collide.

5. **Look at the PNG** with the image viewer (Read tool) before showing
   anyone. Look for labels that collide or sit on top of arrows, arrows that
   are too short to read (raise `gap`), boxes that are too similar in size to
   show the shrink (adjust `spatial_px` / `channel_px`), and long or
   meaningless runs of identical layers (compress them). Fix the spec and
   re-render. Usually one or two passes are enough.

6. **Deliver** the SVG (editable and scalable) plus the PNG (or PDF). Mention
   briefly that the JSON spec can be edited to tweak the figure.

If the user wants LaTeX/TikZ source specifically (e.g. PlotNeuralNet style),
you can still use this skill's conventions, but write TikZ. Otherwise prefer the
renderer.

## Design conventions (why these choices)

**Axes.** A tensor H×W×C is drawn with C as the *thickness* (left to right,
along the data flow), H as the height, and W as the receding depth axis. That
way a stage gets visibly thinner in space and thicker in channels as the
network deepens, which is the story most CNN figures tell. `dims` is always
`[H, W, C]`.

**Scale.** Real sizes span two or three orders of magnitude (224 px → 7 px,
3 → 2048 channels), so sizes are mapped on a log scale between pixel limits
by default. Keep this unless the user wants proportional sizes. If everything
looks alike, widen `spatial_px` / `channel_px`. If the figure is huge, narrow
them.

**Box vs sheets.**
- *Boxes* (default) suit modern deep nets (VGG, ResNet, U-Net, YOLO backbones).
- *Sheets* (`"style": "sheets"`) draw a few separated feature maps. They are
  the classic LeNet/AlexNet look and best when channel counts are small or when
  you want kernel cones landing on a visible map. RGB inputs automatically
  become three tinted R/G/B sheets.

**Glue what belongs to one stage.** Repeated convs use `repeat`. Activations
use `"act": "relu"`, which adds the thin darker slab PlotNeuralNet popularised.
A pooling layer that ends a stage uses `"attach": true` (no arrow, touching the
previous box). Arrows then mark only the transitions between stages, which
keeps the figure calm.

**Compress depth.** Don't draw 50 boxes for ResNet-50. Draw one box per stage
with a label like `"conv3_x\n×4"`, or use a `text` node with `⋯` between
representative stages. A reader should be able to parse the figure in five
seconds.

**Colour = layer type,** consistently across the figure (conv yellow, pool
red, activation orange, upsample teal, fc blue, output purple, attention pink,
embedding green). Override `color` only to make a semantic point, such as
highlighting the part a paper contributes. Add `"legend": true` when there are
3 or more types.

**Kernel cones** (`"kind": "kernel"` edges) explain receptive fields: a patch
on one tensor's H×W face connects to a point (or patch) on the next. Use one
or two per figure, because they draw the eye strongly. Add `"grid": 3` to a
region to show the 3×3 cells, and `"depth"` to show the kernel's channel extent
as a cube. For explanatory figures (lectures, blog posts on how convolution or
pooling works), make the tensors `"glass": true`. See-through faces with dashed
hidden edges let the kernel cube and the cone endings show inside the volumes.
`notes` callouts with leader lines carry the explanation ("one output value").
Architecture overviews keep solid boxes.

**Flat elements** for things without a meaningful spatial tensor: `block` for
"Transformer Encoder ×12", "RPN" or "MLP head"; `op` circles for ⊕ add /
⊗ multiply / concat; `tokens` for sequences (ViT, DETR queries); `grid` for
numeric matrices in convolution, pooling, stride or padding explainers. A
pure 2D pipeline with no CNN tensors at all is fine too: blocks and arrows are
fully supported.

**Labels.** Keep them short: layer name on the first line, an optional second
line for the op (`"conv 3×3, s=2"`). Hide dimension labels where they only
repeat (`"show_dims": false` or `"c"`). Dimension text is deliberately small
and grey, so it supports the figure without competing with it. Two
dimension styles exist: numbers on the box edges (the classic look) or
`"dim_style": "shape"`, one `H×W×C` line under each tensor. Prefer `shape` when
stages are glued together or the figure is dense, because readers find a full
shape string faster than three numbers scattered around a box. Every stage's
output shape should be readable somewhere in the figure. Pooled sizes are a
common casualty, which is why attached nodes print their shape above the
stage automatically.

**Paper and thesis figures.** Match the document: for LaTeX, set
`"font": "'Latin Modern Roman', 'CMU Serif', 'Times New Roman', serif"` and
export `--pdf`. Name runs of repeated blocks with a brace group
(`"brace": true`) instead of labelling every block. Leave out the title when
the figure will have a caption.

**Layout.** Nodes flow left→right automatically. Use `"y"` (pixels, positive
= down) to place nodes on other rows, as in U-Net, FPN or two-branch
networks. Edges between rows route themselves at right angles. Use
`"route": "over"` / `"under"` for residual skips that arc around the nodes in
between. Use `groups` (dashed rounded rectangles) to name parts such as
"Backbone", "Neck", "Head", "Encoder" and "Decoder".

## When the renderer isn't enough

The SVG is plain and well-structured, so small additions (an extra annotation,
a brace, a photo thumbnail) can be patched into the SVG directly after
rendering. A real input image can be pasted onto the H×W face of the input
tensor with `"image": "path/to/photo.jpg"`. Larger or exotic layouts (3D
point-cloud nets, graph diagrams) may be better hand-written in SVG. Even
then, keep this skill's visual language: the same oblique angle (40°, depth
ratio 0.55), the shading (top face lighter, side face darker) and the colours
per layer type, so the figures match.

Files in this skill

  • SKILL.md8.9 KB
  • assets/examples/cifar_cnn.json1 KB
  • assets/examples/conv_op.json1.1 KB
  • assets/examples/conv_receptive_field.json1.2 KB
  • assets/examples/faster_rcnn_fpn.json5.7 KB
  • assets/examples/lenet5.json1.2 KB
  • assets/examples/resnet18.json2.7 KB
  • assets/examples/resnet_block.json610 B
  • assets/examples/unet.json1.8 KB
  • assets/examples/vgg16.json1.3 KB
  • assets/examples/vit.json777 B
  • references/spec.md9.9 KB
  • scripts/nn3d.py54.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.