Skip to content

Editorial diagram design for Claude Code, Codex, GitHub Copilot, Cursor, Factory Droid, Qoder, and Pi. 45 diagram types. Self-contained HTML + SVG. No shadows. No Mermaid slop.

feat: add a waterfall chart visual type (#191)

Matt Van Horn48fecccda7bd
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 26f8c2a..a958b68 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -1,7 +1,7 @@
{
"name": "diagram-design",
"metadata": {
- "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling."
+ "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling."
},
"owner": {
"name": "Cathryn Lavery"
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index d0b5257..3649445 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "diagram-design",
- "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
+ "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
"version": "2.6.18",
"author": {
"name": "Cathryn Lavery",
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 668fe83..34f4b04 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "diagram-design",
- "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
+ "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
"version": "2.6.18",
"author": {
"name": "Cathryn Lavery",
@@ -26,7 +26,7 @@
"interface": {
"displayName": "Diagram Design",
"shortDescription": "Create editorial technical and product diagrams as standalone HTML.",
- "longDescription": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
+ "longDescription": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
"developerName": "Cathryn Lavery",
"category": "Productivity",
"capabilities": [
diff --git a/.factory-plugin/plugin.json b/.factory-plugin/plugin.json
index d0b5257..3649445 100644
--- a/.factory-plugin/plugin.json
+++ b/.factory-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "diagram-design",
- "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
+ "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
"version": "2.6.18",
"author": {
"name": "Cathryn Lavery",
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d680c85..4946895 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -296,6 +296,16 @@ jobs:
id: sankey_tests
run: python scripts/test-verify-sankey.py
+ - name: Verify waterfall running-total conservation
+ if: always()
+ id: waterfall
+ run: python scripts/verify-waterfall.py --all
+
+ - name: Verify waterfall checker
+ if: always()
+ id: waterfall_tests
+ run: python scripts/test-verify-waterfall.py
+
- name: Verify ridgeline shared amplitude
if: always()
id: ridgeline
@@ -427,6 +437,8 @@ jobs:
echo "| Slopegraph Checker | ${{ steps.slopegraph_tests.outcome == 'success' && '✅ Passed' || (steps.slopegraph_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Sankey Flow Conservation | ${{ steps.sankey.outcome == 'success' && '✅ Passed' || (steps.sankey.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Sankey Checker | ${{ steps.sankey_tests.outcome == 'success' && '✅ Passed' || (steps.sankey_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| Waterfall Running-Total Conservation | ${{ steps.waterfall.outcome == 'success' && '✅ Passed' || (steps.waterfall.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| Waterfall Checker | ${{ steps.waterfall_tests.outcome == 'success' && '✅ Passed' || (steps.waterfall_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Ridgeline Shared Amplitude | ${{ steps.ridgeline.outcome == 'success' && '✅ Passed' || (steps.ridgeline.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Ridgeline Checker | ${{ steps.ridgeline_tests.outcome == 'success' && '✅ Passed' || (steps.ridgeline_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Bubble Position & Area | ${{ steps.bubble.outcome == 'success' && '✅ Passed' || (steps.bubble.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
diff --git a/.maintainer-policy.json b/.maintainer-policy.json
index 95060f4..f8d908e 100644
--- a/.maintainer-policy.json
+++ b/.maintainer-policy.json
@@ -78,6 +78,8 @@
"python3 scripts/test-verify-ridgeline.py",
"python3 scripts/verify-sankey.py --all",
"python3 scripts/test-verify-sankey.py",
+ "python3 scripts/verify-waterfall.py --all",
+ "python3 scripts/test-verify-waterfall.py",
"python3 scripts/verify-bubble.py --all",
"python3 scripts/test-verify-bubble.py",
"python3 scripts/verify-bump.py --all",
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b03441a..7964bce 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,7 +8,7 @@ Please read [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) first. All contributions ar
## What this project is
-Diagram Design is an agent skill (Claude Code, Codex, Factory Droid, Pi) that produces editorial-quality diagrams as self-contained HTML files. The repo is documentation-first: `skills/diagram-design/SKILL.md` is the index, each of the 39 visual types has its own reference file, and the extractor scripts in `skills/diagram-design/scripts/` turn draw.io and Mermaid sources into a structured IR.
+Diagram Design is an agent skill (Claude Code, Codex, Factory Droid, Pi) that produces editorial-quality diagrams as self-contained HTML files. The repo is documentation-first: `skills/diagram-design/SKILL.md` is the index, each of the 40 visual types has its own reference file, and the extractor scripts in `skills/diagram-design/scripts/` turn draw.io and Mermaid sources into a structured IR.
See [README.md](README.md) for the full picture, including the design system and the import/export flows.
@@ -69,6 +69,8 @@ Every validation gate below must pass before a PR is ready. They also run automa
| Ridgeline checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-ridgeline.py` |
| Sankey flow conservation and ribbon geometry | `python3 scripts/verify-sankey.py --all` |
| Sankey checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-sankey.py` |
+| Waterfall running-total conservation and signed-bridge geometry | `python3 scripts/verify-waterfall.py --all` |
+| Waterfall checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-waterfall.py` |
| Bubble positions sit on shared axis scales and area encodes every declared size | `python3 scripts/verify-bubble.py --all` |
| Bubble checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-bubble.py` |
| Bump vertices sit exactly on one rank grid and every endpoint label is placed on both axes | `python3 scripts/verify-bump.py --all` |
@@ -126,6 +128,8 @@ python3 scripts/test-plugin-package.py \
&& python3 scripts/test-verify-ridgeline.py \
&& python3 scripts/verify-sankey.py --all \
&& python3 scripts/test-verify-sankey.py \
+ && python3 scripts/verify-waterfall.py --all \
+ && python3 scripts/test-verify-waterfall.py \
&& python3 scripts/verify-bubble.py --all \
&& python3 scripts/test-verify-bubble.py \
&& python3 scripts/verify-bump.py --all \
@@ -141,7 +145,7 @@ python3 scripts/test-plugin-package.py \
- **`verify-plugin-package.py`:** if it reports a version change, drop the manifest edits from your branch — versions are bumped on `main` after merge, never in a PR. If packaging validation fails, keep all native marketplaces pointed at the repository root and keep the shared skill at `skills/diagram-design/SKILL.md`.
- **`lint-skin.py`:** the failure message names the file, line, and category (`color`, `font-family`, `a11y`, `external-asset`, `pure-black`, `script`). Colors must come from the palette in `skills/diagram-design/references/style-guide.md`; fonts from the allowed list; diagrams must satisfy the accessible SVG contract (see below). The linter also requires the SHA-pinned controller from `template-motion.html` verbatim and rejects remote resources, CSS `@import`, non-fragment CSS `url()`, event handlers, `srcdoc`, executable URLs, and extra scripts.
- **`verify-*.py`:** the extractor's real behavior no longer matches its fixture or the documentation, or the reference/command/prompt wiring drifted. Fix the source of truth — do not widen a test to avoid a failure.
-- **`verify-screenshot-freshness.py`:** a canonical minimal-light example or its committed PNG changed without a synchronized catalog refresh. Before the first regeneration, install the renderer with `python3 -m pip install playwright && python3 -m playwright install chromium`. Then run `python3 scripts/render-canonical-screenshots.py`, inspect all 39 renders, and commit the updated PNGs plus `docs/screenshots/manifest.json`.
+- **`verify-screenshot-freshness.py`:** a canonical minimal-light example or its committed PNG changed without a synchronized catalog refresh. Before the first regeneration, install the renderer with `python3 -m pip install playwright && python3 -m playwright install chromium`. Then run `python3 scripts/render-canonical-screenshots.py`, inspect all 40 renders, and commit the updated PNGs plus `docs/screenshots/manifest.json`.
- **`build-readme-thumbs.py --check`:** a README preview is missing, stale, corrupt, the wrong size, orphaned, or no longer links to its full PNG. Install the pinned renderer with `python3 -m pip install Pillow==12.1.1`, run `python3 scripts/build-readme-thumbs.py`, inspect the preview changes, and commit the WebPs plus `docs/screenshots/thumbs/manifest.json`.
- **`verify-slopegraph.py`:** the two axes disagree about scale or origin, or an endpoint is drawn somewhere other than where its own declared value belongs. Fix the coordinate, never the label — and never move a point to stop two endpoint labels colliding, because crowded labels mean the values really are close.
- **`verify-ridgeline.py`:** a ridge is drawn on its own amplitude, a baseline sits off the stack's pitch or away from its drawn rule, a ridge is sampled on its own x positions, or a printed range is wider than the bins it claims. Fix the geometry or the declaration so they state one thing — never renormalise a single ridge to make it readable, and never move a baseline to buy one ridge headroom.
diff --git a/README.md b/README.md
index 57e70d7..17ac8b3 100644
--- a/README.md
+++ b/README.md
@@ -100,6 +100,11 @@ All 39 visual types ship in three static variants: minimal light, minimal dark,
<td align="center"><a href="docs/screenshots/db-schema.png"><img src="docs/screenshots/thumbs/db-schema.webp" alt="Database schema"></a><br><b>Database schema</b><br><sub>Physical tables + column FKs</sub></td>
<td align="center"><a href="docs/screenshots/polar.png"><img src="docs/screenshots/thumbs/polar.webp" alt="Polar chart"></a><br><b>Polar chart</b><br><sub>Cyclic magnitude · linear radius</sub></td>
</tr>
+<tr>
+ <td align="center" width="33%"><a href="docs/screenshots/waterfall.png"><img src="docs/screenshots/thumbs/waterfall.webp" alt="Waterfall"></a><br><b>Waterfall</b><br><sub>Running total + signed bridges</sub></td>
+ <td align="center" width="33%"></td>
+ <td align="center" width="33%"></td>
+</tr>
</table>
The v2.5.10 release added the final ten types above. Compare their light, dark, and full-editorial variants in the [30-variant contact sheet](.github/pr-previews/editorial-diagrams-2.5.10.jpg).
@@ -457,6 +462,8 @@ diagram-design/
│ ├── test-verify-polar.py — polar gate adversarial tests
│ ├── verify-sankey.py — Sankey conservation + geometry gate
│ ├── test-verify-sankey.py — Sankey gate adversarial tests
+│ ├── verify-waterfall.py — waterfall running-total + bridge gate
+│ ├── test-verify-waterfall.py — waterfall gate adversarial tests
│ ├── test-verify-docs-sync.py — docs/routing-surface gate tests
│ └── fixtures/
│ ├── sample-flowchart.mmd
@@ -487,6 +494,7 @@ behavior, resource caps, named failures, and reference/command wiring.
Label placement is gated geometrically: `python3 scripts/verify-geometry.py --all` fails CI when a label mask overlaps a node declared later in the document, because the node fill would clip the text at render time. `python3 scripts/test-verify-geometry.py` keeps that checker honest in both directions.
Diagrams using the traceable block decomposition pattern get a structural gate on top of that: `python3 scripts/verify-block-registry.py --all` fails CI on a duplicate `data-block-id`, a `data-block-parent` that doesn't resolve to another block in the same file, a cycle in the parent chain, a blank `data-block-id`, or a missing or blank `data-block-name` — the same defects that would make `--registry`'s exported JSON (see [`export-registry.md`](skills/diagram-design/references/export-registry.md)) misrepresent the tree it claims to describe. `python3 scripts/test-verify-block-registry.py` keeps that checker honest in both directions.
Treemaps get a second geometric gate, because their whole claim is that area *is* the encoding: `python3 scripts/verify-treemap.py --all` fails CI when a cell's share of the drawn area doesn't match the value printed inside it, or when a label overruns the cell it names. It measures area error as a *relative* figure — an absolute one passes exactly the small cells most likely to be wrong. `python3 scripts/test-verify-treemap.py` keeps it honest in both directions.
+Waterfalls get the same treatment, because their whole claim is that the running total is conserved: `python3 scripts/verify-waterfall.py --all` fails CI when the declared start, deltas, and end don't reconcile, when a bridge bar is drawn anywhere other than its two running levels on the shared scale, when a carry connector is missing or sits at the wrong level, when a delta prints without an explicit sign, or when the two directions collapse into one fill. `python3 scripts/test-verify-waterfall.py` keeps it honest in both directions.
Docs and routing surfaces are themselves gated: `python3 scripts/verify-docs-sync.py` fails CI if the SKILL.md description loses a type's lexical hook, the gallery can't reach a shipped example, the README tree names a file that doesn't exist, a relative reference link is broken, a scanner-visible support path is not shipped inside the skill package, or any command/prompt surface drifts from its routed reference. `python3 scripts/test-verify-docs-sync.py` exercises those newer checks adversarially, including the strict-bundler behavior used by Hermes Agent. The skill also ships `skills/diagram-design/scripts/self_check.py` — a distilled output checker installed agents can run on their own generated diagrams; `python3 scripts/test-self-check.py` keeps it honest. Settled design decisions (why one pinned controller, why patterns never add types, the autoplay policy, the SKILL.md byte cap, why label placement is verified geometrically, and why client profiles use marker-first resolution) live as short ADRs in `docs/adr/` — read them before relitigating one, add one when you settle a new policy.
All pull requests and pushes are automatically validated across Linux, Windows, and macOS runners via GitHub Actions CI (`.github/workflows/ci.yml`).
diff --git a/docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md b/docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md
index eb1bd87..86ad0ec 100644
--- a/docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md
+++ b/docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md
@@ -26,4 +26,6 @@ Behavior is a separate axis. The semantic patterns in `references/semantic-patte
**2026-08-31 — the pattern count is eight.** Traceable block decomposition was added: hierarchical, ID-addressable block decomposition with per-block I/O, constraints, and an implementation-code link, for compliance, audit, or IP-style documentation. It routes to the existing Tree type — SysML-informed vocabulary (block, noun-phrase naming, flow port) applied to Tree's existing layout grammar, not a new grammar and not a claim of SysML or IDEF0 conformance. This is the first amendment to the *pattern* count specifically (every prior amendment above moved the *type* count); the mechanism is the same one-line-plus-routing-row cost this ADR's Decision describes, and `verify-semantic-motion.py`'s `PATTERN_NAMES` list is its enforcement, the same way the type counters enforce the type count. See [ADR 0010](0010-block-registry-metadata-contract.md).
+**2026-09-06 — the count is 40.** Waterfall was admitted under the same escape clause: a running total anchored by start/end bars and bridged by signed floating deltas is a layout grammar no existing type provides (bar compares independent categories, the dumbbell states two endpoints without the path, pyramid ranks one funnel, Sankey splits and merges). The per-grammar argument is in [ADR 0011](0011-waterfall-is-a-running-total-grammar.md); it ships the full §10 set, and the counters named above move 39 → 40 together with the prose.
+
The decision itself is unchanged — semantic patterns still never add a type, and the count still moves only for a new *layout* grammar. What this amendment records is the procedure: the two counters are this ADR's enforcement, so a PR that edits them without amending this file has quietly made itself the authority. Amend here in the same PR, or the number in the test is just whatever the last contributor typed.
diff --git a/docs/adr/0011-waterfall-is-a-running-total-grammar.md b/docs/adr/0011-waterfall-is-a-running-total-grammar.md
new file mode 100644
index 0000000..9b436da
--- /dev/null
+++ b/docs/adr/0011-waterfall-is-a-running-total-grammar.md
@@ -0,0 +1,35 @@
+# ADR 0011 — Waterfall is a running-total grammar, not a bar variant
+
+**Status:** accepted
+
+## Context
+
+Issue #187 asked for signed contribution bridges — a budget P&L walk, headcount deltas, conversion leak/gain — where a reader sees how a start total becomes an end total. ADR 0002 sets the bar for growth: a new type is justified only when a genuinely new **layout grammar** appears; a new *behavior* is a semantic pattern routed onto an existing type.
+
+The nearest candidates were audited against that bar:
+
+- **Bar** compares independent categories against one baseline; nothing forces the bars to reconcile.
+- **Dumbbell** (a Bar variant) states exactly two endpoints and the distance between them — it deliberately hides what happened in between. Its own reference says the connector "encodes the distance between two values and nothing about what lies between them."
+- **Pyramid / funnel** ranks a monotonic drop-off; a waterfall's contributions change sign.
+- **Sankey** conserves a quantity that splits and merges across stages; a waterfall is strictly sequential, one running scalar, no branching.
+- A **stacked bar** shows parts of one total at one moment; it cannot state a path.
+
+No existing grammar forces (a) totals anchored at the domain floor, (b) bridge bars floating between two running levels, and (c) the running total carried across every gap. Those three constraints *are* the figure.
+
+## Decision
+
+Add **Waterfall** as visual type #40 with the full §10 shipping set: `references/type-waterfall.md`, the three example variants, a gallery tab, the selection-table row and frontmatter hook, a §7 budget row (8 bars including both totals, at most 1 subtotal), the canonical screenshot, and an executable contract.
+
+The grammar is declared, not inferred: each bar states `data-role` (`total` / `delta` / `subtotal`), a signed `data-value`, and `data-name`; each connector states the running total it transports in `data-carry`. `scripts/verify-waterfall.py` recomputes the walk from the declarations and fails on conservation, scale, bridge-geometry, carry, printed-label, or sign-treatment drift; `scripts/test-verify-waterfall.py` proves both polarities per ADR 0005.
+
+Two scoped departures, mirroring the dumbbell's precedents:
+
+- **Sign is encoded by fill weight, not hue** — increases take the bar family's default tint, decreases are hollow — so direction survives greyscale and colour-vision deficiency, and the accent stays editorial (≤1 focal bridge).
+- **Data coordinates round to the nearest pixel and are exempt from the 4px layout grid**; snapping a running level moves money that does not exist.
+
+## Consequences
+
+- The verifiable count moves to 40 in `verify-docs-sync.py`, `verify-semantic-motion.py`, the screenshot catalog scripts, and ADR 0002's amendment log — a conscious edit, by design.
+- The ADR 0004 byte cap was paid the ADR 0007 way, by trimming SKILL.md body prose (an illustrative §6 rule-5 example clause and the §10 consultant-row detail, both of which live in full in their routed references) — never the frontmatter description.
+- `type-bar.md` needed no scope edit: its dumbbell section already disclaims the in-between path, and `type-waterfall.md` routes the two-endpoint case back to it, so the router stays unambiguous in both directions.
+- Waterfall obeys §6 in full; its horizontal carries connect bars that share a y-level, which is the case plain straight lines are reserved for.
diff --git a/docs/cookbook.md b/docs/cookbook.md
index 238bffd..f58917f 100644
--- a/docs/cookbook.md
+++ b/docs/cookbook.md
@@ -138,7 +138,7 @@ Then: propose the style-guide diff, wait for approval, write `references/style-g
## R4. Selection cheat sheet
-Do not duplicate the 39-type table here. Open [SKILL.md §3](../skills/diagram-design/SKILL.md) and pick one layout grammar.
+Do not duplicate the 40-type table here. Open [SKILL.md §3](../skills/diagram-design/SKILL.md) and pick one layout grammar.
**Behavior first** (then nearest type):
diff --git a/docs/pr-previews/waterfall/waterfall-dark.png b/docs/pr-previews/waterfall/waterfall-dark.png
new file mode 100644
index 0000000..d854cf3
Binary files /dev/null and b/docs/pr-previews/waterfall/waterfall-dark.png differ
diff --git a/docs/pr-previews/waterfall/waterfall-full.png b/docs/pr-previews/waterfall/waterfall-full.png
new file mode 100644
index 0000000..f080428
Binary files /dev/null and b/docs/pr-previews/waterfall/waterfall-full.png differ
diff --git a/docs/pr-previews/waterfall/waterfall-light.png b/docs/pr-previews/waterfall/waterfall-light.png
new file mode 100644
index 0000000..41f095d
Binary files /dev/null and b/docs/pr-previews/waterfall/waterfall-light.png differ
diff --git a/docs/screenshots/manifest.json b/docs/screenshots/manifest.json
index f616b6e..1334370 100644
--- a/docs/screenshots/manifest.json
+++ b/docs/screenshots/manifest.json
@@ -182,6 +182,15 @@
"width": 2400,
"height": 1202
},
+ {
+ "slug": "waterfall",
+ "source": "skills/diagram-design/assets/example-waterfall.html",
+ "screenshot": "docs/screenshots/waterfall.png",
+ "source_sha256": "10c4445b0582ddd6644ac734914c3549e9eb39075ee6e258ea78044a43c0ca3d",
+ "screenshot_sha256": "41a9d0c428b86fd8d75a301ca91c9b69e05376e931c67f7821b4c561f4b12b7e",
+ "width": 2400,
+ "height": 1202
+ },
{
"slug": "treemap",
"source": "skills/diagram-design/assets/example-treemap.html",
diff --git a/docs/screenshots/thumbs/manifest.json b/docs/screenshots/thumbs/manifest.json
index b408a6b..51c04c1 100644
--- a/docs/screenshots/thumbs/manifest.json
+++ b/docs/screenshots/thumbs/manifest.json
@@ -365,6 +365,15 @@
"height": 276,
"quality": 82,
"thumb_sha256": "1071b9c9ef8d4b25ab1d59192e2f913530649765584f1a6474c78f61d4ebb9ef"
+ },
+ {
+ "thumb": "waterfall.webp",
+ "source": "docs/screenshots/waterfall.png",
+ "source_sha256": "41a9d0c428b86fd8d75a301ca91c9b69e05376e931c67f7821b4c561f4b12b7e",
+ "width": 600,
+ "height": 300,
+ "quality": 82,
+ "thumb_sha256": "b0c09eaec9b9ee1c8853f922e658d22d5c4dc033b86aa709fc49efb896d836fc"
}
]
}
diff --git a/docs/screenshots/thumbs/waterfall.webp b/docs/screenshots/thumbs/waterfall.webp
new file mode 100644
index 0000000..3baf4fc
Binary files /dev/null and b/docs/screenshots/thumbs/waterfall.webp differ
diff --git a/docs/screenshots/waterfall.png b/docs/screenshots/waterfall.png
new file mode 100644
index 0000000..1cb75ae
Binary files /dev/null and b/docs/screenshots/waterfall.png differ
diff --git a/scripts/lint-render.py b/scripts/lint-render.py
index c8f7713..3a77d6f 100755
--- a/scripts/lint-render.py
+++ b/scripts/lint-render.py
@@ -710,6 +710,65 @@ def gallery_mobile_failures(context, gallery_path=None):
return failures
+def waterfall_mobile_failures(context, waterfall_paths=None):
+ """Keep waterfall labels readable while containing its wide plot locally."""
+ paths = waterfall_paths or sorted(ASSET_DIR.glob("example-waterfall*.html"))
+ failures = []
+ for path in paths:
+ page = context.new_page()
+ page.set_viewport_size({"width": 390, "height": 844})
+ try:
+ page.goto(path.as_uri(), wait_until="load")
+ facts = page.evaluate(
+ """
+ () => {
+ const doc = document.documentElement;
+ const svg = document.querySelector('svg');
+ if (!svg) return { missingSvg: true };
+ let ancestor = svg.parentElement;
+ let localScroller = false;
+ while (ancestor && ancestor !== document.body) {
+ const overflow = getComputedStyle(ancestor).overflowX;
+ if ((overflow === 'auto' || overflow === 'scroll') &&
+ ancestor.scrollWidth > ancestor.clientWidth + 1) {
+ localScroller = true;
+ break;
+ }
+ ancestor = ancestor.parentElement;
+ }
+ return {
+ missingSvg: false,
+ pageOverflow: doc.scrollWidth - doc.clientWidth,
+ svgWidth: svg.getBoundingClientRect().width,
+ localScroller,
+ };
+ }
+ """
+ )
+ finally:
+ page.close()
+
+ shown_path = display_path(path)
+ if facts["missingSvg"]:
+ failures.append(f"{shown_path}: waterfall-mobile-svg: no SVG found")
+ continue
+ if facts["pageOverflow"] > TOLERANCE:
+ failures.append(
+ f"{shown_path}: waterfall-mobile-page-overflow: page extends "
+ f"{facts['pageOverflow']:.1f}px past the 390px viewport"
+ )
+ if facts["svgWidth"] < 720:
+ failures.append(
+ f"{shown_path}: waterfall-mobile-legibility: SVG shrinks to "
+ f"{facts['svgWidth']:.1f}px; preserve at least 720px for its 8px labels"
+ )
+ if not facts["localScroller"]:
+ failures.append(
+ f"{shown_path}: waterfall-mobile-containment: wide SVG needs a local horizontal scroller"
+ )
+ return failures
+
+
def self_test(context):
page = context.new_page()
failures = []
@@ -782,6 +841,35 @@ def self_test(context):
checks += 1
failures += gallery_mobile_failures(context)
+ # The waterfall uses 8px SVG labels, so shrinking its 1000-unit canvas to
+ # a phone width is not a responsive layout. Keep it readable and scroll it
+ # inside a local container without widening the document.
+ checks += 2
+ with tempfile.TemporaryDirectory() as directory:
+ directory_path = Path(directory)
+ broken = directory_path / "example-waterfall-broken.html"
+ broken.write_text(
+ '<!DOCTYPE html><html><style>body{margin:0}svg{width:100%;min-width:760px;display:block}</style>'
+ '<body><svg viewBox="0 0 1000 500"></svg></body></html>',
+ encoding="utf-8",
+ )
+ if not waterfall_mobile_failures(context, [broken]):
+ failures.append("waterfall-mobile-broken-fixture: page overflow was not reported")
+
+ contained = directory_path / "example-waterfall-contained.html"
+ contained.write_text(
+ '<!DOCTYPE html><html><style>body{margin:0}.wrap{width:100%;overflow-x:auto}'
+ 'svg{width:100%;min-width:760px;display:block}</style><body><div class="wrap">'
+ '<svg viewBox="0 0 1000 500"></svg></div></body></html>',
+ encoding="utf-8",
+ )
+ contained_failures = waterfall_mobile_failures(context, [contained])
+ if contained_failures:
+ failures.append(
+ "waterfall-mobile-contained-fixture: false finding: "
+ + "; ".join(contained_failures)
+ )
+
# A broken route should be a targeted failure, not a delayed Playwright
# timeout or traceback that escapes the self-test report.
checks += 1
@@ -866,6 +954,12 @@ def main():
shown_path = display_path(path)
for category, message in findings:
print(f"{shown_path}: {category}: {message}")
+ if args.all:
+ mobile_failures = waterfall_mobile_failures(context)
+ total_findings += len(mobile_failures)
+ if not args.quiet:
+ for failure in mobile_failures:
+ print(failure)
browser.close()
print(
diff --git a/scripts/render-canonical-screenshots.py b/scripts/render-canonical-screenshots.py
index 3a9009f..0c7ec9e 100644
--- a/scripts/render-canonical-screenshots.py
+++ b/scripts/render-canonical-screenshots.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-"""Render the 39 canonical minimal-light examples and record their digests."""
+"""Render the 40 canonical minimal-light examples and record their digests."""
from __future__ import annotations
@@ -21,8 +21,8 @@ from screenshot_catalog import (
def main() -> int:
slugs = canonical_slugs()
- if len(slugs) != 39 or len(slugs) != len(set(slugs)):
- raise SystemExit(f"expected 39 unique canonical types; found {len(slugs)}")
+ if len(slugs) != 40 or len(slugs) != len(set(slugs)):
+ raise SystemExit(f"expected 40 unique canonical types; found {len(slugs)}")
SCREENSHOT_DIR.mkdir(parents=True, exist_ok=True)
entries: list[dict[str, object]] = []
@@ -56,7 +56,7 @@ def main() -> int:
"height": height,
}
)
- print(f"[{index:02d}/39] {slug}: {width}x{height}")
+ print(f"[{index:02d}/40] {slug}: {width}x{height}")
browser.close()
payload = {
diff --git a/scripts/test-verify-motion.py b/scripts/test-verify-motion.py
index 5a4c1fb..a961106 100644
--- a/scripts/test-verify-motion.py
+++ b/scripts/test-verify-motion.py
@@ -402,7 +402,7 @@ def main() -> int:
missing_guide = directory / "missing-guide.md"
missing_guide.write_text(
original_skill.read_text(encoding="utf-8").replace(
- "### Visual-type guide (39)", "### Visual guide"
+ "### Visual-type guide (40)", "### Visual guide"
),
encoding="utf-8",
)
@@ -410,7 +410,7 @@ def main() -> int:
markdown_errors = semantic_module.verify_markdown()
finally:
semantic_module.SKILL = original_skill
- if not any("must contain the 39-row visual-type guide" in error for error in markdown_errors):
+ if not any("must contain the 40-row visual-type guide" in error for error in markdown_errors):
raise AssertionError(f"missing visual-guide anchor was accepted: {markdown_errors}")
print("OK: missing visual-type guide anchor is rejected")
diff --git a/scripts/test-verify-waterfall.py b/scripts/test-verify-waterfall.py
new file mode 100644
index 0000000..5da1949
--- /dev/null
+++ b/scripts/test-verify-waterfall.py
@@ -0,0 +1,224 @@
+#!/usr/bin/env python3
+"""Adversarial tests for verify-waterfall.py — both polarities.
+
+Per ADR 0005, a geometric contract in this repo is a checker plus fixtures
+that prove it fires when it should and stays quiet when it shouldn't. Every
+mutation below is a waterfall that still renders perfectly — the defects are
+arithmetic and geometric lies, which is exactly what no other gate reads.
+
+Usage: python3 scripts/test-verify-waterfall.py
+Exit: 0 all pass, 1 a case failed.
+"""
+
+from __future__ import annotations
+
+import subprocess
+import sys
+import tempfile
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+CHECKER = ROOT / "scripts/verify-waterfall.py"
+GOOD = ROOT / "skills/diagram-design/assets/example-waterfall.html"
+SHIPPED = sorted(GOOD.parent.glob("example-waterfall*.html"))
+
+
+def run(*args: str) -> tuple[int, str]:
+ result = subprocess.run(
+ [sys.executable, str(CHECKER), *args],
+ capture_output=True,
+ text=True,
+ encoding="utf-8",
+ errors="replace",
+ )
+ return result.returncode, (result.stdout or "") + (result.stderr or "")
+
+
+def write(directory: Path, name: str, source: str) -> Path:
+ path = directory / name
+ path.write_text(source, encoding="utf-8")
+ return path
+
+
+def main() -> int:
+ source = GOOD.read_text(encoding="utf-8")
+ failures: list[str] = []
+
+ # Positive polarity: every shipped variant must pass, individually and via --all.
+ for path in SHIPPED:
+ code, output = run(str(path))
+ if code != 0:
+ failures.append(f"shipped example failed: {path.name}\n{output}")
+ else:
+ print(f"OK: shipped {path.name} passes")
+ code, output = run("--all")
+ if code != 0:
+ failures.append(f"--all failed on the shipped set\n{output}")
+ else:
+ print("OK: --all passes on the shipped set")
+
+ # Negative polarity: each mutation must fail with a finding that names the lie.
+ # Every case below is (name, old, new, expected fragment of the finding).
+ cases = (
+ (
+ "conservation break: a delta declares more than the walk absorbs",
+ 'data-role="delta" data-value="+64"',
+ 'data-role="delta" data-value="+70"',
+ "the running total must conserve",
+ ),
+ (
+ "geometry lie: the end total is drawn taller than its value",
+ '<rect x="832" y="196" width="96" height="224" fill="rgba(45,49,66,0.08)"',
+ '<rect x="832" y="160" width="96" height="260" fill="rgba(45,49,66,0.08)"',
+ "shared scale puts",
+ ),
+ (
+ "bridge lie: a bridge is stretched past its two running levels",
+ '<rect x="688" y="146" width="96" height="50" fill="rgba(235,108,54,0.12)"',
+ '<rect x="688" y="146" width="96" height="70" fill="rgba(235,108,54,0.12)"',
+ "shared scale puts",
+ ),
+ (
+ "missing carry: a gap has no connector conserving the total",
+ '<line x1="496" y1="167" x2="544" y2="167" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="266"/>',
+ "",
+ "no carry spans it",
+ ),
+ (
+ "misplaced carry: the connector reconnects the walk at the wrong level",
+ '<line x1="496" y1="167" x2="544" y2="167" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="266"/>',
+ '<line x1="496" y1="146" x2="544" y2="146" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="266"/>',
+ "level sits at",
+ ),
+ (
+ "carry declaration lie: the connector declares a different total",
+ 'data-carry="288"',
+ 'data-carry="266"',
+ "running total between these bars",
+ ),
+ (
+ "printed label mismatch: the text names a value no bar declares",
+ '>+64</text>',
+ '>+46</text>',
+ "no printed label states its value +64",
+ ),
+ (
+ "unsigned delta label: the printed bridge value drops its sign",
+ '>−38</text>',
+ '>38</text>',
+ "no printed label states its value -38",
+ ),
+ (
+ "unsigned delta declaration: data-value drops the sign",
+ 'data-value="+22"',
+ 'data-value="22"',
+ "explicit sign",
+ ),
+ (
+ "sign-treatment collapse: a decrease wears the increase fill",
+ '<rect x="400" y="131" width="96" height="36" fill="#f5f5f5" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="-38"',
+ '<rect x="400" y="131" width="96" height="36" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="-38"',
+ "share the same fill",
+ ),
+ (
+ "non-finite carry: a connector declares an unverifiable total",
+ 'data-carry="240"',
+ 'data-carry="nan"',
+ "non-numeric data-carry",
+ ),
+ (
+ "label stolen from elsewhere: the bar's own label is gone and a "
+ "decoy on the far side of the chart carries its number",
+ '<text x="448" y="179" fill="#4f5d75" font-size="8" '
+ 'font-family="\'Geist Mono\', monospace" text-anchor="middle">\u2212 38</text>'.replace("\u2212 ", "\u2212"),
+ '<text x="5" y="5" fill="#4f5d75" font-size="8" '
+ 'font-family="\'Geist Mono\', monospace" text-anchor="middle">\u2212 38</text>'.replace("\u2212 ", "\u2212"),
+ "no printed label states its value",
+ ),
+ (
+ "polarity swap on a lone decrease: the only fall wears the rise tint",
+ '<rect x="400" y="131" width="96" height="36" fill="#f5f5f5" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="-38"',
+ '<rect x="400" y="131" width="96" height="36" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="-38"',
+ "decreases require hollow paper",
+ ),
+ (
+ "element transform: a translated bar no longer occupies its declared coordinates",
+ '<rect x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75"',
+ '<rect transform="translate(0 80)" x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75"',
+ "waterfall bar carries transform",
+ ),
+ (
+ "ancestor transform: a group moves a bar away from its declared coordinates",
+ '<rect x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="+64" data-name="Headcount"/>',
+ '<g transform="translate(0 80)"><rect x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="+64" data-name="Headcount"/></g>',
+ "ancestor transform",
+ ),
+ (
+ "CSS transform: a matching rule can move verified bars after parsing",
+ " </style>",
+ ' [data-role="delta"] { transform: translateY(80px); }\n </style>',
+ "CSS 'transform' declaration",
+ ),
+ (
+ "second accent bar: the focal treatment repeats",
+ '<rect x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75"',
+ '<rect x="256" y="131" width="96" height="61" fill="rgba(235,108,54,0.12)" stroke="#eb6c36"',
+ "at most one bar",
+ ),
+ (
+ "degenerate start: a zero start total has no scale to fit",
+ 'data-role="total" data-value="240"',
+ 'data-role="total" data-value="0"',
+ "totals must be positive",
+ ),
+ (
+ "zero delta: invisible ink that still occupies a column",
+ 'data-role="delta" data-value="+22"',
+ 'data-role="delta" data-value="+0"',
+ "zero delta",
+ ),
+ (
+ "missing contract: no bar declares its role and value",
+ 'data-role="',
+ 'data-gone="',
+ "data contract is missing",
+ ),
+ )
+
+ with tempfile.TemporaryDirectory() as tmp:
+ directory = Path(tmp)
+ for index, (name, old, new, expected) in enumerate(cases):
+ if old not in source:
+ failures.append(f"fixture drift: {name} — mutation target not found in {GOOD.name}")
+ continue
+ mutated = source.replace(old, new)
+ path = write(directory, f"example-waterfall-mutant-{index}.html", mutated)
+ code, output = run(str(path))
+ if code == 0:
+ failures.append(f"checker stayed quiet on: {name}")
+ elif expected not in output:
+ failures.append(
+ f"checker fired on {name} but without naming the lie "
+ f"(wanted {expected!r}):\n{output}"
+ )
+ else:
+ print(f"OK: fails on {name}")
+
+ # Usage contract: no arguments is an error, not a silent pass.
+ code, _ = run()
+ if code != 2:
+ failures.append(f"no-argument invocation must exit 2; got {code}")
+ else:
+ print("OK: usage error exits 2")
+
+ if failures:
+ print("\nFAIL verify-waterfall tests:")
+ for failure in failures:
+ print(f" - {failure}")
+ return 1
+ print(f"\nOK: verify-waterfall passes {len(SHIPPED)} shipped files and fails all {len(cases)} mutations")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/verify-docs-sync.py b/scripts/verify-docs-sync.py
index 4ea2a96..f16105e 100644
--- a/scripts/verify-docs-sync.py
+++ b/scripts/verify-docs-sync.py
@@ -43,7 +43,7 @@ HIGH_LEVEL_REFERENCE = ROOT / "skills/diagram-design/references/type-high-level.
ONBOARDING_REFERENCE = ROOT / "skills/diagram-design/references/onboarding.md"
LINE_DARK_EXAMPLE = ROOT / "skills/diagram-design/assets/example-line-dark.html"
VARIANTS = ("", "-dark", "-full")
-VISUAL_TYPE_COUNT = 39
+VISUAL_TYPE_COUNT = 40
AGENT_SKILLS_DESCRIPTION_MAX = 1024
# Types whose selection-table name differs from its description vocabulary.
DESCRIPTION_ALIASES = {
diff --git a/scripts/verify-screenshot-freshness.py b/scripts/verify-screenshot-freshness.py
index 686752d..9704cd0 100644
--- a/scripts/verify-screenshot-freshness.py
+++ b/scripts/verify-screenshot-freshness.py
@@ -20,8 +20,8 @@ from screenshot_catalog import (
def main() -> int:
errors: list[str] = []
slugs = canonical_slugs()
- if len(slugs) != 39 or len(slugs) != len(set(slugs)):
- errors.append(f"expected 39 unique canonical types; found {len(slugs)}")
+ if len(slugs) != 40 or len(slugs) != len(set(slugs)):
+ errors.append(f"expected 40 unique canonical types; found {len(slugs)}")
if not MANIFEST.is_file():
errors.append("docs/screenshots/manifest.json is missing")
@@ -96,7 +96,7 @@ def main() -> int:
for error in errors:
print(f" - {error}")
return 1
- print("OK screenshot freshness: 39 canonical sources and PNG digests match")
+ print("OK screenshot freshness: 40 canonical sources and PNG digests match")
return 0
diff --git a/scripts/verify-semantic-motion.py b/scripts/verify-semantic-motion.py
index fb5351b..d49e9ec 100644
--- a/scripts/verify-semantic-motion.py
+++ b/scripts/verify-semantic-motion.py
@@ -21,7 +21,7 @@ PATTERNS = ROOT / "skills/diagram-design/references/semantic-patterns.md"
ANIMATION = ROOT / "skills/diagram-design/references/animation.md"
EXAMPLE = ROOT / "skills/diagram-design/assets/example-policy-trace-animated.html"
MAX_SKILL_BYTES = 40_000
-VISUAL_TYPE_COUNT = 39
+VISUAL_TYPE_COUNT = 40
PATTERN_NAMES = (
"Fan-in queue / bottleneck",
diff --git a/scripts/verify-waterfall.py b/scripts/verify-waterfall.py
new file mode 100644
index 0000000..e97603e
--- /dev/null
+++ b/scripts/verify-waterfall.py
@@ -0,0 +1,535 @@
+#!/usr/bin/env python3
+"""Verify the invariants a waterfall chart can silently break.
+
+A waterfall's whole claim is that **the running total is conserved**: a start
+total, a sequence of signed bridges, and an end total that reconciles. Every
+way of breaking that claim renders perfectly — nothing errors, nothing
+disappears, and neither `lint-skin.py` (colors, fonts, a11y) nor
+`verify-geometry.py` (label masks vs later-painted nodes) reads a bar against
+the arithmetic it participates in.
+
+Each bar declares its role and value (`data-role`, `data-value`, `data-name`)
+and each connector declares the running total it transports (`data-carry`).
+The checker recomputes the walk from the declarations and holds the drawing to
+it:
+
+1. CONSERVATION — start + every signed delta must equal each subtotal and the
+ end total, exactly. Declared values are data, so there is no tolerance.
+2. SHARED SCALE AND BRIDGE GEOMETRY — the scale is fitted from the start
+ anchor (baseline at its bottom, px-per-unit from its height over its
+ value). Every total and subtotal must anchor at that baseline, and every
+ bridge must span exactly the running totals before and after it, within
+ GEOMETRY_TOLERANCE for integer-pixel rounding. Data coordinates round to
+ the nearest pixel; they never snap to the 4px layout grid.
+3. CARRIES — each gap between adjacent bars must be crossed by exactly one
+ horizontal connector drawn at the running total it declares, spanning the
+ full gap. A missing carry breaks the walk; a carry at the wrong level
+ reconnects it to a different total.
+4. PRINTED VALUES — every bar prints its declared value, and a delta prints
+ it with an explicit sign. Geometry the reader cannot check against a
+ number is taken on trust.
+5. SIGN TREATMENT — increases share one fill and decreases another, and the
+ two differ, so direction survives greyscale and colour-vision deficiency.
+ At most one bar may take the accent focal treatment, which replaces its
+ sign fill (the signed label and geometry still carry the direction).
+
+Degenerate data fails closed with a named finding: a start total of zero or
+less has no scale to fit, and a zero delta is invisible ink that still
+occupies a column.
+
+Usage:
+ python3 scripts/verify-waterfall.py --all
+ python3 scripts/verify-waterfall.py skills/diagram-design/assets/example-waterfall.html
+
+Exit: 0 clean, 1 findings, 2 usage.
+"""
+
+from __future__ import annotations
+
+import argparse
+import html
+import math
+import re
+import sys
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+ASSET_DIR = ROOT / "skills/diagram-design/assets"
+
+RECT_RE = re.compile(r"<rect\b(?P<attrs>[^>]*?)/?>", re.IGNORECASE)
+LINE_RE = re.compile(r"<line\b(?P<attrs>[^>]*?)/?>", re.IGNORECASE)
+TEXT_RE = re.compile(r"<text\b(?P<attrs>[^>]*)>(?P<body>.*?)</text>", re.IGNORECASE | re.DOTALL)
+ATTR_RE = re.compile(r'(?P<name>[\w:-]+)="(?P<value>[^"]*)"')
+TAG_RE = re.compile(r"<[^>]+>")
+COMMENT_RE = re.compile(r"<!--.*?-->", re.DOTALL)
+GROUP_OPEN_RE = re.compile(r"<(?:g|svg)\b(?P<attrs>[^>]*?)(?P<selfclose>/?)>", re.IGNORECASE)
+GROUP_CLOSE_RE = re.compile(r"</(?:g|svg)\s*>", re.IGNORECASE)
+STYLE_RE = re.compile(r"<style\b[^>]*>(?P<body>.*?)</style>", re.IGNORECASE | re.DOTALL)
+CSS_MOVES_MARK_RE = re.compile(
+ r"(?:^|[{;}\n])\s*(?:-(?:webkit|moz|ms|o)-)?"
+ r"(?P<prop>transform|translate|rotate|scale|x|y"
+ r"|offset(?:-(?:path|distance|position|anchor|rotate))?)\s*:",
+ re.IGNORECASE,
+)
+
+# Integer-pixel rounding on a shared scale cannot miss by more than 0.5px per
+# edge; 0.75 leaves headroom for the fit itself while staying far below the
+# smallest honest bridge this budget allows.
+GEOMETRY_TOLERANCE = 0.75
+# A carry must reach both bars it connects. 2px forgives stroke caps, nothing
+# more.
+CARRY_SPAN_TOLERANCE = 2.0
+VALUE_TOLERANCE = 1e-9
+MAX_BARS = 8
+MAX_SUBTOTALS = 1
+ACCENT_STROKES = {"#eb6c36", "#f08a59"}
+SIGN_CHARS = {"+": 1.0, "-": -1.0, "\u2212": -1.0}
+
+
+def attrs_of(tag_attrs: str) -> dict[str, str]:
+ return {m.group("name").lower(): m.group("value") for m in ATTR_RE.finditer(tag_attrs)}
+
+
+def parse_number(raw: str) -> float | None:
+ try:
+ value = float(raw)
+ return value if math.isfinite(value) else None
+ except (TypeError, ValueError):
+ return None
+
+
+def transform_carrier(attrs: dict[str, str]) -> str | None:
+ """Describe an attribute or inline style that can move verified geometry."""
+ if "transform" in attrs:
+ return f"transform={attrs['transform']!r}"
+ style = attrs.get("style")
+ if style is not None:
+ found = CSS_MOVES_MARK_RE.search(style)
+ if found is not None:
+ return f"style={style!r} (the {found.group('prop').lower()} property)"
+ return None
+
+
+def transformed_spans(source: str) -> list[tuple[int, int, str]]:
+ """Return source spans covered by transformed SVG/group ancestors."""
+ events: list[tuple[int, int, str | None]] = []
+ for match in GROUP_OPEN_RE.finditer(source):
+ if match.group("selfclose"):
+ continue
+ attrs = attrs_of(match.group("attrs"))
+ events.append((match.start(), 0, transform_carrier(attrs)))
+ for match in GROUP_CLOSE_RE.finditer(source):
+ events.append((match.start(), 1, None))
+ events.sort(key=lambda event: (event[0], event[1]))
+
+ spans: list[tuple[int, int, str]] = []
+ stack: list[tuple[int, str | None]] = []
+ for position, kind, how in events:
+ if kind == 0:
+ stack.append((position, how))
+ elif stack:
+ start, transformed_by = stack.pop()
+ if transformed_by is not None:
+ spans.append((start, position, transformed_by))
+ for start, transformed_by in stack:
+ if transformed_by is not None:
+ spans.append((start, len(source), transformed_by))
+ return spans
+
+
+def check_transforms(source: str, errors: list[str]) -> None:
+ """Reject transforms that make rendered bar/carry geometry differ from raw coordinates."""
+ source = COMMENT_RE.sub("", source)
+ spans = transformed_spans(source)
+
+ def enclosing(offset: int) -> str | None:
+ for start, end, how in spans:
+ if start <= offset <= end:
+ return f"ancestor {how}"
+ return None
+
+ for pattern, contract_attr, label in (
+ (RECT_RE, "data-role", "waterfall bar"),
+ (LINE_RE, "data-carry", "waterfall carry"),
+ ):
+ for match in pattern.finditer(source):
+ attrs = attrs_of(match.group("attrs"))
+ if contract_attr not in attrs:
+ continue
+ how = transform_carrier(attrs) or enclosing(match.start())
+ if how is not None:
+ errors.append(
+ f"{label} carries {how}; bake the movement into its coordinates so "
+ "the verifier checks what the browser draws"
+ )
+
+ for match in STYLE_RE.finditer(source):
+ found = CSS_MOVES_MARK_RE.search(match.group("body"))
+ if found is not None:
+ errors.append(
+ f"CSS {found.group('prop').lower()!r} declaration can move verified waterfall "
+ "geometry; bake the movement into the coordinates instead"
+ )
+
+
+class Bar:
+ __slots__ = ("role", "value", "name", "x", "y", "w", "h", "fill", "stroke", "index")
+
+ def __init__(self, index: int, role: str, value: float, name: str,
+ x: float, y: float, w: float, h: float, fill: str, stroke: str) -> None:
+ self.index = index
+ self.role = role
+ self.value = value
+ self.name = name
+ self.x, self.y, self.w, self.h = x, y, w, h
+ self.fill = fill
+ self.stroke = stroke
+
+ @property
+ def right(self) -> float:
+ return self.x + self.w
+
+ @property
+ def bottom(self) -> float:
+ return self.y + self.h
+
+ @property
+ def label(self) -> str:
+ return f"{self.name!r} (bar {self.index + 1})"
+
+
+def parse_signed(raw: str, *, signed_required: bool) -> tuple[float | None, bool]:
+ """Return (value, had_explicit_sign) for a declared or printed value."""
+ text = raw.strip()
+ if not text:
+ return None, False
+ sign = SIGN_CHARS.get(text[0])
+ if sign is not None:
+ magnitude = parse_number(text[1:].strip())
+ if magnitude is None:
+ return None, True
+ return sign * magnitude, True
+ if signed_required:
+ return parse_number(text), False
+ return parse_number(text), False
+
+
+def parse_bars(source: str, errors: list[str]) -> list[Bar]:
+ bars: list[Bar] = []
+ for match in RECT_RE.finditer(source):
+ attrs = attrs_of(match.group("attrs"))
+ role = attrs.get("data-role")
+ if role is None:
+ continue
+ if role not in {"total", "delta", "subtotal"}:
+ errors.append(f"bar {len(bars) + 1} declares unknown data-role {role!r}")
+ continue
+ name = attrs.get("data-name", f"#{len(bars) + 1}")
+ raw_value = attrs.get("data-value", "")
+ value, signed = parse_signed(raw_value, signed_required=(role == "delta"))
+ if value is None:
+ errors.append(f"{name!r}: data-value {raw_value!r} is not a number")
+ continue
+ if role == "delta" and not signed:
+ errors.append(
+ f"{name!r}: a delta must declare an explicit sign in data-value; got {raw_value!r}"
+ )
+ geometry = [parse_number(attrs.get(key, "")) for key in ("x", "y", "width", "height")]
+ if any(v is None for v in geometry):
+ errors.append(f"{name!r}: bar rect is missing numeric x/y/width/height")
+ continue
+ x, y, w, h = geometry # type: ignore[assignment]
+ if w <= 0 or h <= 0 or not all(map(math.isfinite, (x + w, y + h))):
+ errors.append(f"{name!r}: bar geometry must have finite edges and positive dimensions")
+ continue
+ bars.append(
+ Bar(len(bars), role, value, name, x, y, w, h,
+ attrs.get("fill", ""), attrs.get("stroke", ""))
+ )
+ return bars
+
+
+def check_structure(bars: list[Bar], errors: list[str]) -> bool:
+ if len(bars) < 3:
+ errors.append(f"a waterfall needs a start total, at least one delta, and an end total; found {len(bars)} bars")
+ return False
+ if len(bars) > MAX_BARS:
+ errors.append(f"waterfall exceeds the budget of {MAX_BARS} bars: found {len(bars)}")
+ if bars[0].role != "total":
+ errors.append(f"the first bar must be the start total; {bars[0].label} declares {bars[0].role!r}")
+ return False
+ if bars[-1].role != "total":
+ errors.append(f"the last bar must be the end total; {bars[-1].label} declares {bars[-1].role!r}")
+ return False
+ interior = bars[1:-1]
+ for bar in interior:
+ if bar.role == "total":
+ errors.append(f"{bar.label}: an interior resting point is a subtotal, not a total")
+ return False
+ subtotals = [bar for bar in interior if bar.role == "subtotal"]
+ if len(subtotals) > MAX_SUBTOTALS:
+ errors.append(
+ f"a walk that needs {len(subtotals)} subtotals is two walks; the budget allows {MAX_SUBTOTALS}"
+ )
+ if not any(bar.role == "delta" for bar in interior):
+ errors.append("a waterfall with no delta bars is a bar chart wearing carries")
+ return False
+ for bar in bars:
+ if bar.role in {"total", "subtotal"} and bar.value <= 0:
+ errors.append(
+ f"{bar.label}: a {bar.role} of {bar.value:g} has no anchored height on this grammar; "
+ "totals must be positive"
+ )
+ return False
+ if bar.role == "delta" and bar.value == 0:
+ errors.append(f"{bar.label}: a zero delta is dropped, never drawn")
+ return True
+
+
+def running_levels(bars: list[Bar], errors: list[str]) -> list[tuple[float, float]] | None:
+ """Return each bar's (level_before, level_after); None when conservation fails."""
+ levels: list[tuple[float, float]] = []
+ running = bars[0].value
+ levels.append((0.0, running))
+ conserved = True
+ for bar in bars[1:]:
+ if bar.role == "delta":
+ before = running
+ running += bar.value
+ if not math.isfinite(running):
+ errors.append(f"{bar.label}: the running total must remain finite")
+ return None
+ levels.append((before, running))
+ if running < 0:
+ errors.append(
+ f"{bar.label}: the running total falls to {running:g}; this grammar anchors totals "
+ "at a zero floor and cannot draw a negative walk"
+ )
+ conserved = False
+ else:
+ if abs(running - bar.value) > VALUE_TOLERANCE:
+ errors.append(
+ f"{bar.label}: declares {bar.value:g} but the walk arrives at {running:g}; "
+ "the running total must conserve"
+ )
+ conserved = False
+ levels.append((running, running))
+ running = bar.value
+ return levels if conserved else None
+
+
+def check_geometry(bars: list[Bar], levels: list[tuple[float, float]], errors: list[str]) -> tuple[float, float] | None:
+ start = bars[0]
+ if start.h <= 0:
+ errors.append(f"{start.label}: the start anchor has no height; no scale can be fitted")
+ return None
+ baseline = start.bottom
+ scale = start.h / start.value
+ for bar, (before, after) in zip(bars, levels):
+ if bar.role in {"total", "subtotal"}:
+ lo, hi = 0.0, bar.value
+ else:
+ lo, hi = min(before, after), max(before, after)
+ expected_top = baseline - scale * hi
+ expected_bottom = baseline - scale * lo
+ if scale <= 0 or not all(map(math.isfinite, (scale, expected_top, expected_bottom))):
+ errors.append(f"{bar.label}: shared scale and derived geometry must be finite and nonzero")
+ return None
+ if abs(bar.y - expected_top) > GEOMETRY_TOLERANCE:
+ errors.append(
+ f"{bar.label}: top edge drawn at y={bar.y:g} but the shared scale puts "
+ f"the {hi:g} level at y={expected_top:.1f}"
+ )
+ if abs(bar.bottom - expected_bottom) > GEOMETRY_TOLERANCE:
+ errors.append(
+ f"{bar.label}: bottom edge drawn at y={bar.bottom:g} but the shared scale puts "
+ f"the {lo:g} level at y={expected_bottom:.1f}"
+ )
+ return baseline, scale
+
+
+def check_carries(source: str, bars: list[Bar], levels: list[tuple[float, float]],
+ baseline: float, scale: float, errors: list[str]) -> None:
+ carries: list[tuple[float, float, float, float, str]] = []
+ for match in LINE_RE.finditer(source):
+ attrs = attrs_of(match.group("attrs"))
+ declared = attrs.get("data-carry")
+ if declared is None:
+ continue
+ value = parse_number(declared)
+ coords = [parse_number(attrs.get(key, "")) for key in ("x1", "y1", "x2", "y2")]
+ if value is None or any(v is None for v in coords):
+ errors.append(f"carry {declared!r}: non-numeric data-carry or coordinates")
+ continue
+ x1, y1, x2, y2 = coords # type: ignore[assignment]
+ if abs(y1 - y2) > VALUE_TOLERANCE:
+ errors.append(f"carry {declared!r}: a carry is horizontal; drawn from y={y1:g} to y={y2:g}")
+ continue
+ carries.append((min(x1, x2), max(x1, x2), y1, value, declared))
+
+ for left, right, (_, level) in zip(bars, bars[1:], levels):
+ gap_start, gap_end = left.right, right.x
+ matched = [
+ carry for carry in carries
+ if carry[0] <= gap_start + CARRY_SPAN_TOLERANCE and carry[1] >= gap_end - CARRY_SPAN_TOLERANCE
+ and carry[0] >= left.x and carry[1] <= right.right
+ ]
+ gap_label = f"gap between {left.name!r} and {right.name!r}"
+ if not matched:
+ errors.append(f"{gap_label}: no carry spans it; the running total is not conserved across the gap")
+ continue
+ if len(matched) > 1:
+ errors.append(f"{gap_label}: {len(matched)} carries cross one gap; a gap has one running total")
+ continue
+ _, _, y, value, declared = matched[0]
+ if abs(value - level) > VALUE_TOLERANCE:
+ errors.append(
+ f"{gap_label}: carry declares {declared} but the running total between these bars is {level:g}"
+ )
+ expected_y = baseline - scale * level
+ if abs(y - expected_y) > GEOMETRY_TOLERANCE:
+ errors.append(
+ f"{gap_label}: carry drawn at y={y:g} but the {level:g} level sits at y={expected_y:.1f}"
+ )
+
+
+def printed_values(source: str, bar: Bar) -> list[tuple[float, bool]]:
+ values: list[tuple[float, bool]] = []
+ for match in TEXT_RE.finditer(source):
+ attrs = attrs_of(match.group("attrs"))
+ x, y = (parse_number(attrs.get(key, "")) for key in ("x", "y"))
+ if any(key in attrs for key in ("style", "display", "visibility", "opacity", "fill-opacity")):
+ continue
+ expected_y = bar.bottom + 12 if bar.role == "delta" and bar.value < 0 else bar.y - 8
+ if x is None or y is None or attrs.get("text-anchor") != "middle":
+ continue
+ if abs(x - (bar.x + bar.w / 2)) > GEOMETRY_TOLERANCE or abs(y - expected_y) > GEOMETRY_TOLERANCE:
+ continue
+ body = html.unescape(TAG_RE.sub("", match.group("body"))).strip()
+ value, signed = parse_signed(body, signed_required=False)
+ if value is not None:
+ values.append((value, signed))
+ return values
+
+
+def check_printed(source: str, bars: list[Bar], errors: list[str]) -> None:
+ for bar in bars:
+ printed = printed_values(source, bar)
+ needs_sign = bar.role == "delta"
+ hit = any(
+ abs(value - bar.value) <= VALUE_TOLERANCE and (signed or not needs_sign)
+ for value, signed in printed
+ )
+ if not hit:
+ wanted = f"{bar.value:+g}" if needs_sign else f"{bar.value:g}"
+ errors.append(
+ f"{bar.label}: no printed label states its value {wanted}"
+ + (" with an explicit sign" if needs_sign else "")
+ )
+
+
+def check_sign_treatment(bars: list[Bar], errors: list[str], paper: str) -> None:
+ focal = [bar for bar in bars if bar.stroke.lower() in ACCENT_STROKES]
+ if len(focal) > 1:
+ errors.append(
+ "the accent focal treatment is editorial and marks at most one bar; found "
+ + ", ".join(bar.label for bar in focal)
+ )
+ focal_set = set(id(bar) for bar in focal)
+ # Absolute check: the documented mapping is tint-for-increase and hollow
+ # paper-for-decrease, both over the muted stroke. Comparing the two polarity
+ # sets against each other cannot see a single-polarity walk, or one whose
+ # only bar of a polarity is focal, or a chart with the treatments swapped.
+ # Only the two shipped themes have a documented pair; an unrecognised paper
+ # falls through to the relative checks below rather than failing the file.
+ THEME_TREATMENTS = {
+ "#2d3142": ("rgba(191,192,192,0.15)", "#bfc0c0"),
+ "#f5f5f5": ("rgba(79,93,117,0.15)", "#4f5d75"),
+ }
+ if paper in THEME_TREATMENTS:
+ tint, stroke = THEME_TREATMENTS[paper]
+ for bar in bars:
+ if bar.role != "delta" or id(bar) in focal_set:
+ continue
+ expected_fill = tint if bar.value > 0 else paper
+ if re.sub(r"\s+", "", bar.fill.lower()) != expected_fill or bar.stroke.lower() != stroke:
+ errors.append(
+ f"{bar.label}: increases require the muted tint and decreases require "
+ f"hollow paper, both over the muted stroke"
+ )
+ rises = {bar.fill for bar in bars if bar.role == "delta" and bar.value > 0 and id(bar) not in focal_set}
+ falls = {bar.fill for bar in bars if bar.role == "delta" and bar.value < 0 and id(bar) not in focal_set}
+ if len(rises) > 1:
+ errors.append(f"increases must share one fill; found {sorted(rises)}")
+ if len(falls) > 1:
+ errors.append(f"decreases must share one fill; found {sorted(falls)}")
+ if len(rises) == 1 and len(falls) == 1 and rises == falls:
+ errors.append(
+ "increases and decreases share the same fill; sign must survive greyscale, "
+ "so the two directions need distinct fill weights"
+ )
+
+
+def verify_file(path: Path) -> list[str]:
+ errors: list[str] = []
+ source = path.read_text(encoding="utf-8")
+ paper_match = re.search(r'--color-paper\s*:\s*(#[0-9a-fA-F]{6})', source)
+ paper = paper_match[1].lower() if paper_match else None
+ bars = parse_bars(source, errors)
+ if not bars:
+ errors.append("no bars declare data-role/data-value; the waterfall data contract is missing")
+ return errors
+ if not check_structure(bars, errors):
+ return errors
+ check_transforms(source, errors)
+ levels = running_levels(bars, errors)
+ if levels is None:
+ return errors
+ fitted = check_geometry(bars, levels, errors)
+ if fitted is not None:
+ baseline, scale = fitted
+ check_carries(source, bars, levels, baseline, scale, errors)
+ check_printed(source, bars, errors)
+ check_sign_treatment(bars, errors, paper)
+ return errors
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description="Verify waterfall running-total conservation and bridge geometry.")
+ parser.add_argument("paths", nargs="*", help="waterfall example HTML files")
+ parser.add_argument("--all", action="store_true", help="check every shipped example-waterfall*.html")
+ args = parser.parse_args()
+
+ if args.all:
+ paths = sorted(ASSET_DIR.glob("example-waterfall*.html"))
+ if not paths:
+ print("FAIL waterfall: --all found no example-waterfall*.html under the skill assets")
+ return 2
+ elif args.paths:
+ paths = [Path(p) for p in args.paths]
+ else:
+ parser.print_usage()
+ return 2
+
+ failed = False
+ for path in paths:
+ if not path.is_file():
+ print(f"FAIL {path}: no such file")
+ failed = True
+ continue
+ findings = verify_file(path)
+ if findings:
+ failed = True
+ print(f"FAIL {path}")
+ for finding in findings:
+ print(f" - {finding}")
+ else:
+ print(f"OK {path}")
+ if failed:
+ return 1
+ print(f"OK waterfall: {len(paths)} file(s) conserve the running total and draw it where they claim")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/skills/diagram-design/SKILL.md b/skills/diagram-design/SKILL.md
index 1498a9b..80f71a2 100644
--- a/skills/diagram-design/SKILL.md
+++ b/skills/diagram-design/SKILL.md
@@ -1,6 +1,6 @@
---
name: diagram-design
-description: Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.
+description: Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.
license: MIT
metadata:
version: "2.6"
@@ -10,7 +10,7 @@ metadata:
Create visual diagrams as self-contained HTML files with inline SVG and CSS, following an opinionated editorial design system.
-Thirty-nine visual types. Semantic patterns describe behavior independently; type references describe layout. Details load from `references/` only when selected.
+Forty visual types. Semantic patterns describe behavior independently; type references describe layout. Details load from `references/` only when selected.
---
@@ -49,7 +49,7 @@ Applied to schematics:
## 2. When to Use
-Use for any of the 39 visual types (§3) when a reader will learn more from a visual than from prose, a table, or a bulleted list.
+Use for any of the 40 visual types (§3) when a reader will learn more from a visual than from prose, a table, or a bulleted list.
**Don't use for:**
@@ -79,7 +79,7 @@ When behavior, state, enforcement, or risk carries the meaning, first load [`ref
The pattern owns semantic primitives and its tighter budget; the type owns layout grammar. Use [`references/animation.md`](references/animation.md) only when motion is requested or materially clarifies ordered change; static remains the default.
-### Visual-type guide (39)
+### Visual-type guide (40)
| If you're showing… | Use | Reference |
|---|---|---|
@@ -102,6 +102,7 @@ The pattern owns semantic primitives and its tighter budget; the type owns layou
| Overlap between sets | **Venn** | [type-venn.md](references/type-venn.md) |
| Ranked hierarchy or conversion drop-off | **Pyramid / funnel** | [type-pyramid.md](references/type-pyramid.md) |
| Quantitative comparison across categories | **Bar chart** | [type-bar.md](references/type-bar.md) |
+| A start total bridged to an end total by signed contributions (budget bridge, headcount deltas) | **Waterfall** | [type-waterfall.md](references/type-waterfall.md) |
| Part-of-whole where the relative sizes are the story | **Treemap** | [type-treemap.md](references/type-treemap.md) |
| Continuous trends over time, change between exactly two states (slopegraph), one distribution per series (ridgeline), or rank movement across several snapshots (bump) | **Line chart** | [type-line.md](references/type-line.md) |
| Tasks and phases on a timeline | **Gantt** | [type-gantt.md](references/type-gantt.md) |
@@ -282,7 +283,7 @@ These six rules are **non-negotiable**. Run the pre-output checklist (§9) to ve
No connector may hide another. If you can't tell two arrows apart at a glance, the layout has failed.
-5. **A connector must not pass behind a box that isn't its source or destination — except when the box is geometrically unavoidable on a direct orthogonal path.** Reroute around intervening boxes by default. The only legitimate exception is when a cross-cutting node (e.g., a footer service, a horizontal layer bar) physically sits between the connector's source and destination on the only straight path between them — for example, a `METRICS` arrow exiting an `Observability` footer bar and rising into a zone above must cross the `Active Directory` footer bar that sits between them. In that exception:
+5. **A connector must not pass behind a box that isn't its source or destination — except when the box is geometrically unavoidable on a direct orthogonal path.** Reroute around intervening boxes by default. The only legitimate exception is when a cross-cutting node (e.g., a footer service, a horizontal layer bar) physically sits between the connector's source and destination on the only straight path between them. In that exception:
- The stroke must be **dashed** (e.g., `stroke-dasharray="4,3"`) to signal "transit, not interaction" — it tells the reader the intervening box is not an endpoint.
- The label sits at the **visible end** of the connector (typically near the source) so it doesn't fall behind the intervening box.
- No marker (arrowhead) may land on the intervening box's edge — the marker resolves at the true destination only.
@@ -391,6 +392,7 @@ Quick check: if a coordinate ends in 1, 2, 3, 5, 6, 7, 9 — fix it.
| Max polar series | 1 |
| Max focal polar categories | 1 |
| Max bars (bar chart) | 8 |
+| Max bars (waterfall) | 8 incl. totals, 1 subtotal |
| Max cells (treemap) | 8 |
| Max series (line chart) | 5 |
| Max tasks (Gantt) | 12 |
@@ -511,7 +513,7 @@ Every diagram ships in three variants (see `assets/`):
| **Minimal light** (default) | `assets/template.html`, `example-<type>.html` | Screenshot-ready. Diagram + title. Warm paper. |
| **Minimal dark** | `assets/template-dark.html`, `example-<type>-dark.html` | Dark mode sites, slides, high-contrast posts. |
| **Full editorial** | `assets/template-full.html`, `example-<type>-full.html` | Long-form posts where the diagram is the hero. |
-| **Consultant special** (quadrant only) | `example-quadrant-consultant.html` | BCG/McKinsey-style 2×2 scenario matrix. Clinical sans-serif, white bg, bold blue double-ended axes, named scenario cells. See [type-quadrant.md](references/type-quadrant.md#consultant-special-2x2-scenario-matrix). |
+| **Consultant special** (quadrant only) | `example-quadrant-consultant.html` | BCG/McKinsey-style 2×2 scenario matrix. See [type-quadrant.md](references/type-quadrant.md#consultant-special-2x2-scenario-matrix). |
**Sketchy variant** (optional, applied to any of the above) — see [primitive-sketchy.md](references/primitive-sketchy.md). SVG turbulence filter wobbles strokes for a hand-drawn feel. Good for essays, not for technical docs.
diff --git a/skills/diagram-design/assets/example-waterfall-dark.html b/skills/diagram-design/assets/example-waterfall-dark.html
new file mode 100644
index 0000000..2e7d027
--- /dev/null
+++ b/skills/diagram-design/assets/example-waterfall-dark.html
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Cloud budget bridge · Waterfall chart · dark</title>
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <style>
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ :root {
+ --color-paper: #2d3142;
+ --color-ink: #f5f5f5;
+ --color-muted: #bfc0c0;
+ --color-accent: #f08a59;
+ --font-sans: 'Geist', system-ui, sans-serif;
+ --font-serif: 'Instrument Serif', serif;
+ --font-mono: 'Geist Mono', ui-monospace, monospace;
+ }
+ body { font-family: var(--font-sans); background: var(--color-paper); color: var(--color-ink); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; }
+ .frame { max-width: 1200px; width: 100%; }
+ .eyebrow { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.5rem; }
+ h1 { font-family: var(--font-serif); font-size: clamp(1.5rem, 2.4vw + 0.75rem, 2rem); font-weight: 400; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 1.5rem; }
+ .diagram-container { width: 100%; overflow-x: auto; }
+ svg { width: 100%; min-width: 760px; display: block; }
+ </style>
+</head>
+<body>
+ <div class="frame">
+ <p class="eyebrow">Waterfall · Diagram Design</p>
+ <h1>Cloud budget bridge · FY25 → FY26</h1>
+
+ <div class="diagram-container">
+ <svg viewBox="0 0 1000 500" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="waterfall-dark-title waterfall-dark-desc">
+ <title id="waterfall-dark-title">Cloud budget bridge · FY25 → FY26</title>
+ <desc id="waterfall-dark-desc">Waterfall chart bridging the FY25 cloud budget of 240 thousand dollars a month to the FY26 plan of 236, through headcount growth, reserved-instance savings, new ML workloads, and storage tiering — the largest saving.</desc>
+ <defs>
+ <pattern id="dots" width="22" height="22" patternUnits="userSpaceOnUse">
+ <circle cx="1" cy="1" r="0.9" fill="rgba(245,245,245,0.10)"/>
+ </pattern>
+ </defs>
+
+ <rect width="100%" height="100%" fill="#2d3142"/>
+ <rect width="100%" height="100%" fill="url(#dots)" opacity="0.55"/>
+
+ <!-- Y-axis rotated label -->
+ <text transform="rotate(-90 24 230)" x="24" y="230" fill="#bfc0c0" font-size="7" font-family="'Geist Mono', monospace" letter-spacing="0.14em" text-anchor="middle">CLOUD SPEND · $K / MO</text>
+
+ <!-- Horizontal gridlines (drawn before bars). Domain 0–400, y = 420 − 0.95·v -->
+ <line x1="80" y1="325" x2="960" y2="325" stroke="rgba(245,245,245,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="230" x2="960" y2="230" stroke="rgba(245,245,245,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="135" x2="960" y2="135" stroke="rgba(245,245,245,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="40" x2="960" y2="40" stroke="rgba(245,245,245,0.06)" stroke-width="0.8"/>
+
+ <!-- Y-axis line and X-axis baseline (the domain floor: totals anchor here) -->
+ <line x1="80" y1="40" x2="80" y2="420" stroke="rgba(245,245,245,0.20)" stroke-width="1"/>
+ <line x1="80" y1="420" x2="960" y2="420" stroke="rgba(245,245,245,0.20)" stroke-width="1"/>
+
+ <!-- Y-axis tick labels -->
+ <text x="72" y="329" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">100</text>
+ <text x="72" y="234" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">200</text>
+ <text x="72" y="139" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">300</text>
+ <text x="72" y="44" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">400</text>
+
+ <!-- ─── CARRIES (drawn before bars; each transports the running total across a gap at its own level) ─── -->
+ <line x1="208" y1="192" x2="256" y2="192" stroke="rgba(245,245,245,0.40)" stroke-width="1" data-carry="240"/>
+ <line x1="352" y1="131" x2="400" y2="131" stroke="rgba(245,245,245,0.40)" stroke-width="1" data-carry="304"/>
+ <line x1="496" y1="167" x2="544" y2="167" stroke="rgba(245,245,245,0.40)" stroke-width="1" data-carry="266"/>
+ <line x1="640" y1="146" x2="688" y2="146" stroke="rgba(245,245,245,0.40)" stroke-width="1" data-carry="288"/>
+ <line x1="784" y1="196" x2="832" y2="196" stroke="rgba(245,245,245,0.40)" stroke-width="1" data-carry="236"/>
+
+ <!-- ─── BARS (width=96, pitch=144). Running total: 240 → 304 → 266 → 288 → 236 → 236 ─── -->
+ <!-- FY25 base: total 240, anchored at the floor. y(240)=192, h=228 -->
+ <rect x="112" y="192" width="96" height="228" fill="#2d3142"/>
+ <rect x="112" y="192" width="96" height="228" fill="rgba(245,245,245,0.08)" stroke="#f5f5f5" stroke-width="1" data-role="total" data-value="240" data-name="FY25 base"/>
+ <text x="160" y="184" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">240</text>
+
+ <!-- Headcount: +64 rises 240 → 304. y(304)=131, h=61 -->
+ <rect x="256" y="131" width="96" height="61" fill="#2d3142"/>
+ <rect x="256" y="131" width="96" height="61" fill="rgba(191,192,192,0.15)" stroke="#bfc0c0" stroke-width="1" data-role="delta" data-value="+64" data-name="Headcount"/>
+ <text x="304" y="123" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+64</text>
+
+ <!-- Reserved instances: −38 falls 304 → 266. Hollow = decrease. y=131, h=36 -->
+ <rect x="400" y="131" width="96" height="36" fill="#2d3142"/>
+ <rect x="400" y="131" width="96" height="36" fill="#2d3142" stroke="#bfc0c0" stroke-width="1" data-role="delta" data-value="-38" data-name="Reserved inst."/>
+ <text x="448" y="179" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">−38</text>
+
+ <!-- ML workloads: +22 rises 266 → 288. y(288)=146, h=21 -->
+ <rect x="544" y="146" width="96" height="21" fill="#2d3142"/>
+ <rect x="544" y="146" width="96" height="21" fill="rgba(191,192,192,0.15)" stroke="#bfc0c0" stroke-width="1" data-role="delta" data-value="+22" data-name="ML workloads"/>
+ <text x="592" y="138" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+22</text>
+
+ <!-- Storage tiering FOCAL: −52 falls 288 → 236 — the largest saving, the story. y=146, h=50 -->
+ <rect x="688" y="146" width="96" height="50" fill="#2d3142"/>
+ <rect x="688" y="146" width="96" height="50" fill="rgba(240,138,89,0.14)" stroke="#f08a59" stroke-width="1" data-role="delta" data-value="-52" data-name="Storage tiering"/>
+ <text x="736" y="208" fill="#f08a59" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" font-weight="600">−52</text>
+
+ <!-- FY26 plan: total 236 = 240 + 64 − 38 + 22 − 52, anchored at the floor. y(236)=196, h=224 -->
+ <rect x="832" y="196" width="96" height="224" fill="#2d3142"/>
+ <rect x="832" y="196" width="96" height="224" fill="rgba(245,245,245,0.08)" stroke="#f5f5f5" stroke-width="1" data-role="total" data-value="236" data-name="FY26 plan"/>
+ <text x="880" y="188" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">236</text>
+
+ <!-- X-axis category labels -->
+ <text x="160" y="440" fill="#f5f5f5" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">FY25 base</text>
+ <text x="304" y="440" fill="#f5f5f5" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Headcount</text>
+ <text x="448" y="440" fill="#f5f5f5" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Reserved inst.</text>
+ <text x="592" y="440" fill="#f5f5f5" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">ML workloads</text>
+ <text x="736" y="440" fill="#f08a59" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Storage tiering</text>
+ <text x="880" y="440" fill="#f5f5f5" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">FY26 plan</text>
+
+ <!-- Legend -->
+ <line x1="40" y1="462" x2="960" y2="462" stroke="rgba(245,245,245,0.10)" stroke-width="0.8"/>
+ <text x="40" y="478" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">LEGEND</text>
+
+ <rect x="40" y="488" width="16" height="10" rx="2" fill="rgba(245,245,245,0.08)" stroke="#f5f5f5" stroke-width="1"/>
+ <text x="64" y="497" fill="#bfc0c0" font-size="8.5" font-family="'Geist', sans-serif">Start / end total</text>
+
+ <rect x="200" y="488" width="16" height="10" rx="2" fill="rgba(191,192,192,0.15)" stroke="#bfc0c0" stroke-width="1"/>
+ <text x="224" y="497" fill="#bfc0c0" font-size="8.5" font-family="'Geist', sans-serif">Cost added</text>
+
+ <rect x="340" y="488" width="16" height="10" rx="2" fill="#2d3142" stroke="#bfc0c0" stroke-width="1"/>
+ <text x="364" y="497" fill="#bfc0c0" font-size="8.5" font-family="'Geist', sans-serif">Cost removed</text>
+
+ <rect x="480" y="488" width="16" height="10" rx="2" fill="rgba(240,138,89,0.14)" stroke="#f08a59" stroke-width="1"/>
+ <text x="504" y="497" fill="#bfc0c0" font-size="8.5" font-family="'Geist', sans-serif">Storage tiering · largest saving</text>
+ </svg>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/example-waterfall-full.html b/skills/diagram-design/assets/example-waterfall-full.html
new file mode 100644
index 0000000..4cad064
--- /dev/null
+++ b/skills/diagram-design/assets/example-waterfall-full.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Cloud budget bridge · Waterfall chart</title>
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <style>
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ :root { --color-paper:#f5f5f5; --color-paper-2:#ececec; --color-ink:#2d3142; --color-muted:#4f5d75; --color-soft:#7a8399; --color-rule:rgba(45,49,66,0.12); --color-accent:#eb6c36; --font-sans:'Geist',system-ui,sans-serif; --font-serif:'Instrument Serif',serif; --font-mono:'Geist Mono',ui-monospace,monospace; }
+ body { font-family: var(--font-sans); background: var(--color-paper); min-height: 100vh; padding: 3rem 2rem; color: var(--color-ink); }
+ .container { max-width: 1200px; margin: 0 auto; }
+ .header { margin-bottom: 2.5rem; }
+ .header-eyebrow { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.75rem; }
+ h1 { font-family: var(--font-serif); font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem); font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 0.5rem; }
+ .subtitle { font-size: 1rem; line-height: 1.55; color: var(--color-muted); max-width: 58ch; }
+ .diagram-container { background: var(--color-paper-2); border-radius: 8px; border: 1px solid var(--color-rule); padding: 1.5rem; overflow-x: auto; }
+ svg { width: 100%; min-width: 760px; display: block; }
+ .cards { display: grid; grid-template-columns: 1.1fr 1fr 0.9fr; gap: 1rem; margin-top: 1.5rem; }
+ @media (max-width: 720px) { .cards { grid-template-columns: 1fr; } }
+ .card { background: #fff; border-radius: 6px; border: 1px solid var(--color-rule); padding: 1.25rem; }
+ .card .eyebrow { font-family: var(--font-mono); font-size: 0.5rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.5rem; }
+ .card-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.875rem; padding-bottom: 0.875rem; border-bottom: 1px solid rgba(45,49,66,0.08); }
+ .card-dot { width: 7px; height: 7px; border-radius: 50%; }
+ .card-dot.coral { background: var(--color-accent); } .card-dot.ink { background: var(--color-ink); } .card-dot.muted { background: var(--color-muted); }
+ .card h3 { font-size: 0.875rem; font-weight: 600; }
+ .card p { color: var(--color-muted); font-size: 0.8125rem; line-height: 1.55; }
+ .footer { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(45,49,66,0.10); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--color-soft); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
+ </style>
+</head>
+<body>
+ <div class="container">
+ <div class="header">
+ <p class="header-eyebrow">Waterfall · Diagram Design</p>
+ <h1>Cloud budget bridge · FY25 → FY26</h1>
+ <p class="subtitle">How a 240 $k/mo baseline becomes a 236 $k/mo plan. Two costs rise, two fall — and the running total carries across every gap, so the walk has to reconcile.</p>
+ </div>
+ <div class="diagram-container">
+ <svg viewBox="0 0 1000 500" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="waterfall-full-title waterfall-full-desc">
+ <title id="waterfall-full-title">Cloud budget bridge · FY25 → FY26</title>
+ <desc id="waterfall-full-desc">Waterfall chart bridging the FY25 cloud budget of 240 thousand dollars a month to the FY26 plan of 236, through headcount growth, reserved-instance savings, new ML workloads, and storage tiering — the largest saving.</desc>
+ <defs><pattern id="dots" width="22" height="22" patternUnits="userSpaceOnUse"><circle cx="1" cy="1" r="0.9" fill="rgba(45,49,66,0.10)"/></pattern></defs>
+ <rect width="100%" height="100%" fill="#f5f5f5"/>
+ <rect width="100%" height="100%" fill="url(#dots)" opacity="0.55"/>
+ <text transform="rotate(-90 24 230)" x="24" y="230" fill="#4f5d75" font-size="7" font-family="'Geist Mono', monospace" letter-spacing="0.14em" text-anchor="middle">CLOUD SPEND · $K / MO</text>
+ <line x1="80" y1="325" x2="960" y2="325" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="230" x2="960" y2="230" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="135" x2="960" y2="135" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="40" x2="960" y2="40" stroke="rgba(45,49,66,0.06)" stroke-width="0.8"/>
+ <line x1="80" y1="40" x2="80" y2="420" stroke="rgba(45,49,66,0.25)" stroke-width="1"/>
+ <line x1="80" y1="420" x2="960" y2="420" stroke="rgba(45,49,66,0.25)" stroke-width="1"/>
+ <text x="72" y="329" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">100</text>
+ <text x="72" y="234" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">200</text>
+ <text x="72" y="139" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">300</text>
+ <text x="72" y="44" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">400</text>
+ <line x1="208" y1="192" x2="256" y2="192" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="240"/>
+ <line x1="352" y1="131" x2="400" y2="131" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="304"/>
+ <line x1="496" y1="167" x2="544" y2="167" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="266"/>
+ <line x1="640" y1="146" x2="688" y2="146" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="288"/>
+ <line x1="784" y1="196" x2="832" y2="196" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="236"/>
+ <rect x="112" y="192" width="96" height="228" fill="#f5f5f5"/><rect x="112" y="192" width="96" height="228" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1" data-role="total" data-value="240" data-name="FY25 base"/><text x="160" y="184" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">240</text>
+ <rect x="256" y="131" width="96" height="61" fill="#f5f5f5"/><rect x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="+64" data-name="Headcount"/><text x="304" y="123" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+64</text>
+ <rect x="400" y="131" width="96" height="36" fill="#f5f5f5"/><rect x="400" y="131" width="96" height="36" fill="#f5f5f5" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="-38" data-name="Reserved inst."/><text x="448" y="179" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">−38</text>
+ <rect x="544" y="146" width="96" height="21" fill="#f5f5f5"/><rect x="544" y="146" width="96" height="21" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="+22" data-name="ML workloads"/><text x="592" y="138" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+22</text>
+ <rect x="688" y="146" width="96" height="50" fill="#f5f5f5"/><rect x="688" y="146" width="96" height="50" fill="rgba(235,108,54,0.12)" stroke="#eb6c36" stroke-width="1" data-role="delta" data-value="-52" data-name="Storage tiering"/><text x="736" y="208" fill="#2d3142" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" font-weight="600">−52</text>
+ <rect x="832" y="196" width="96" height="224" fill="#f5f5f5"/><rect x="832" y="196" width="96" height="224" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1" data-role="total" data-value="236" data-name="FY26 plan"/><text x="880" y="188" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">236</text>
+ <text x="160" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">FY25 base</text>
+ <text x="304" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Headcount</text>
+ <text x="448" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Reserved inst.</text>
+ <text x="592" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">ML workloads</text>
+ <text x="736" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Storage tiering</text>
+ <text x="880" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">FY26 plan</text>
+ <line x1="40" y1="462" x2="960" y2="462" stroke="rgba(45,49,66,0.10)" stroke-width="0.8"/>
+ <text x="40" y="478" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">LEGEND</text>
+ <rect x="40" y="488" width="16" height="10" rx="2" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1"/>
+ <text x="64" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Start / end total</text>
+ <rect x="200" y="488" width="16" height="10" rx="2" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1"/>
+ <text x="224" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Cost added</text>
+ <rect x="340" y="488" width="16" height="10" rx="2" fill="#f5f5f5" stroke="#4f5d75" stroke-width="1"/>
+ <text x="364" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Cost removed</text>
+ <rect x="480" y="488" width="16" height="10" rx="2" fill="rgba(235,108,54,0.12)" stroke="#eb6c36" stroke-width="1"/>
+ <text x="504" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Storage tiering · largest saving</text>
+ </svg>
+ </div>
+ <div class="cards">
+ <div class="card">
+ <p class="eyebrow">LARGEST SAVING</p>
+ <div class="card-header"><span class="card-dot coral"></span><h3>Storage tiering · −52</h3></div>
+ <p>Moving cold datasets to archive tiers claws back more than storage grew all year. It lands late in the walk on purpose — the carry shows the budget was above baseline until this one step.</p>
+ </div>
+ <div class="card">
+ <div class="card-header"><span class="card-dot ink"></span><h3>The walk reconciles</h3></div>
+ <p>240 + 64 − 38 + 22 − 52 = 236. Every bridge spans exactly its two running levels, and each carry line transports the total across the gap at that level — the chart is checkable arithmetic, not decoration.</p>
+ </div>
+ <div class="card">
+ <div class="card-header"><span class="card-dot muted"></span><h3>What the bridge doesn't show</h3></div>
+ <p>Each bar is a net figure. Headcount's +64 contains both new hires and one team's downsizing; the walk states contributions, not the churn inside them.</p>
+ </div>
+ </div>
+ <div class="footer">
+ <span>cloud budget bridge · fy25 → fy26</span>
+ <span>example · diagram design</span>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/example-waterfall.html b/skills/diagram-design/assets/example-waterfall.html
new file mode 100644
index 0000000..a864206
--- /dev/null
+++ b/skills/diagram-design/assets/example-waterfall.html
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Cloud budget bridge · Waterfall chart</title>
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <style>
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ :root {
+ --color-paper: #f5f5f5;
+ --color-ink: #2d3142;
+ --color-muted: #4f5d75;
+ --color-accent: #eb6c36;
+ --font-sans: 'Geist', system-ui, sans-serif;
+ --font-serif: 'Instrument Serif', serif;
+ --font-mono: 'Geist Mono', ui-monospace, monospace;
+ }
+ body { font-family: var(--font-sans); background: var(--color-paper); color: var(--color-ink); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; }
+ .frame { max-width: 1200px; width: 100%; }
+ .eyebrow { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.5rem; }
+ h1 { font-family: var(--font-serif); font-size: clamp(1.5rem, 2.4vw + 0.75rem, 2rem); font-weight: 400; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 1.5rem; }
+ .diagram-container { width: 100%; overflow-x: auto; }
+ svg { width: 100%; min-width: 760px; display: block; }
+ </style>
+</head>
+<body>
+ <div class="frame">
+ <p class="eyebrow">Waterfall · Diagram Design</p>
+ <h1>Cloud budget bridge · FY25 → FY26</h1>
+
+ <div class="diagram-container">
+ <svg viewBox="0 0 1000 500" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="waterfall-title waterfall-desc">
+ <title id="waterfall-title">Cloud budget bridge · FY25 → FY26</title>
+ <desc id="waterfall-desc">Waterfall chart bridging the FY25 cloud budget of 240 thousand dollars a month to the FY26 plan of 236, through headcount growth, reserved-instance savings, new ML workloads, and storage tiering — the largest saving.</desc>
+ <defs>
+ <pattern id="dots" width="22" height="22" patternUnits="userSpaceOnUse">
+ <circle cx="1" cy="1" r="0.9" fill="rgba(45,49,66,0.10)"/>
+ </pattern>
+ </defs>
+
+ <rect width="100%" height="100%" fill="#f5f5f5"/>
+ <rect width="100%" height="100%" fill="url(#dots)" opacity="0.55"/>
+
+ <!-- Y-axis rotated label -->
+ <text transform="rotate(-90 24 230)" x="24" y="230" fill="#4f5d75" font-size="7" font-family="'Geist Mono', monospace" letter-spacing="0.14em" text-anchor="middle">CLOUD SPEND · $K / MO</text>
+
+ <!-- Horizontal gridlines (drawn before bars). Domain 0–400, y = 420 − 0.95·v -->
+ <line x1="80" y1="325" x2="960" y2="325" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="230" x2="960" y2="230" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="135" x2="960" y2="135" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="40" x2="960" y2="40" stroke="rgba(45,49,66,0.06)" stroke-width="0.8"/>
+
+ <!-- Y-axis line and X-axis baseline (the domain floor: totals anchor here) -->
+ <line x1="80" y1="40" x2="80" y2="420" stroke="rgba(45,49,66,0.25)" stroke-width="1"/>
+ <line x1="80" y1="420" x2="960" y2="420" stroke="rgba(45,49,66,0.25)" stroke-width="1"/>
+
+ <!-- Y-axis tick labels -->
+ <text x="72" y="329" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">100</text>
+ <text x="72" y="234" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">200</text>
+ <text x="72" y="139" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">300</text>
+ <text x="72" y="44" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">400</text>
+
+ <!-- ─── CARRIES (drawn before bars; each transports the running total across a gap at its own level) ─── -->
+ <line x1="208" y1="192" x2="256" y2="192" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="240"/>
+ <line x1="352" y1="131" x2="400" y2="131" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="304"/>
+ <line x1="496" y1="167" x2="544" y2="167" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="266"/>
+ <line x1="640" y1="146" x2="688" y2="146" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="288"/>
+ <line x1="784" y1="196" x2="832" y2="196" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="236"/>
+
+ <!-- ─── BARS (width=96, pitch=144). Running total: 240 → 304 → 266 → 288 → 236 → 236 ─── -->
+ <!-- FY25 base: total 240, anchored at the floor. y(240)=192, h=228 -->
+ <rect x="112" y="192" width="96" height="228" fill="#f5f5f5"/>
+ <rect x="112" y="192" width="96" height="228" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1" data-role="total" data-value="240" data-name="FY25 base"/>
+ <text x="160" y="184" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">240</text>
+
+ <!-- Headcount: +64 rises 240 → 304. y(304)=131, h=61 -->
+ <rect x="256" y="131" width="96" height="61" fill="#f5f5f5"/>
+ <rect x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="+64" data-name="Headcount"/>
+ <text x="304" y="123" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+64</text>
+
+ <!-- Reserved instances: −38 falls 304 → 266. Hollow = decrease. y=131, h=36 -->
+ <rect x="400" y="131" width="96" height="36" fill="#f5f5f5"/>
+ <rect x="400" y="131" width="96" height="36" fill="#f5f5f5" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="-38" data-name="Reserved inst."/>
+ <text x="448" y="179" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">−38</text>
+
+ <!-- ML workloads: +22 rises 266 → 288. y(288)=146, h=21 -->
+ <rect x="544" y="146" width="96" height="21" fill="#f5f5f5"/>
+ <rect x="544" y="146" width="96" height="21" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="+22" data-name="ML workloads"/>
+ <text x="592" y="138" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+22</text>
+
+ <!-- Storage tiering FOCAL: −52 falls 288 → 236 — the largest saving, the story. y=146, h=50 -->
+ <rect x="688" y="146" width="96" height="50" fill="#f5f5f5"/>
+ <rect x="688" y="146" width="96" height="50" fill="rgba(235,108,54,0.12)" stroke="#eb6c36" stroke-width="1" data-role="delta" data-value="-52" data-name="Storage tiering"/>
+ <text x="736" y="208" fill="#2d3142" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" font-weight="600">−52</text>
+
+ <!-- FY26 plan: total 236 = 240 + 64 − 38 + 22 − 52, anchored at the floor. y(236)=196, h=224 -->
+ <rect x="832" y="196" width="96" height="224" fill="#f5f5f5"/>
+ <rect x="832" y="196" width="96" height="224" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1" data-role="total" data-value="236" data-name="FY26 plan"/>
+ <text x="880" y="188" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">236</text>
+
+ <!-- X-axis category labels -->
+ <text x="160" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">FY25 base</text>
+ <text x="304" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Headcount</text>
+ <text x="448" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Reserved inst.</text>
+ <text x="592" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">ML workloads</text>
+ <text x="736" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Storage tiering</text>
+ <text x="880" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">FY26 plan</text>
+
+ <!-- Legend -->
+ <line x1="40" y1="462" x2="960" y2="462" stroke="rgba(45,49,66,0.10)" stroke-width="0.8"/>
+ <text x="40" y="478" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">LEGEND</text>
+
+ <rect x="40" y="488" width="16" height="10" rx="2" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1"/>
+ <text x="64" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Start / end total</text>
+
+ <rect x="200" y="488" width="16" height="10" rx="2" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1"/>
+ <text x="224" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Cost added</text>
+
+ <rect x="340" y="488" width="16" height="10" rx="2" fill="#f5f5f5" stroke="#4f5d75" stroke-width="1"/>
+ <text x="364" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Cost removed</text>
+
+ <rect x="480" y="488" width="16" height="10" rx="2" fill="rgba(235,108,54,0.12)" stroke="#eb6c36" stroke-width="1"/>
+ <text x="504" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Storage tiering · largest saving</text>
+ </svg>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/index.html b/skills/diagram-design/assets/index.html
index d5f34ed..0511d21 100644
--- a/skills/diagram-design/assets/index.html
+++ b/skills/diagram-design/assets/index.html
@@ -265,6 +265,9 @@
<button class="tab new" data-type="bar">
<span class="eyebrow">19</span>Bar
</button>
+ <button class="tab new" data-type="waterfall">
+ <span class="eyebrow">54</span>Waterfall
+ </button>
<button class="tab new" data-type="line">
<span class="eyebrow">20</span>Line
</button>
diff --git a/skills/diagram-design/references/onboarding.md b/skills/diagram-design/references/onboarding.md
index c7533ff..da4c0f7 100644
--- a/skills/diagram-design/references/onboarding.md
+++ b/skills/diagram-design/references/onboarding.md
@@ -161,7 +161,7 @@ Write the new tokens to `style-guide.md`. Suggest running the `/regenerate-examp
After onboarding, the user should:
-1. Open `assets/index.html` (gallery) and confirm the new palette feels coherent across all 39 types.
+1. Open `assets/index.html` (gallery) and confirm the new palette feels coherent across all 40 types.
2. If any type looks off, they usually need to tune `muted` (often too dark or too light against the new `paper`).
---
diff --git a/skills/diagram-design/references/semantic-patterns.md b/skills/diagram-design/references/semantic-patterns.md
index 97ae1e0..4508a94 100644
--- a/skills/diagram-design/references/semantic-patterns.md
+++ b/skills/diagram-design/references/semantic-patterns.md
@@ -1,6 +1,6 @@
# Semantic patterns
-Semantic patterns describe **what a system does**; the 39 visual types describe **how information is arranged**. Choose a pattern first when behavior, state, enforcement, or risk is load-bearing, then use its nearest visual type as the layout grammar. If no pattern matches, choose a visual type directly.
+Semantic patterns describe **what a system does**; the 40 visual types describe **how information is arranged**. Choose a pattern first when behavior, state, enforcement, or risk is load-bearing, then use its nearest visual type as the layout grammar. If no pattern matches, choose a visual type directly.
Use one primary pattern per figure. A second pattern may supply at most one supporting primitive; if both need full treatment, split overview and detail. Labels and outcomes must remain complete in a static frame.
diff --git a/skills/diagram-design/references/type-waterfall.md b/skills/diagram-design/references/type-waterfall.md
new file mode 100644
index 0000000..76c6959
--- /dev/null
+++ b/skills/diagram-design/references/type-waterfall.md
@@ -0,0 +1,74 @@
+# Waterfall Chart
+
+**Best for:** showing how a start total becomes an end total through signed contributions — a budget bridge (FY25 baseline → FY26 plan), headcount deltas (starting roster ± hires ± attrition), conversion leak/gain, P&L walk. Use when the running total is the story: every bar either anchors the total or bridges one running level to the next, and the reader traces the path from start to end.
+
+**Not this type:**
+
+- Two endpoints where only the *gap* matters → **dumbbell** (a Bar variant, `type-bar.md`). A dumbbell states two values and their distance; a waterfall states a path of signed steps that must reconcile. The types look adjacent but make opposite claims: the dumbbell hides what happened in between, the waterfall *is* what happened in between.
+- Independent category comparisons → **bar** (`type-bar.md`).
+- One quantity splitting and merging across stages → **Sankey** (`type-sankey.md`). A waterfall is strictly sequential and one-dimensional; the bars never branch.
+- Ordered drop-off through stages of one funnel → **pyramid / funnel** (`type-pyramid.md`).
+
+## Layout conventions
+
+- **Orientation:** vertical columns only, left → right in narrative order: start total, then each signed bridge, optional subtotal, end total. A horizontal waterfall reads as a Gantt.
+- **Plot area:** left 80px (y-axis labels), bottom 60px (category labels), top 40px, right 40px — inside a `0 0 1000 500` viewBox, same frame as the bar chart. Plot band x 80→960, y 40→420.
+- **Bar count:** 3–8 bars total, including both totals and at most one subtotal. More contributions than that → merge the tail into one named "Other" bridge (disclose what it contains) or split the walk into two charts.
+- **Bar width / pitch:** equal-width bars on an even pitch, bar ≥ 50% of the pitch. Six bars fit as width=96 on a 144px pitch starting at x=112.
+- **Totals anchor, bridges float.** The start total, any subtotal, and the end total are drawn from the domain floor (the x-axis baseline) up to their value. Bridge bars span exactly the running total before and after their contribution — an increase rises from the previous level, a decrease falls from it.
+- **Carry rules (the bridge grammar).** A horizontal connector line carries the running total across each gap between adjacent bars, drawn at the shared level: from the right edge of one bar to the left edge of the next, `rgba(45,49,66,0.55)` at 1px on light paper (`rgba(245,245,245,0.40)` dark) — the dumbbell's connector weight, because the carry is load-bearing and must clear 3:1, not the 0.25 axis hairline. Each carry declares the running total it transports in `data-carry`.
+- **Machine-readable data contract.** Every bar rect declares `data-role` (`total`, `delta`, or `subtotal`), `data-value` (totals unsigned, deltas explicitly signed `+`/`-`), and `data-name`. `scripts/verify-waterfall.py` reads these and fails the build when the drawing and the declaration disagree — see the honesty rules below.
+- **Sign is encoded by fill weight, not hue.** Increases take the bar family's default tint (`rgba(79,93,117,0.15)` fill, `muted` stroke). Decreases are hollow — paper fill, same `muted` stroke — so the two directions survive greyscale and colour-vision deficiency without leaning on the accent. The geometry (which end of the bar meets the carry) and the signed printed value are the second and third encodings of the same fact.
+- **Totals are the heaviest marks:** `rgba(45,49,66,0.08)` fill with a 1px `ink` stroke. The reader's eye should land on the two anchors first, then walk the bridges.
+- **Focal bridge (≤1, optional):** the one contribution the chart exists to show gets the bar family's focal treatment — `rgba(235,108,54,0.12)` fill, `accent` stroke, accent value label. It replaces that bar's sign fill; the signed label and geometry still carry the direction.
+- **Value labels:** Geist Mono 8px. Totals and increases print above the bar top (baseline `top − 8`); decreases print below the bar bottom (baseline `bottom + 12`), because the space above a decrease is where its carry arrives. Deltas print with an explicit sign (`+64`, `−38`); totals print unsigned.
+- **Gridlines / axes:** identical to the bar chart — 4–6 faint horizontal gridlines `rgba(45,49,66,0.08)` 0.8px, y-axis line and x-axis baseline `rgba(45,49,66,0.25)` 1px, tick labels Geist Mono 8px muted right-aligned at x=72, rotated y-axis title Geist Mono 7px tracked.
+- **Category labels:** centered under each bar at y=440, Geist 11px 600 ink; the focal bar's label may take accent.
+- **Legend:** horizontal bottom strip after a hairline rule, one key per treatment used: total, increase, decrease, focal.
+
+### Waterfall element pattern
+
+```svg
+<!-- Start total: anchored at the baseline (y=420), value 240 on a 0–400 domain, k=0.95 px/unit -->
+<rect x="112" y="192" width="96" height="228" fill="#f5f5f5"/>
+<rect x="112" y="192" width="96" height="228" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1"
+ data-role="total" data-value="240" data-name="FY25 base"/>
+<text x="160" y="184" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">240</text>
+
+<!-- Carry: the running total (240) crosses the gap at its own level -->
+<line x1="208" y1="192" x2="256" y2="192" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="240"/>
+
+<!-- Increase bridge: +64 rises from 240 to 304 -->
+<rect x="256" y="131" width="96" height="61" fill="#f5f5f5"/>
+<rect x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1"
+ data-role="delta" data-value="+64" data-name="Headcount"/>
+<text x="304" y="123" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+64</text>
+```
+
+Endpoint positions round to the nearest integer pixel and never snap to the 4px grid — data coordinates are exempt, exactly as in the dumbbell. Bar x-positions and widths are layout, so they stay on the grid.
+
+## Anti-patterns
+
+- **A floating bar with no carry.** The connector is the claim that the total is conserved across the gap; without it the chart is bars at odd heights.
+- **Sign by hue alone** (green up / red down, or accent on every decrease). Hue is the one channel that does not survive greyscale or CVD; fill weight and geometry carry the sign here, and the accent stays editorial.
+- **A truncated value axis.** The domain follows the data's range, never its observed extremes — the same rule, cases, and all-zero fallback as the dumbbell (`type-bar.md` § Dumbbell honesty rules). A waterfall on a clipped domain inflates every bridge.
+- **More than one subtotal.** A walk that needs several resting points is two walks; split it.
+- **Mixing units mid-walk.** Every bar is in the start total's unit or the reconciliation is fiction.
+- **3-D, shadows, rounded bridge bars** — same editorial rules as every chart here.
+
+## Waterfall honesty rules
+
+- **The running total must conserve.** Start + every signed bridge = each subtotal and the end total, exactly — the declared `data-value`s must reconcile before geometry is even considered. A waterfall that doesn't add up is not approximately right, it is wrong.
+- **Bridges span exactly their two running levels.** Each bar's drawn top and bottom must sit where the shared scale puts the running totals before and after it (±0.75px for integer rounding). Stretching one bridge "for legibility" moves money that doesn't exist.
+- **Every carry sits at the level it transports,** spanning its full gap, and declares that value. A carry drawn at the wrong height reconnects the walk to a different total.
+- **Every bar prints its value, deltas with an explicit sign.** An unsigned bridge asks the reader to infer direction from geometry alone; print `+`/`−`.
+- **Zero bridges are dropped, never drawn.** A zero-height bar is invisible ink that still occupies a column; state it in prose or the source line instead.
+- **A degenerate start (zero or negative total) is a named failure,** not a silently rescaled chart — the scale is derived from the start anchor.
+
+These rules are executable: `scripts/verify-waterfall.py` reads each bar's declaration, recomputes the running totals, refits the shared scale from the start anchor, and fails on any conservation, geometry, carry, label, or sign-treatment drift. `scripts/test-verify-waterfall.py` proves both polarities — the shipped examples pass, and each mutation class above fails with a named finding.
+
+## Examples
+
+- `assets/example-waterfall.html` — minimal light
+- `assets/example-waterfall-dark.html` — minimal dark
+- `assets/example-waterfall-full.html` — full editorial