Explain
Explain the topic for someone seeing it for the first time, in plain terms. No filler.
The output is one self-contained HTML file under ~/explain/.
Diagrams are compiled, not drawn. You describe what a diagram means; compile.py
computes every pixel. Never hand-write <svg> for structure, and never write coordinates,
viewBox, or path data.
Topic: $ARGUMENTS
Steps
Research. Ground every claim in a source you actually checked: files in the repo,
docs, or pages you read. If the topic is code, read the code.
Draft the prose to ~/explain/<topic-slug>/doc.draft.html — plain HTML, no CSS, no
JS. Where a picture beats a paragraph, put a placeholder alone on its own line:
{{diagram: pipeline.architecture.json}}
Skip the diagram when the prose already says it.
Write one JSON per placeholder beside the draft, named <name>.<type>.json, with
semantics only. See reference.md for fields and a worked example per type. When
explaining code, cite it with src: "path/to/file.py:42"; the path is checked against
--root.
Compile with compile.py from this skill's directory
(${CLAUDE_PLUGIN_ROOT}/skills/explain/compile.py when the plugin root is set):
python3 <this skill dir>/compile.py ~/explain/<topic-slug>/doc.draft.html [--root <repo>]
--root is only needed when diagrams cite src. It writes index.html beside the
draft. Keep the draft and JSONs so the page can be regenerated.
Fix by rule code. A non-zero exit lists every problem with its fix. Edit the JSON
(shorten a label, move a node's row, correct a src, split the diagram) and re-run
until clean.
Report the output path.
Rules
- Labels are printable ASCII: ≤48 chars for nodes, ≤32 for edges, ≤91 for titles.
- One idea per diagram, six to twelve nodes. Split rather than crowd.
- Width is capped at 960px; length is free. On
E_TOO_WIDE, shorten labels in the
widest rank or split the diagram. Sequences scroll sideways instead; keep them to three
or four participants.
- Omit
rank and row unless the default layout reads badly. Then hint every node or
none, and keep connected nodes on different ranks.
- Mark loops and retries with
"back": true.
- No JS, no CDN, no network. The page must open offline.
Charts
The compiler handles structure, not numbers. For a bar or line chart, hand-write inline
<svg> in the draft; the compiler leaves it alone. Style it yourself: a font-family,
fill:currentColor, width near 900px, and ~16px text to match the prose.
1---2name: explain3description: Explain any topic simply for a newcomer — a concept, a system, a process, or part of a codebase — and save it as an HTML page with compiled architecture, workflow, sequence, data-flow, and lifecycle diagrams. Use when the user types /explain <topic>.4---56# Explain78Explain the topic for someone seeing it for the first time, in plain terms. No filler.9The output is one self-contained HTML file under `~/explain/`.1011Diagrams are **compiled, not drawn**. You describe what a diagram means; `compile.py`12computes every pixel. Never hand-write `<svg>` for structure, and never write coordinates,13`viewBox`, or path data.1415Topic: $ARGUMENTS1617## Steps18191. **Research.** Ground every claim in a source you actually checked: files in the repo,20 docs, or pages you read. If the topic is code, read the code.21222. **Draft the prose** to `~/explain/<topic-slug>/doc.draft.html` — plain HTML, no CSS, no23 JS. Where a picture beats a paragraph, put a placeholder alone on its own line:2425 {{diagram: pipeline.architecture.json}}2627 Skip the diagram when the prose already says it.28293. **Write one JSON per placeholder** beside the draft, named `<name>.<type>.json`, with30 semantics only. See `reference.md` for fields and a worked example per type. When31 explaining code, cite it with `src: "path/to/file.py:42"`; the path is checked against32 `--root`.33344. **Compile** with `compile.py` from this skill's directory35 (`${CLAUDE_PLUGIN_ROOT}/skills/explain/compile.py` when the plugin root is set):3637 python3 <this skill dir>/compile.py ~/explain/<topic-slug>/doc.draft.html [--root <repo>]3839 `--root` is only needed when diagrams cite `src`. It writes `index.html` beside the40 draft. Keep the draft and JSONs so the page can be regenerated.41425. **Fix by rule code.** A non-zero exit lists every problem with its fix. Edit the JSON43 (shorten a label, move a node's `row`, correct a `src`, split the diagram) and re-run44 until clean.45466. **Report** the output path.4748## Rules4950- **Labels are printable ASCII**: ≤48 chars for nodes, ≤32 for edges, ≤91 for titles.51- **One idea per diagram**, six to twelve nodes. Split rather than crowd.52- **Width is capped at 960px**; length is free. On `E_TOO_WIDE`, shorten labels in the53 widest rank or split the diagram. Sequences scroll sideways instead; keep them to three54 or four participants.55- **Omit `rank` and `row`** unless the default layout reads badly. Then hint every node or56 none, and keep connected nodes on different ranks.57- **Mark loops and retries** with `"back": true`.58- **No JS, no CDN, no network.** The page must open offline.5960## Charts6162The compiler handles structure, not numbers. For a bar or line chart, hand-write inline63`<svg>` in the draft; the compiler leaves it alone. Style it yourself: a `font-family`,64`fill:currentColor`, width near 900px, and ~16px text to match the prose.