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.
docs(skill): route SKILL.md detail to primitives-core and layout-budget (#259)
Cathryn Lavery91e774a2acd0
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 5f2eb0d..1e3dc9a 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -53,7 +53,7 @@ Every validation gate below must pass before a PR is ready. They also run automa| Doctor diagnostics contract (env checks, script presence, routing wiring) | `python3 scripts/verify-doctor.py` || Doctor diagnostics adversarial tests | `python3 scripts/test-verify-doctor.py` || Every shipped motion template/example | `python3 scripts/verify-motion.py --shipped` |-| Docs/routing sync (description hooks, gallery, README tree, reference links and style-guide anchors, strict-bundler support paths, command/prompt surfaces, font-link parity, template title fallback order) | `python3 scripts/verify-docs-sync.py && python3 scripts/test-verify-docs-sync.py` |+| Docs/routing sync (description hooks, gallery, README tree, reference links and style-guide anchors, strict-bundler support paths, command/prompt surfaces, font-link parity, template title fallback order, SKILL.md split routing) | `python3 scripts/verify-docs-sync.py && python3 scripts/test-verify-docs-sync.py` || Canonical README screenshots match their example HTML sources and recorded PNG digests | `python3 scripts/verify-screenshot-freshness.py` || README WebP previews match their PNGs, manifest, dimensions, and full-size links | `python3 scripts/test-build-readme-thumbs.py && python3 scripts/build-readme-thumbs.py --check` (requires `Pillow==12.1.1`) || Packaged output self-check behaves (pass + adversarial cases) | `python3 scripts/test-self-check.py` |@@ -87,7 +87,7 @@ Every validation gate below must pass before a PR is ready. They also run automa| Skin-polarity checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-skin-polarity.py` || Generated icon assets are up to date (`icons.html`, `primitive-icons.md`) | `python3 scripts/build-icons.py` then `git diff --exit-code` on the two generated files |-The semantic-pattern gate also caps `skills/diagram-design/SKILL.md` at 40,000 bytes so the installed skill remains practical to load. If that gate fails, reduce duplication or move detail into a routed reference; do not remove routing vocabulary from frontmatter.+The semantic-pattern gate also caps `skills/diagram-design/SKILL.md` at 40,000 bytes so the installed skill remains practical to load. If that gate fails, reduce duplication or move detail into a routed reference; do not remove routing vocabulary from frontmatter. SKILL.md is a router: SVG markup and the long form of the connector rules live in `references/primitives-core.md`, and the 4px grid table, per-type complexity budget rows, page layout, and summary cards live in `references/layout-budget.md` (ADR 0004, 2026-09-27 amendment). A new type's budget row goes in `layout-budget.md`, not SKILL.md.Keep native plugin and marketplace `description` fields within 500 charactersfor Cowork installation compatibility ([#208](https://github.com/cathrynlavery/diagram-design/issues/208)).diff --git a/README.md b/README.mdindex ce16b61..eee537a 100644--- a/README.md+++ b/README.md@@ -446,6 +446,8 @@ diagram-design/│ │ ├── type-uml-class.md│ │ ├── type-story-map.md│ │ ├── type-db-schema.md+│ │ ├── primitives-core.md+│ │ ├── layout-budget.md│ │ ├── primitive-annotation.md│ │ ├── primitive-sketchy.md│ │ └── primitive-terminal.md@@ -576,7 +578,7 @@ At startup, the agent sees only the skill name and description. When a request m| "Redraw this .drawio file for my deck" | `SKILL.md` + `references/import-drawio.md` + `references/output-spec.md` + the chosen type's reference || "Redraw this Mermaid block for my deck" | `SKILL.md` + `references/import-mermaid.md` + `references/output-spec.md` + the chosen type's reference || "Redraw this Excalidraw sketch for my deck" | `SKILL.md` + `references/import-excalidraw.md` + `references/output-spec.md` + the chosen type's reference |-| Routine static diagram-making (any visual type) | Only `SKILL.md` + that one type's reference |+| Routine static diagram-making (any visual type) | `SKILL.md` + that one type's reference, plus `references/primitives-core.md` or `references/layout-budget.md` only when it needs exact markup or a per-type budget row |No matter how many types exist, the agent only reads the one you need. Add a new type tomorrow and nothing else changes.@@ -584,7 +586,7 @@ No matter how many types exist, the agent only reads the one you need. Add a new## It's working if…-- A routine request ("make me a flowchart") loads `SKILL.md` plus exactly one type reference — nothing else.+- A routine request ("make me a flowchart") loads `SKILL.md`, exactly one type reference, and at most the two core references (`primitives-core.md`, `layout-budget.md`), and nothing else.- Before drawing, the agent states the chosen type, pattern, size, and planned cuts, then renders.- The output is one `.html` file that opens double-clicked, offline, with no network requests beyond Google Fonts.- Screen readers announce the diagram's title and description; `prefers-reduced-motion` shows the complete static frame.diff --git a/docs/adr/0004-skill-md-byte-cap-and-trigger-rich-description.md b/docs/adr/0004-skill-md-byte-cap-and-trigger-rich-description.mdindex 82bb618..22428a5 100644--- a/docs/adr/0004-skill-md-byte-cap-and-trigger-rich-description.md+++ b/docs/adr/0004-skill-md-byte-cap-and-trigger-rich-description.md@@ -17,3 +17,15 @@ Two rules, in priority order:- Adding a visual type requires touching the description; CI fails otherwise, by design.- `.gitattributes` pins SKILL.md to LF in the repository and in every checkout, and the cap counts LF-normalized bytes, so a checkout with `core.autocrlf=true` measures the committed size ([#246](https://github.com/cathrynlavery/diagram-design/issues/246)). Normalization never loosens the cap: 40,001 LF bytes still fail, and the gate fails if the pin is removed.++## Amendments++**2026-09-27: SKILL.md is a router; detail loads from two routed references.** SKILL.md loads on every invocation, and at 39,530 bytes it had 470 bytes of headroom. It is now 28,869 bytes. The frontmatter `description` is unchanged, the §0 to §12 numbering is unchanged, and SKILL.md keeps what every run needs: the setup gate, the §3 routing tables, the anti-patterns, the semantic roles and focal rule, the six connector rules as one line each with their numbers, the universal complexity limits and split rule, the §9 gate, §11, and a one-line-per-point accessible-SVG contract. Everything else moved, verbatim or to an equivalent that already existed:++- `references/primitives-core.md` (new): background and dotted variant, arrow markers and the arrow table, the full text of the six connector rules, the node box, arrow label and legend markup, and the long form of the accessible-SVG contract.+- `references/layout-budget.md` (new): the 4px grid table, every per-type complexity budget row, page layout, and the summary card pattern.+- `references/style-guide.md` (existing): it already held the node type to treatment table, the typography table, and the Google Fonts `<link>` that SKILL.md repeated, so SKILL.md now links those sections instead of copying them.++The checks follow the content. `verify-docs-sync.py` runs the grid rule against `layout-budget.md` and the type-ramp font-size rule against SKILL.md, `primitives-core.md`, and `layout-budget.md`. Font-link parity no longer requires a copy in SKILL.md, and now also checks any css2 copy found in SKILL.md or any reference. A new split-routing check fails when a thinned SKILL.md section (§5, §6, §7, §8, §12) drops the exact link to any block it moved out. The 40,000-byte cap and rule 1 are unchanged.++A new type's budget row goes in `layout-budget.md`. ADR 0007 kept the rows in SKILL.md because several older type references state no limits of their own; that reason still holds, which is why the rows moved together into one table rather than into the type references.diff --git a/scripts/test-verify-docs-sync.py b/scripts/test-verify-docs-sync.pyindex 25ae832..99b8a5b 100644--- a/scripts/test-verify-docs-sync.py+++ b/scripts/test-verify-docs-sync.py@@ -107,6 +107,8 @@ def load_verify_module():# Every file that carries the Google Fonts css2 link or the export @import.# The fixtures copy them from the real tree, so the passing case is the# shipped wiring and each mutation below is the only defect in the tree.+# SKILL.md left both lists when the ADR 0004 split routed its typography to+# style-guide.md; check_font_link_copies covers a copy that comes back.FONT_SURFACES = ("assets/template.html","assets/template-dark.html",@@ -114,7 +116,6 @@ FONT_SURFACES = ("assets/template-motion.html","references/style-guide.md","references/export.md",- "SKILL.md",)# Spelled out here rather than read from the verifier: a surface or template# dropped from the verifier's own lists must fail a test, not shrink it.@@ -123,7 +124,14 @@ LINK_SURFACES = ("assets/template-full.html","assets/template-motion.html","references/style-guide.md",+)+# Files the ADR 0004 split made carriers of the type-ramp contract: the grid+# owner, the two files holding markup patterns, and the spec they answer to.+TYPE_RAMP_FILES = ("SKILL.md",+ "references/primitives-core.md",+ "references/layout-budget.md",+ "references/output-spec.md",)TEMPLATES = ("assets/template.html",@@ -363,6 +371,218 @@ def check_title_font_link(verify) -> None:print("OK title links: every template loads the Noto Serif its stack names")+def check_font_link_copies(verify) -> None:+ """A css2 link outside the required surfaces is still held to parity.++ SKILL.md carried a required copy until the ADR 0004 split routed its+ typography to style-guide.md. A copy that comes back, in SKILL.md or in any+ reference, must match the template like every required one does.+ """+ style_guide = (ROOT / "skills/diagram-design/references/style-guide.md").read_text(+ encoding="utf-8"+ )+ link = next(line for line in style_guide.splitlines() if "fonts.googleapis.com/css2" in line)+ drifted = link.replace(NOTO_SERIF_FAMILY, "")+ if drifted == link:+ raise AssertionError("style-guide.md font link no longer requests Noto Serif")+ for relative in ("SKILL.md", "references/primitives-core.md"):+ shipped = (ROOT / "skills/diagram-design" / relative).read_text(encoding="utf-8")+ with font_fixture() as root:+ path = root / "skills/diagram-design" / relative+ path.write_text(shipped, encoding="utf-8")+ errors = run_checks(root, verify.check_export_font_parity)+ if errors:+ raise AssertionError(f"shipped {relative} failed font parity: {errors}")++ path.write_text(shipped + f"\n```html\n{link}\n```\n", encoding="utf-8")+ errors = run_checks(root, verify.check_export_font_parity)+ if errors:+ raise AssertionError(f"a matching css2 copy in {relative} was rejected: {errors}")++ expected = [+ f"{relative} font link drifts from assets/template.html: missing Noto Serif"+ ]+ for copy in (drifted, single_quoted(drifted)):+ path.write_text(shipped + f"\n```html\n{copy}\n```\n", encoding="utf-8")+ errors = run_checks(root, verify.check_export_font_parity)+ if errors != expected:+ raise AssertionError(+ f"a drifted css2 copy in {relative} was not reported: {copy} {errors}"+ )++ path.write_text(shipped + f"\n```html\n{single_quoted(link)}\n```\n", encoding="utf-8")+ errors = run_checks(root, verify.check_export_font_parity)+ if errors:+ raise AssertionError(+ f"a matching single-quoted css2 copy in {relative} was rejected: {errors}"+ )++ # A required surface may quote its href either way; drift is still drift,+ # not a missing link.+ with font_fixture() as root:+ path = root / "skills/diagram-design/references/style-guide.md"+ path.write_text(style_guide.replace(link, single_quoted(link)), encoding="utf-8")+ errors = run_checks(root, verify.check_export_font_parity)+ if errors:+ raise AssertionError(f"a single-quoted style-guide link was rejected: {errors}")++ path.write_text(style_guide.replace(link, single_quoted(drifted)), encoding="utf-8")+ errors = run_checks(root, verify.check_export_font_parity)+ expected = [+ "references/style-guide.md font link drifts from assets/template.html: "+ "missing Noto Serif"+ ]+ if errors != expected:+ raise AssertionError(f"a single-quoted drifted style-guide link was not reported: {errors}")+ print("OK font links: a css2 copy in SKILL.md or any reference is held to parity")+++def single_quoted(link: str) -> str:+ """*link* with its href value in single quotes instead of double."""+ head, marker, rest = link.partition('href="')+ value, closing, tail = rest.partition('"')+ if not marker or not closing:+ raise AssertionError(f"no double-quoted href to requote in {link!r}")+ return f"{head}href='{value}'{tail}"+++@contextmanager+def type_ramp_fixture():+ """Yield a temp root holding the shipped type-ramp carriers, byte for byte."""+ with tempfile.TemporaryDirectory(prefix="verify-docs-sync-ramp-") as temp_dir:+ root = Path(temp_dir)+ for relative in TYPE_RAMP_FILES:+ target = root / "skills/diagram-design" / relative+ target.parent.mkdir(parents=True, exist_ok=True)+ target.write_bytes((ROOT / "skills/diagram-design" / relative).read_bytes())+ yield root+++def check_split_type_ramp(verify) -> None:+ """The type-ramp contract follows the grid and the patterns out of SKILL.md."""+ errors: list[str] = []+ verify.check_type_ramp_surfaces(errors, ROOT)+ if errors:+ raise AssertionError(f"shipped type-ramp surfaces disagree with output-spec.md: {errors}")++ with type_ramp_fixture() as root:+ package = root / "skills/diagram-design"+ grid = package / "references/layout-budget.md"+ primitives = package / "references/primitives-core.md"+ skill = package / "SKILL.md"+ if run_checks(root, verify.check_type_ramp_surfaces):+ raise AssertionError("the shipped type-ramp fixture does not pass")++ original = mutate(grid, "### 4px grid\n", "### Grid\n")+ errors = run_checks(root, verify.check_type_ramp_surfaces)+ if errors != ["references/layout-budget.md has no '### 4px grid' section"]:+ raise AssertionError(f"a grid owner without the grid was not reported: {errors}")+ grid.write_bytes(original)++ original = mutate(+ grid,+ "| Border radius | 4, 6, 8 |\n",+ "| Border radius | 4, 6, 8 |\n| Font sizes | 8, 12 |\n",+ )+ errors = run_checks(root, verify.check_type_ramp_surfaces)+ if (+ len(errors) != 1+ or not errors[0].startswith("references/layout-budget.md 4px-grid table")+ or "'Font sizes' row" not in errors[0]+ ):+ raise AssertionError(f"a font-size row in the moved grid was not reported: {errors}")+ grid.write_bytes(original)++ original = mutate(grid, " (role ramp in `references/output-spec.md`)", "")+ errors = run_checks(root, verify.check_type_ramp_surfaces)+ if len(errors) != 1 or not errors[0].startswith(+ "references/layout-budget.md 4px-grid section does not link to references/output-spec.md"+ ):+ raise AssertionError(f"an unlinked moved grid was not reported: {errors}")+ grid.write_bytes(original)++ original = mutate(primitives, 'font-size="12"', 'font-size="13"')+ errors = run_checks(root, verify.check_type_ramp_surfaces)+ if len(errors) != 1 or not errors[0].startswith(+ "references/primitives-core.md uses font-size=13 on sans-600 text"+ ):+ raise AssertionError(f"an off-ramp size in the moved patterns was not reported: {errors}")+ primitives.write_bytes(original)++ original = skill.read_bytes()+ skill.write_text(+ original.decode("utf-8")+ + "\n<text font-size=\"13\" font-weight=\"600\" "+ "font-family=\"'Geist', sans-serif\">X</text>\n",+ encoding="utf-8",+ )+ errors = run_checks(root, verify.check_type_ramp_surfaces)+ if len(errors) != 1 or not errors[0].startswith("SKILL.md uses font-size=13"):+ raise AssertionError(f"an off-ramp size back in SKILL.md was not reported: {errors}")+ skill.write_bytes(original)++ original = grid.read_bytes()+ grid.unlink()+ errors = run_checks(root, verify.check_type_ramp_surfaces)+ if errors != ["type-ramp surface is missing: references/layout-budget.md"]:+ raise AssertionError(f"a missing grid owner was not reported: {errors}")+ grid.write_bytes(original)+ print("OK type ramp: the moved grid and patterns are held to the output-spec ramp")+++# Every link a section thinned by the ADR 0004 split must keep, one per moved+# block. Spelled out here so a route dropped from the verifier fails a test.+SPLIT_ROUTE_LINKS = (+ ("## 5. Design System", "references/style-guide.md#node-type--treatment"),+ ("## 5. Design System", "references/style-guide.md#typography"),+ ("## 6. Core SVG Primitives", "references/primitives-core.md"),+ ("## 6. Core SVG Primitives", "references/primitives-core.md#mandatory-connector-rules"),+ ("## 7. Layout & Spacing", "references/layout-budget.md"),+ ("## 7. Layout & Spacing", "references/layout-budget.md#complexity-budget-per-diagram"),+ ("## 8. Summary Card Pattern", "references/layout-budget.md#summary-card-pattern"),+ ("## 12. Output", "references/primitives-core.md#accessible-svg-contract"),+)+++def split_route_error(heading: str, target: str) -> str:+ return (+ f"SKILL.md {heading!r} no longer routes to {target}; the ADR 0004 split "+ "moved that content there, so it would ship unreachable"+ )+++def check_split_routes(verify) -> None:+ """Each SKILL.md section the ADR 0004 split thinned still routes to its content."""+ skill = verify.SKILL.read_text(encoding="utf-8")+ errors: list[str] = []+ verify.check_split_routes(errors, skill)+ if errors:+ raise AssertionError(f"shipped SKILL.md split routes failed: {errors}")++ # Each moved block keeps its own link, so dropping any one link alone must+ # fail, even while a sibling link to the same file survives in the section.+ for heading, target in SPLIT_ROUTE_LINKS:+ link = f"]({target})"+ if skill.count(link) != 1:+ raise AssertionError(f"SKILL.md should carry {link!r} exactly once; update the fixture")+ errors = []+ verify.check_split_routes(errors, skill.replace(link, "](references/gone.md)"))+ if errors != [split_route_error(heading, target)]:+ raise AssertionError(f"dropping only the {target} link was not reported: {errors}")++ errors = []+ verify.check_split_routes(+ errors, skill.replace("## 8. Summary Card Pattern", "## Summary cards", 1)+ )+ expected = [+ "SKILL.md has no '## 8.' section; it must route to "+ "references/layout-budget.md#summary-card-pattern"+ ]+ if errors != expected:+ raise AssertionError(f"a renumbered split section was not reported: {errors}")+ print("OK split routes: every section the split thinned still links its new home")++def check_style_guide_anchors(verify) -> None:"""SKILL.md's routing links must land on a heading, not only on the file."""skill = verify.SKILL.read_text(encoding="utf-8")@@ -759,14 +979,12 @@ def main() -> int:if len(errors) != 1 or "font-size=72" not in errors[0]:raise AssertionError(f"opaque watermark size was not reported: {errors}")+ # The grid lives in layout-budget.md and the markup patterns in+ # primitives-core.md since the ADR 0004 split; SKILL.md stays covered too.errors = []- verify.check_type_ramp(- errors,- verify.SKILL.read_text(encoding="utf-8"),- verify.OUTPUT_SPEC_REFERENCE.read_text(encoding="utf-8"),- )+ verify.check_type_ramp_surfaces(errors, ROOT)if errors:- raise AssertionError(f"shipped SKILL.md and output-spec.md disagree: {errors}")+ raise AssertionError(f"shipped type-ramp surfaces and output-spec.md disagree: {errors}")# ── registered legacy sizes ──────────────────────────────────────────────legacy_markup = (@@ -1575,18 +1793,21 @@ diagram-design/print("OK reference assets: valid asset citations produce no error")check_font_link_parity(verify)+ check_font_link_copies(verify)check_title_stack_order(verify)check_title_font_link(verify)check_style_guide_anchors(verify)check_heading_syntax(verify)check_size_preset_surfaces(verify)+ check_split_type_ramp(verify)+ check_split_routes(verify)print("PASS: docs sync checks references, style-guide anchors, asset citations, ""strict-bundler packaging, ""routing surfaces, size-preset surfaces, Factory install contract, type-count routing, High-Level invariants, ""font-link parity, the Cyrillic title fallback order, the type-ramp contract, "- "and gallery guards (parent/variant model, contiguous ordinals)"+ "split routing, and gallery guards (parent/variant model, contiguous ordinals)")return 0diff --git a/scripts/verify-docs-sync.py b/scripts/verify-docs-sync.pyindex 69248b2..0ba4eb4 100644--- a/scripts/verify-docs-sync.py+++ b/scripts/verify-docs-sync.py@@ -1,8 +1,8 @@#!/usr/bin/env python3"""Verify that routing and browsing surfaces stay in sync with the skill.-Fifteen drift classes. The first fourteen have each shipped before; the-fifteenth nearly did (#217):+Sixteen drift classes. The first fourteen have each shipped before; the+fifteenth nearly did (#217); the sixteenth guards the ADR 0004 split:1. The SKILL.md frontmatter description is the only text an agent sees beforedeciding to load the skill — every visual type in the selection table must@@ -27,19 +27,24 @@ fifteenth nearly did (#217):10. The High-Level reproducibility checklist must agree with its canvas formulaand retain sequential numbering.11. The canonical dark Line example must keep the dark-skin tokens and canvas.-12. The SKILL.md 4px-grid section and the output-spec type ramp must agree: the- grid table carries no font-size row, the grid section links to- references/output-spec.md, the ramp table keeps its five type roles across all- three presets, and every font-size in SKILL.md's §6 patterns is a canonical- role size or falls inside a named exception.+12. The 4px-grid section (references/layout-budget.md since the ADR 0004 split)+ and the output-spec type ramp must agree: the grid table carries no font-size+ row, the grid section links to references/output-spec.md, the ramp table+ keeps its five type roles across all three presets, and every font-size in+ SKILL.md, references/primitives-core.md (the §6 markup patterns), and the+ grid owner is a canonical role size or falls inside a named exception.13. Every copy of the Google Fonts css2 link must request the families- assets/template.html does, and the export @import must include them.+ assets/template.html does, and the export @import must include them. A copy+ in SKILL.md or any reference is held to the same parity even where no copy+ is required.14. Every --font-serif in a template must reach 'Noto Serif' before any CJKserif face, which Google Fonts also slices Cyrillic into, and thetemplate's own font link must request it.15. Every surface that lists the size presets for selection — the SKILL.mdand README output-dial tables and the three import commands — must nameexactly the presets in the output-spec.md size table, in its order.+16. Every SKILL.md section the ADR 0004 split thinned must keep the exact link+ to each block it moved out, or that content ships unreachable."""from __future__ import annotations@@ -1109,20 +1114,38 @@ def format_size(value: float) -> str:return f"{value:g}"-def check_type_ramp(errors: list[str], skill_markdown: str, spec_markdown: str) -> None:- """The grid section and the output-spec role ramp are one contract."""- grid = section(skill_markdown, "### 4px grid")+# The ADR 0004 split moved the grid table out of SKILL.md §7 and the markup+# patterns out of §6. The contract follows them: the grid owner must carry the+# grid, and every file holding a pattern, SKILL.md included, answers to the ramp.+GRID_OWNER = Path("references/layout-budget.md")+TYPE_PATTERN_SURFACES = (Path("SKILL.md"), Path("references/primitives-core.md"))+++def check_type_ramp(+ errors: list[str],+ grid_markdown: str,+ spec_markdown: str,+ *,+ grid_source: str = GRID_OWNER.as_posix(),+ patterns: dict[str, str] | None = None,+) -> None:+ """The grid section and the output-spec role ramp are one contract.++ *grid_markdown* must hold the `### 4px grid` section; its font sizes and+ those in each of *patterns* (name to markdown) must sit on the role ramp.+ """+ grid = section(grid_markdown, "### 4px grid")if not grid:- errors.append("SKILL.md has no '### 4px grid' section")+ errors.append(f"{grid_source} has no '### 4px grid' section")else:if re.search(r"^\|\s*Font sizes", grid, re.MULTILINE):errors.append(- "SKILL.md 4px-grid table carries a 'Font sizes' row; type sizes "+ f"{grid_source} 4px-grid table carries a 'Font sizes' row; type sizes ""belong to the role ramp in references/output-spec.md, not the grid")if "references/output-spec.md" not in grid:errors.append(- "SKILL.md 4px-grid section does not link to references/output-spec.md "+ f"{grid_source} 4px-grid section does not link to references/output-spec.md ""for the type ramp")@@ -1130,11 +1153,80 @@ def check_type_ramp(errors: list[str], skill_markdown: str, spec_markdown: str)if contract is None:return- styles = Styles(skill_markdown, contract.role_tokens)- for value, tag, context in font_sizes(skill_markdown, styles):- violation = contract.violation(tag, context, value)- if violation:- errors.append(f"SKILL.md uses {violation}")+ for name, markdown in ((grid_source, grid_markdown), *(patterns or {}).items()):+ styles = Styles(markdown, contract.role_tokens)+ for value, tag, context in font_sizes(markdown, styles):+ violation = contract.violation(tag, context, value)+ if violation:+ errors.append(f"{name} uses {violation}")+++def check_type_ramp_surfaces(errors: list[str], root: Path) -> None:+ """Run the type-ramp contract over the grid owner and every pattern file."""+ package = root / SKILL_PACKAGE+ spec_path = package / "references/output-spec.md"+ if not spec_path.is_file():+ errors.append("type-ramp surface is missing: references/output-spec.md")+ return+ texts: dict[str, str] = {}+ for relative in (GRID_OWNER, *TYPE_PATTERN_SURFACES):+ path = package / relative+ if not path.is_file():+ errors.append(f"type-ramp surface is missing: {relative.as_posix()}")+ continue+ texts[relative.as_posix()] = path.read_text(encoding="utf-8")+ grid_markdown = texts.pop(GRID_OWNER.as_posix(), None)+ if grid_markdown is None:+ return+ check_type_ramp(+ errors,+ grid_markdown,+ spec_path.read_text(encoding="utf-8"),+ grid_source=GRID_OWNER.as_posix(),+ patterns=texts,+ )+++# What the ADR 0004 split (2026-09-27) moved out of SKILL.md, by the section+# that used to hold it. Each moved block keeps its own link to the new home,+# matched exactly: a surviving link to the same file under another anchor does+# not stand in for it. The checks above follow the content there, and this+# keeps agents following too.+SPLIT_ROUTES = (+ ("## 5.", "references/style-guide.md#node-type--treatment"),+ ("## 5.", "references/style-guide.md#typography"),+ ("## 6.", "references/primitives-core.md"),+ ("## 6.", "references/primitives-core.md#mandatory-connector-rules"),+ ("## 7.", "references/layout-budget.md"),+ ("## 7.", "references/layout-budget.md#complexity-budget-per-diagram"),+ ("## 8.", "references/layout-budget.md#summary-card-pattern"),+ ("## 12.", "references/primitives-core.md#accessible-svg-contract"),+)+LINK_TARGET = re.compile(r"\]\(([^)\s]+)")+++def skill_section(markdown: str, number: str) -> tuple[str, str] | None:+ """The `## N.` heading line and its body up to the next `## ` heading."""+ match = re.search(rf"^{re.escape(number)} .*$", markdown, re.MULTILINE)+ if match is None:+ return None+ rest = markdown[match.end() :]+ end = re.search(r"^## ", rest, re.MULTILINE)+ return match.group(0), rest[: end.start()] if end else rest+++def check_split_routes(errors: list[str], markdown: str) -> None:+ for number, target in SPLIT_ROUTES:+ found = skill_section(markdown, number)+ if found is None:+ errors.append(f"SKILL.md has no '{number}' section; it must route to {target}")+ continue+ heading, body = found+ if target not in LINK_TARGET.findall(body):+ errors.append(+ f"SKILL.md {heading!r} no longer routes to {target}; the ADR 0004 split "+ "moved that content there, so it would ship unreachable"+ )def check_legacy_type_sizes(errors: list[str], spec_markdown: str, root: Path) -> None:@@ -1303,17 +1395,33 @@ def check_manifest_descriptions(errors: list[str], root: Path) -> None:SKILL_PACKAGE = Path("skills/diagram-design")-FONT_LINK = re.compile(r'href="([^"]*fonts\.googleapis\.com[^"]*)"')+# Either quote style: the backreference ends the value at its own quote.+FONT_LINK = re.compile(+ r"""href=(?P<quote>["'])(?P<url>(?:(?!(?P=quote)).)*fonts\.googleapis\.com(?:(?!(?P=quote)).)*)(?P=quote)"""+)# Paths inside the skill package that carry the same css2 link as# assets/template.html. template-terminal.html is absent on purpose: the-# terminal skin loads Geist Mono alone.+# terminal skin loads Geist Mono alone. SKILL.md carried a copy until the+# ADR 0004 split routed its typography to style-guide.md; a copy that comes+# back is still checked, as an optional surface below.FONT_LINK_SURFACES = (Path("assets/template-dark.html"),Path("assets/template-full.html"),Path("assets/template-motion.html"),Path("references/style-guide.md"),- Path("SKILL.md"),)+# A real css2 copy, as opposed to prose such as `<link href="...fonts.googleapis.com...">`.+CSS2_LINK = re.compile(+ r"""href=(?P<quote>["'])(?P<url>(?:(?!(?P=quote)).)*fonts\.googleapis\.com/css2\?(?:(?!(?P=quote)).)*)(?P=quote)"""+)+++def optional_font_link_surfaces(root: Path) -> list[Path]:+ """SKILL.md and every reference not already required to carry the link."""+ package = root / SKILL_PACKAGE+ references = sorted((package / "references").glob("*.md"))+ candidates = [Path("SKILL.md"), *(path.relative_to(package) for path in references)]+ return [path for path in candidates if path not in FONT_LINK_SURFACES]TITLE_STACK_TEMPLATES = (Path("assets/template.html"),Path("assets/template-dark.html"),@@ -1348,10 +1456,10 @@ def family_names(families: set[str]) -> str:def check_export_font_parity(errors: list[str], root: Path) -> None:"""Every copy of the Google Fonts link must request the same faces.- assets/template.html is the source. The other three templates, the style- guide's Font stack block, and SKILL.md carry the same css2 link and must- request exactly its families; the export @import must request at least- them. The strings live in different files and drifted apart once already:+ assets/template.html is the source. The other three templates and the style+ guide's Font stack block carry the same css2 link and must request exactly+ its families, as must any copy in SKILL.md or another reference; the export+ @import must request at least them. The strings live in different files and drifted apart once already:the CJK faces reached assets/template.html but never the @import inexport.md, so a Korean or Chinese diagram exported to .svg silently lost itstype. That failure only shows up on a machine other than the author's,@@ -1374,7 +1482,7 @@ def check_export_font_parity(errors: list[str], root: Path) -> None:)return- families = font_families(link.group(1))+ families = font_families(link.group("url"))missing = families - font_families(imported.group(1))if missing:errors.append(@@ -1383,16 +1491,8 @@ def check_export_font_parity(errors: list[str], root: Path) -> None:f"those scripts through whatever font the viewer happens to have")- for relative in FONT_LINK_SURFACES:- path = root / SKILL_PACKAGE / relative- if not path.is_file():- errors.append(f"font-parity surface is missing: {relative.as_posix()}")- continue- surface_link = FONT_LINK.search(path.read_text(encoding="utf-8"))- if not surface_link:- errors.append(f"could not locate the font link in {relative.as_posix()}")- continue- requested = font_families(surface_link.group(1))+ def report_drift(relative: Path, url: str) -> None:+ requested = font_families(url)drift = [f"{label} {family_names(names)}"for label, names in (@@ -1407,6 +1507,24 @@ def check_export_font_parity(errors: list[str], root: Path) -> None:+ "; ".join(drift))+ for relative in FONT_LINK_SURFACES:+ path = root / SKILL_PACKAGE / relative+ if not path.is_file():+ errors.append(f"font-parity surface is missing: {relative.as_posix()}")+ continue+ surface_link = FONT_LINK.search(path.read_text(encoding="utf-8"))+ if not surface_link:+ errors.append(f"could not locate the font link in {relative.as_posix()}")+ continue+ report_drift(relative, surface_link.group("url"))++ for relative in optional_font_link_surfaces(root):+ path = root / SKILL_PACKAGE / relative+ if not path.is_file():+ continue+ for copy in CSS2_LINK.finditer(path.read_text(encoding="utf-8")):+ report_drift(relative, copy.group("url"))+def title_stack_error(name: str, stack: str) -> str | None:"""Why one --font-serif value fails the Cyrillic order, or None."""@@ -1454,7 +1572,7 @@ def check_title_fallback_order(errors: list[str], root: Path) -> None:if problem:errors.append(problem)link = FONT_LINK.search(source)- if not link or "family=Noto+Serif" not in font_families(link.group(1)):+ if not link or "family=Noto+Serif" not in font_families(link.group("url")):errors.append(f"{name} font link does not request Noto Serif, which its ""--font-serif names for Cyrillic titles; without it they resolve "@@ -1486,11 +1604,8 @@ def main() -> int:errors, ONBOARDING_REFERENCE.read_text(encoding="utf-8"))check_line_dark_skin(errors, LINE_DARK_EXAMPLE.read_text(encoding="utf-8"))- check_type_ramp(- errors,- SKILL.read_text(encoding="utf-8"),- OUTPUT_SPEC_REFERENCE.read_text(encoding="utf-8"),- )+ check_type_ramp_surfaces(errors, ROOT)+ check_split_routes(errors, SKILL.read_text(encoding="utf-8"))check_legacy_type_sizes(errors, OUTPUT_SPEC_REFERENCE.read_text(encoding="utf-8"), ROOT)@@ -1510,7 +1625,7 @@ def main() -> int:"manifest descriptions, Factory install contract, type-count routing, ""High-Level invariants, onboarding trust boundary, Line dark-skin contract, ""font-link parity, title fallback order, type-ramp contract, registered legacy "- "type sizes"+ "type sizes, split routing")return 0diff --git a/scripts/verify-drawio-import.py b/scripts/verify-drawio-import.pyindex 93569d2..8fa45f4 100644--- a/scripts/verify-drawio-import.py+++ b/scripts/verify-drawio-import.py@@ -492,7 +492,8 @@ def check_docs() -> None:if needle not in output_text:fail(f"output-spec.md missing section {needle!r}")- # Every viewBox preset must respect the 4px grid rule (SKILL.md §7).+ # Every viewBox preset must respect the 4px grid rule (SKILL.md §7; the+ # table lives in references/layout-budget.md).for w, h in re.findall(r"`0 0 (\d+) (\d+)`", output_text):if int(w) % 4 or int(h) % 4:fail(f"viewBox preset {w}×{h} is off the 4px grid")diff --git a/scripts/verify-geometry.py b/scripts/verify-geometry.pyindex 34d65b2..129273a 100644--- a/scripts/verify-geometry.py+++ b/scripts/verify-geometry.py@@ -18,9 +18,10 @@ Shape heuristics follow the shipped templates:* A node is a `<rect>` at least 60x40 - large enough for a title and sublabel.* A label mask is a `<rect>` 20-200 wide and 8-14 tall - the masking plate that- SKILL.md prescribes for arrow labels and zone eyebrows. The width cap covers- the long mono plates shipped in example-sequence-oauth.html (128px) and the- wider plates CJK labels need at the same glyph count.+ SKILL.md §6 prescribes (markup in references/primitives-core.md) for arrow+ labels and zone eyebrows. The width cap covers the long mono plates shipped+ in example-sequence-oauth.html (128px) and the wider plates CJK labels need+ at the same glyph count.* A mask fully contained in a node is a badge chip (`EXT`, `EDGE`, `ORIG`) andis legal.diff --git a/skills/diagram-design/SKILL.md b/skills/diagram-design/SKILL.mdindex 4e5adc3..56c3176 100644--- a/skills/diagram-design/SKILL.md+++ b/skills/diagram-design/SKILL.md@@ -157,7 +157,7 @@ These mark "AI slop" schematics of any type:| `rounded-2xl` on boxes | Max radius 6–10px or none || Coral on every "important" node | Coral is 1–2 editorial accents, not a signaling system || Reproducing Mermaid's renderer layout | Imports automatic spacing and routing instead of making an editorial layout |-| Any breach of the six §6 connector rules | Diagonal slants, labels touching their stroke, masks clipped by a later node, overlapping paths, shared attach points, transit behind a non-endpoint box — each is an automatic fail; §6 states them in full |+| Any breach of the six §6 connector rules | Automatic fail: diagonal slants, labels touching their stroke, masks clipped by a later node, overlapping paths, shared attach points, transit behind a non-endpoint box |Type-specific anti-patterns live in each type reference linked in the guide.@@ -165,7 +165,7 @@ Type-specific anti-patterns live in each type reference linked in the guide.## 5. Design System-**The design system is skinnable.** All colors, typography, and tokens live in a single source of truth — [`references/style-guide.md`](references/style-guide.md). This file describes semantic roles (`paper`, `ink`, `muted`, `accent`, `link`, …). The default skin is a cool editorial palette (white-smoke paper, jet-black ink, atomic-tangerine accent, blue-slate muted, silver hairlines); to apply your own brand, either edit `style-guide.md` directly or run the URL-based flow described in [`references/onboarding.md`](references/onboarding.md).+**The design system is skinnable.** [`references/style-guide.md`](references/style-guide.md) is the single source of truth for colors, typography, tokens, and the default palette; this file names semantic roles (`paper`, `ink`, `muted`, `accent`, `link`, …). To apply a brand, edit `style-guide.md` or run the URL-based flow in [`references/onboarding.md`](references/onboarding.md).> When specs below or in type references mention "ink", "accent", "muted", etc., look up the current hex value in `style-guide.md`.@@ -182,35 +182,14 @@ Type-specific anti-patterns live in each type reference linked in the guide.**Focal rule:** `accent` goes on 1–2 elements max. Everything else is `ink` / `muted` / `soft`. If you're tempted to accent 4 things, you haven't decided what's focal yet.-### Node type → treatment+**Node treatments** (focal, backend/API/step, store/state, external/cloud, input/user, optional/async, security/boundary): fill and stroke per [style-guide.md § Node type → treatment](references/style-guide.md#node-type--treatment).-| Type | Fill | Stroke |-|---|---|---|-| **Focal** (1–2 max) | `accent-tint` | `accent` |-| **Backend / API / Step** | white | `ink` |-| **Store / State** | `ink @ 0.05` | `muted` |-| **External / Cloud** | `ink @ 0.03` | `ink @ 0.30` |-| **Input / User** | `muted @ 0.10` | `soft` |-| **Optional / Async** | `ink @ 0.02` | `ink @ 0.20` dashed `4,3` |-| **Security / Boundary** | `accent @ 0.05` | `accent @ 0.50` dashed `4,4` |--### Typography (summary — full spec in style-guide.md)--- **Title** — Instrument Serif, 1.75rem, 400 — H1 only-- **Node name** — Geist (sans), 12px, 600 — human-readable labels-- **Sublabel** — Geist Mono, 9px — ports, URLs, field types-- **Eyebrow / tag** — Geist Mono, 7–8px, uppercase, tracked — type tags, axis labels-- **Arrow label** — Geist Mono, 8px — annotation on arrows-- **Editorial aside** — Instrument Serif *italic*, 14px — callouts only+**Typography:** Instrument Serif for the H1 title and italic callouts, Geist sans 600 for node names, Geist Mono for sublabels, eyebrows, and arrow labels. Sizes, weights, and the font `<link>`: [style-guide.md § Typography](references/style-guide.md#typography); per-preset type ramp: [output-spec.md](references/output-spec.md).**Non-Latin labels** — extend the family: [Korean](references/style-guide.md#korean-labels), [Chinese](references/style-guide.md#traditional-chinese-labels), [Cyrillic](references/style-guide.md#cyrillic-labels).**Mono is for technical content only** — never as a blanket "dev" font, and never JetBrains Mono.-```html-<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&family=Noto+Serif:ital@0;1&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">-```----## 6. Core SVG Primitives@@ -223,142 +202,27 @@ Universal building blocks. Type-specialized primitives (lifeline, activation bar- Terminal / CLI-window variant → [primitive-terminal.md](references/primitive-terminal.md)- Optional explanatory motion → [animation.md](references/animation.md)-### Background--**Default: clean paper, no dot pattern.** Single `<rect>` filled with `paper`. Don't wrap the diagram in a secondary container background — the diagram sits directly on the page.--```svg-<rect width="100%" height="100%" fill="#f5f5f5"/>-```--**Optional: dotted paper variant.** When a long-form editorial diagram benefits from textured ground (essays, hero diagrams on a dedicated page), opt in by adding the `dots` pattern and a second rect:+Exact markup (background, dotted paper, markers, node box, arrow label, legend) and the long form of each connector rule: [`references/primitives-core.md`](references/primitives-core.md). The static templates (`template.html`, `template-dark.html`, `template-full.html`) already define the background and the `arrow`, `arrow-accent`, and `arrow-link` markers; `template-motion.html` defines only its own prefixed marker, so add the others from primitives-core.md when a motion diagram needs them.-```svg-<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.6"/>-```--Don't use the dot pattern when the diagram sits inside a product page, slide, or card — the texture compounds with surrounding chrome and reads as noise.--### Arrow markers (define all three, always)--```svg-<marker id="arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">- <polygon points="0 0, 8 3, 0 6" fill="#4f5d75"/>-</marker>-<marker id="arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">- <polygon points="0 0, 8 3, 0 6" fill="#eb6c36"/>-</marker>-<marker id="arrow-link" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">- <polygon points="0 0, 8 3, 0 6" fill="#2e5aa8"/>-</marker>-```--| Arrow | Stroke | When |-|---|---|---|-| Default | muted `#4f5d75` | Internal, generic |-| Accent | coral `#eb6c36` | Primary / highlighted / headline |-| Link-blue | `#2e5aa8` | HTTP/API calls, external systems |-| Dashed | `stroke-dasharray="5,4"` + any color | Optional, passive, return, async |--**Draw arrows before boxes** so z-order puts lines behind nodes.+- **Arrows:** `muted` by default, `accent` for the headline path, `link` for HTTP/API and external calls, dashed `5,4` for optional, passive, return, or async. Draw arrows before boxes so lines sit behind nodes.+- **Node box:** an opaque paper mask rect, then the styled box at `rx=6`, a rectangular type tag at `rx=2` (not a pill), the name in Geist 600, and a Geist Mono sublabel.### Mandatory connector rules-These six rules are **non-negotiable**. Run the pre-output checklist (§9) to verify before producing any diagram.--1. **Rounded right-angle (orthogonal) connectors are mandatory.** Never use diagonal `<line>` or straight slanted paths between nodes that don't share an x or y axis. Every bend must be a quarter-arc with `r=8` (or `r=6` minimum for tight layouts). See `references/type-architecture.md` for the elbow-path formula. Reserve plain straight `<line>` only for connections whose endpoints share the same x or y coordinate. Diagonal connectors are an automatic fail.--2. **Label-to-connector margin: 6–10px gap, always.** A label must never sit *on* its arrow — the connector must remain visible. Place the label centered above (or beside, for vertical segments) the line with a **minimum 6px gap** between the bottom of the label's mask rect and the connector stroke. The opaque mask rect prevents the arrow from bleeding through, but the *visible* gap between mask edge and line preserves the reader's ability to trace the connection. If the label is large enough that 6px feels cramped, push it to 8–10px. Never let the mask rect touch or overlap the stroke.--3. **No overlapping connectors.** Two connectors must never share the same stroke path, run parallel on top of each other, or be drawn on top of each other for any segment. When two orthogonal arrows must cross at a single point, apply the **bridge / hop** primitive (see `references/type-architecture.md` § Crossing arrows). When two arrows naturally want to overlap, offset their routing by ≥12px so each line is independently traceable. If you find yourself stacking connectors, redesign the layout — it means two nodes are too close, or the diagram is over budget (split into overview + detail).--4. **Shared edge → fan the attach points.** When two or more connectors enter or exit the *same edge* of a box, each must have its own distinct attach point along that edge — **no two connectors may share a single point on a box**. Spread the attach points evenly along the edge with **≥12px** between adjacent points (8px minimum for very small boxes). Routing rules:- - For N connectors on an edge of length L, attach point `k` (1..N) sits at offset `L * k / (N + 1)` from the edge's leading corner.- - When the connectors fan out to destinations on different sides, route each one orthogonally from its own attach point — no merging strokes near the box.- - When two parallel connectors run in the same direction, keep them ≥12px apart along their entire length, not just at the attach point. Each arrow must remain independently traceable end-to-end.-- 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. 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.-- When in doubt, reroute. The exception exists for the narrow case where rerouting is geometrically impossible, not as a shortcut to avoid layout work.--6. **A label mask must not overlap a node drawn after it.** Rule 2 keeps the label off its own connector; this one keeps it off the boxes. Because nodes are painted after labels, a mask that lands partly inside a node is covered by the node fill and the text renders as a fragment sitting on the node border. Place the label on a segment of the connector that runs through open canvas — for a connector leaving a node's right edge, that means clearing the node's `x + width` before the mask starts. A mask fully *inside* a node is a badge chip and is fine; a mask overlapping a zone container is fine too, since zones are painted first. From a repository checkout, verify with `python3 <repo-root>/scripts/verify-geometry.py <file>`.+Non-negotiable, and §9 checks each one. Full text and edge cases: [primitives-core.md § Mandatory connector rules](references/primitives-core.md#mandatory-connector-rules).-### Node box — full pattern--```svg-<!-- 1. Opaque paper mask — prevents arrows bleeding through transparent fills -->-<rect x="X" y="Y" width="W" height="H" rx="6" fill="#f5f5f5"/>-<!-- 2. Styled box -->-<rect x="X" y="Y" width="W" height="H" rx="6" fill="FILL" stroke="STROKE" stroke-width="1"/>-<!-- 3. Rectangular type tag (rx=2, NOT a pill) -->-<rect x="X+8" y="Y+6" width="28" height="12" rx="2" fill="transparent" stroke="[email protected]" stroke-width="0.8"/>-<text x="X+22" y="Y+15" fill="[email protected]" font-size="7" font-family="'Geist Mono', monospace"- text-anchor="middle" letter-spacing="0.08em">API</text>-<!-- 4. Node name (Geist sans — human-readable) -->-<text x="CX" y="CY+2" fill="#2d3142" font-size="12" font-weight="600"- font-family="'Geist', sans-serif" text-anchor="middle">Node Name</text>-<!-- 5. Technical sublabel (Geist Mono) -->-<text x="CX" y="CY+18" fill="#4f5d75" font-size="9"- font-family="'Geist Mono', monospace" text-anchor="middle">tech:port</text>-```--### Arrow labels — always mask, always with margin--Every arrow label needs an opaque rect behind it. Without one it bleeds through the line. **And the label must sit with a visible gap above the connector — never on top of it.**--```svg-<!-- Mask sits 14px above the arrow (8px text height + 6px gap). Stroke is at ARROW_Y. -->-<rect x="MID_X-18" y="ARROW_Y-20" width="36" height="12" rx="2" fill="#f5f5f5"/>-<text x="MID_X" y="ARROW_Y-11" fill="#7a8399" font-size="8"- font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">WRITE</text>-```--Rules:--- ≤14 characters, all-caps, centered on segment midpoint.-- **Mandatory 6–10px gap** between the bottom of the mask rect and the arrow stroke. The connector must remain visible — a label that hides its own arrow is a hard fail.-- Never `writing-mode` vertical.-- For vertical segments, place the label to the side (not on the line) with the same 6–10px horizontal gap.--### Legend — horizontal strip at the bottom--**Never put the legend inside the diagram area.** Place as a horizontal strip after all nodes, with a hairline separator:--```svg-<line x1="30" y1="LEGEND_Y-8" x2="VIEWBOX_W-30" y2="LEGEND_Y-8"- stroke="rgba(45,49,66,0.10)" stroke-width="0.8"/>-<text x="30" y="LEGEND_Y+8" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace"- letter-spacing="0.14em">LEGEND</text>-<!-- Items — horizontal row, ~160px apart -->-```--Expand SVG `viewBox` height by ~60px.+1. **Orthogonal only.** Connectors between off-axis nodes are rounded right-angle elbows at `r=8` (`r=6` minimum in tight layouts); a straight `<line>` only when both ends share x or y. Diagonals fail.+2. **Label gap.** Every arrow label (14 characters max, all caps, centered on its segment) sits on an opaque mask with a visible 6 to 10px gap from its stroke, beside vertical segments, never on the line.+3. **No overlaps.** No shared or stacked strokes: offset parallel routes by 12px or more, and use the bridge/hop at a single crossing.+4. **Fan attach points.** Connectors on one box edge each get their own point at `L * k / (N + 1)`, 12px or more apart (8px on very small boxes).+5. **No transit behind a non-endpoint box.** Reroute. Only when the box is geometrically unavoidable: dashed stroke (`4,3`), label at the visible end, no marker on the intervening box.+6. **Mask before node.** A label mask must not overlap a node drawn after it; badge masks fully inside a node and masks over earlier zones are fine. From a repository checkout, verify with `python3 <repo-root>/scripts/verify-geometry.py <file>`.---## 7. Layout & Spacing-### 4px grid--**Structural geometry, divisible by 4:** node origins, widths, heights, gaps, padding. Off-grid by design: type sizes (role ramp in `references/output-spec.md`), radii, data-derived positions, text baselines, arrow markers, `.5` offsets that keep 1px strokes crisp, stroke widths, opacity, and the 22×22 dot-pattern.--| Category | Allowed values |-|---|---|-| Node width / height | 80, 96, 112, 120, 128, 140, 144, 160, 180, 200, 240, 320 |-| Gap between nodes | 20, 24, 32, 40, 48 |-| Padding inside boxes | 8, 12, 16 |-| Border radius | 4, 6, 8 |+Structural geometry sits on a 4px grid: node origins, widths, heights, gaps, and padding divide by 4. Type sizes follow the role ramp in [output-spec.md](references/output-spec.md), not the grid. Allowed values, the off-grid exceptions, and page layout: [`references/layout-budget.md`](references/layout-budget.md).### Complexity budget (per diagram)@@ -367,78 +231,18 @@ Expand SVG `viewBox` height by ~60px.| Max nodes | 9 || Max arrows / transitions | 12 || Max coral elements | 2 |-| Max lifelines (sequence) | 5 |-| Max combined fragments (sequence) | 1 (default); 2 only if each is single-region `opt`/`loop` |-| Max `alt` regions (sequence) | 2 |-| Max fragment nesting (sequence) | 1 |-| Max lanes (swimlane) | 5 |-| Max items (quadrant) | 12 |-| Max entities (ER) | 8 |-| Max nesting levels (nested) | 6 |-| Max tree depth | 4 |-| Max org chart depth | 4 |-| Max org chart nodes | 12 |-| Max layers (layer stack) | 6 |-| Max circles (venn) | 3 |-| Max layers (pyramid) | 6 |-| Max radar axes | 5 |-| Max radar series | 5 |-| Max focal radar series | 1 |-| Max polar categories | 8 |-| 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 |-| Max points (scatter plot) | 30 |-| Max stages / nodes / flows (sankey) | 3 / 8 / 12 |-| Max categories (fishbone) | 6 bones, 3 sub-causes each |-| Max components / links (wardley) | 9 / 12, 2 movement arrows |-| Max columns / cards (kanban) | 5 / 12 total, 4 per column |-| Max stages / rows (user journey) | 6 / 3, 2 pain markers |-| Max zones / nodes / paths (deployment) | 3 / 6 / 8, 9 artifacts |-| Max nodes / edges (dependency) | 9 / 14, 4 ranks, 1 cycle |-| Max classes / relationships (UML class) | 7 / 8, 5 members per compartment |-| Max activities / slices / cards (story map) | 5 / 3 / 12 |-| Max tables / columns / FKs (db schema) | 5 / 8 shown / 6 || Max annotation callouts | 2 || Max motion (optional) | 8 steps, 12 marked items, 2 simultaneous items — see [animation.md](references/animation.md) |-If you exceed, split into two diagrams (overview + detail).--### Page layout+Per-type limits (lifelines, lanes, series, bars, stages, and the rest): [layout-budget.md § Complexity budget](references/layout-budget.md#complexity-budget-per-diagram). Check your type's row before drawing.-1. **Header** — eyebrow (Geist Mono), title (Instrument Serif), optional subtitle (Geist muted).-2. **Diagram container** — default: **clean, borderless**, no background — the SVG sits directly on the page paper. Optional *framed* variant (for card-heavy layouts or hero placements): `paper-2` bg + 1px `rule` border + 8px radius + `1.5rem` padding + `overflow-x: auto`.-3. **Summary cards** — 2–3 col grid with *varied* widths (e.g., `1.1fr 1fr 0.9fr`).-4. **Footer** — colophon in Geist Mono, muted, hairline top border.+If you exceed, split into two diagrams (overview + detail).---## 8. Summary Card Pattern-Don't use 3 identical generic cards. Vary the treatment:--```html-<div class="card">- <p class="eyebrow">SECTION LABEL</p>- <div class="card-header">- <span class="card-dot coral"></span>- <h3>Card Title</h3>- </div>- <ul><li>Item</li></ul>-</div>-```--Rules:--- `background: #ffffff` (not paper — slight lift without shadow)-- `border: 1px solid rgba(45,49,66,0.12)`-- `border-radius: 6px`, `padding: 1.25rem`-- **No `box-shadow`**-- Card dots: 7px, `border-radius: 50%` — ink / muted / coral / link / soft variants+Don't use 3 identical generic cards. Vary the treatment: column widths such as `1.1fr 1fr 0.9fr`, a white background with a 1px hairline border and 6px radius, no `box-shadow`. Markup and the card-dot variants: [layout-budget.md § Summary Card Pattern](references/layout-budget.md#summary-card-pattern).---@@ -475,12 +279,12 @@ Run before producing any diagram.- [ ] `<title>` is the first child of `<svg>` (before `<defs>`) and both `<title>` and `<desc>` are filled in?- [ ] `<title>` / `<desc>` IDs are prefixed for this diagram and variant — never bare `title` / `desc`?- [ ] Arrows drawn before boxes?-- [ ] **Every connector between off-axis nodes uses a rounded right-angle elbow (`r=8`)? No diagonal `<line>` slants?**-- [ ] **Every arrow label has a visible 6–10px gap above its connector? (Mask rect not touching the stroke.)**-- [ ] **No two connectors overlap, share a stroke path, or run on top of each other? Crossings use the bridge/hop primitive?**-- [ ] **When several connectors enter or exit the same edge of a box, each has its own attach point (≥12px apart)? No connector hides another?**-- [ ] **No connector passes behind a non-endpoint box, except the unavoidable-intervening-box case (§6 rule 5) — and in that case, the stroke is dashed and the label sits at the visible end?**-- [ ] **No label mask overlaps a node drawn after it? (Node fill would clip the text — §6 rule 6. From a repository checkout, run `python3 <repo-root>/scripts/verify-geometry.py <file>`.)**+- [ ] **§6 rule 1:** off-axis connectors are `r=8` elbows, no diagonal slants?+- [ ] **§6 rule 2:** a visible 6 to 10px gap between every label mask and its connector?+- [ ] **§6 rule 3:** no overlapping or stacked connectors; bridge/hop at crossings?+- [ ] **§6 rule 4:** a distinct attach point per connector on a shared edge, 12px or more apart, none hiding another?+- [ ] **§6 rule 5:** no transit behind a non-endpoint box, except the unavoidable case (dashed, label at the visible end)?+- [ ] **§6 rule 6:** no label mask overlapping a node drawn after it? (From a repository checkout, run `python3 <repo-root>/scripts/verify-geometry.py <file>`.)- [ ] Every arrow label has an opaque `fill="#f5f5f5"` rect behind it?- [ ] Legend is a horizontal bottom strip, not floating?- [ ] No vertical `writing-mode` text?@@ -511,9 +315,9 @@ Every diagram ships in three variants (see `assets/`):| **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. 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.+**Sketchy variant** (optional, applied to any of the above): a hand-drawn stroke filter for essays, not technical docs. See [primitive-sketchy.md](references/primitive-sketchy.md).-**Terminal variant** (optional, replaces any of the above) — see [primitive-terminal.md](references/primitive-terminal.md). Start from `assets/template-terminal.html`; terminal examples use the `example-<type>-terminal.html` naming pattern. Charcoal CLI-window chrome, monospace, one red-orange accent. Good for dev-tool posts; not brand-tokenized, so skip it for onboarded output.+**Terminal variant** (optional, replaces any of the above): CLI-window chrome for dev-tool posts. Start from `assets/template-terminal.html` and follow [primitive-terminal.md](references/primitive-terminal.md); examples are named `example-<type>-terminal.html`. Not brand-tokenized, so skip it for onboarded output.**Animation** (optional presentation layer) — see [animation.md](references/animation.md). Modes are `none` (default), `reveal`, `step`, and `loop`; motion never changes the static meaning or raises the complexity budget.@@ -567,14 +371,14 @@ Renders correctly in any modern browser. Motion-enabled output must render its c### Accessible SVG contract-Every diagram is an accessible figure by default:+Every diagram is an accessible figure by default (long form: [primitives-core.md § Accessible SVG contract](references/primitives-core.md#accessible-svg-contract)):-1. Its `<svg>` carries `role="img"` and `aria-labelledby` naming the diagram's `<title>` and `<desc>`.-2. `<title>` is the first child of `<svg>`, before `<defs>`. Assistive technology may ignore a title placed later.-3. The IDs are prefixed per diagram and variant: `<slug>-title` / `<slug>-desc`, where the slug matches the file (`loop`, `loop-dark`, `loop-full`). Bare `title` / `desc` IDs are banned — two inline diagrams would otherwise share one ID, and the second could be announced with the first's name.-4. `<title>` is the short name of the subject — roughly the page `<h1>`, and about 60 characters or fewer.-5. `<desc>` is one sentence stating what the diagram shows in terms a reader needs without the image. Describe the content, not the geometry: “Org chart showing a command center routing work to specialist agents and escalation owners,” not “A box at the top with five boxes below it.” A shape-by-shape narration is worse than no useful description.-6. Decorative-only SVG, such as the specimen glyphs in `assets/icons.html`, carries `aria-hidden="true"` instead.+1. `<svg>` carries `role="img"` and `aria-labelledby` naming its `<title>` and `<desc>`.+2. `<title>` is the first child of `<svg>`, before `<defs>`.+3. IDs are `<slug>-title` / `<slug>-desc`, the slug matching the file (`loop`, `loop-dark`, `loop-full`); never bare `title` / `desc`.+4. `<title>` is the subject's short name, roughly the page `<h1>`, 60 characters or fewer.+5. `<desc>` is one sentence about the content, not the geometry.+6. Decorative-only SVG, such as the glyphs in `assets/icons.html`, carries `aria-hidden="true"` instead.### Exporting to PNG / SVGdiff --git a/skills/diagram-design/references/layout-budget.md b/skills/diagram-design/references/layout-budget.mdnew file mode 100644index 0000000..e794a92--- /dev/null+++ b/skills/diagram-design/references/layout-budget.md@@ -0,0 +1,91 @@+# Layout grid, per-type budgets, page layout, and summary cards++Routed from SKILL.md §7 and §8. SKILL.md keeps the grid rule in one line, the universal complexity limits, and the split rule. This file holds the full grid table, every per-type budget row, the page layout, and the summary card pattern.++## Layout & Spacing++### 4px grid++**Structural geometry, divisible by 4:** node origins, widths, heights, gaps, padding. Off-grid by design: type sizes (role ramp in `references/output-spec.md`), radii, data-derived positions, text baselines, arrow markers, `.5` offsets that keep 1px strokes crisp, stroke widths, opacity, and the 22×22 dot-pattern.++| Category | Allowed values |+|---|---|+| Node width / height | 80, 96, 112, 120, 128, 140, 144, 160, 180, 200, 240, 320 |+| Gap between nodes | 20, 24, 32, 40, 48 |+| Padding inside boxes | 8, 12, 16 |+| Border radius | 4, 6, 8 |++### Complexity budget (per diagram)++These are the per-type limits. The universal rows in SKILL.md §7 (9 nodes, 12 arrows or transitions, 2 coral elements, 2 annotation callouts, and the motion limits) apply to every type on top of these, and a semantic pattern's own budget in [semantic-patterns.md](semantic-patterns.md) can only tighten them.++| Limit | Rule |+|---|---|+| Max lifelines (sequence) | 5 |+| Max combined fragments (sequence) | 1 (default); 2 only if each is single-region `opt`/`loop` |+| Max `alt` regions (sequence) | 2 |+| Max fragment nesting (sequence) | 1 |+| Max lanes (swimlane) | 5 |+| Max items (quadrant) | 12 |+| Max entities (ER) | 8 |+| Max nesting levels (nested) | 6 |+| Max tree depth | 4 |+| Max org chart depth | 4 |+| Max org chart nodes | 12 |+| Max layers (layer stack) | 6 |+| Max circles (venn) | 3 |+| Max layers (pyramid) | 6 |+| Max radar axes | 5 |+| Max radar series | 5 |+| Max focal radar series | 1 |+| Max polar categories | 8 |+| 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 |+| Max points (scatter plot) | 30 |+| Max stages / nodes / flows (sankey) | 3 / 8 / 12 |+| Max categories (fishbone) | 6 bones, 3 sub-causes each |+| Max components / links (wardley) | 9 / 12, 2 movement arrows |+| Max columns / cards (kanban) | 5 / 12 total, 4 per column |+| Max stages / rows (user journey) | 6 / 3, 2 pain markers |+| Max zones / nodes / paths (deployment) | 3 / 6 / 8, 9 artifacts |+| Max nodes / edges (dependency) | 9 / 14, 4 ranks, 1 cycle |+| Max classes / relationships (UML class) | 7 / 8, 5 members per compartment |+| Max activities / slices / cards (story map) | 5 / 3 / 12 |+| Max tables / columns / FKs (db schema) | 5 / 8 shown / 6 |++If you exceed, split into two diagrams (overview + detail).++### Page layout++1. **Header** — eyebrow (Geist Mono), title (Instrument Serif), optional subtitle (Geist muted).+2. **Diagram container** — default: **clean, borderless**, no background — the SVG sits directly on the page paper. Optional *framed* variant (for card-heavy layouts or hero placements): `paper-2` bg + 1px `rule` border + 8px radius + `1.5rem` padding + `overflow-x: auto`.+3. **Summary cards** — 2–3 col grid with *varied* widths (e.g., `1.1fr 1fr 0.9fr`).+4. **Footer** — colophon in Geist Mono, muted, hairline top border.++## Summary Card Pattern++Don't use 3 identical generic cards. Vary the treatment:++```html+<div class="card">+ <p class="eyebrow">SECTION LABEL</p>+ <div class="card-header">+ <span class="card-dot coral"></span>+ <h3>Card Title</h3>+ </div>+ <ul><li>Item</li></ul>+</div>+```++Rules:++- `background: #ffffff` (not paper — slight lift without shadow)+- `border: 1px solid rgba(45,49,66,0.12)`+- `border-radius: 6px`, `padding: 1.25rem`+- **No `box-shadow`**+- Card dots: 7px, `border-radius: 50%` — ink / muted / coral / link / soft variantsdiff --git a/skills/diagram-design/references/primitives-core.md b/skills/diagram-design/references/primitives-core.mdnew file mode 100644index 0000000..657519b--- /dev/null+++ b/skills/diagram-design/references/primitives-core.md@@ -0,0 +1,140 @@+# Core SVG primitives++Routed from SKILL.md §6. SKILL.md keeps the six connector rules as one line each, the arrow roles, and a one-line node box summary. This file holds the markup and the long form of every rule. The copied template already carries the background rect, the commented dotted-paper pattern, and all three arrow markers, so load this file when you need exact markup or a rule's edge cases.++Type-specialized primitives (lifeline, activation bar, region) live in the relevant type reference linked in SKILL.md §3.++## Background++**Default: clean paper, no dot pattern.** Single `<rect>` filled with `paper`. Don't wrap the diagram in a secondary container background — the diagram sits directly on the page.++```svg+<rect width="100%" height="100%" fill="#f5f5f5"/>+```++**Optional: dotted paper variant.** When a long-form editorial diagram benefits from textured ground (essays, hero diagrams on a dedicated page), opt in by adding the `dots` pattern and a second rect:++```svg+<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.6"/>+```++Don't use the dot pattern when the diagram sits inside a product page, slide, or card — the texture compounds with surrounding chrome and reads as noise.++## Arrow markers (define all three, always)++```svg+<marker id="arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">+ <polygon points="0 0, 8 3, 0 6" fill="#4f5d75"/>+</marker>+<marker id="arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">+ <polygon points="0 0, 8 3, 0 6" fill="#eb6c36"/>+</marker>+<marker id="arrow-link" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">+ <polygon points="0 0, 8 3, 0 6" fill="#2e5aa8"/>+</marker>+```++| Arrow | Stroke | When |+|---|---|---|+| Default | muted `#4f5d75` | Internal, generic |+| Accent | coral `#eb6c36` | Primary / highlighted / headline |+| Link-blue | `#2e5aa8` | HTTP/API calls, external systems |+| Dashed | `stroke-dasharray="5,4"` + any color | Optional, passive, return, async |++**Draw arrows before boxes** so z-order puts lines behind nodes.++## Mandatory connector rules++These six rules are **non-negotiable**. Run the pre-output checklist (SKILL.md §9) to verify before producing any diagram.++1. **Rounded right-angle (orthogonal) connectors are mandatory.** Never use diagonal `<line>` or straight slanted paths between nodes that don't share an x or y axis. Every bend must be a quarter-arc with `r=8` (or `r=6` minimum for tight layouts). See `references/type-architecture.md` for the elbow-path formula. Reserve plain straight `<line>` only for connections whose endpoints share the same x or y coordinate. Diagonal connectors are an automatic fail.++2. **Label-to-connector margin: 6–10px gap, always.** A label must never sit *on* its arrow — the connector must remain visible. Place the label centered above (or beside, for vertical segments) the line with a **minimum 6px gap** between the bottom of the label's mask rect and the connector stroke. The opaque mask rect prevents the arrow from bleeding through, but the *visible* gap between mask edge and line preserves the reader's ability to trace the connection. If the label is large enough that 6px feels cramped, push it to 8–10px. Never let the mask rect touch or overlap the stroke.++3. **No overlapping connectors.** Two connectors must never share the same stroke path, run parallel on top of each other, or be drawn on top of each other for any segment. When two orthogonal arrows must cross at a single point, apply the **bridge / hop** primitive (see `references/type-architecture.md` § Crossing arrows). When two arrows naturally want to overlap, offset their routing by ≥12px so each line is independently traceable. If you find yourself stacking connectors, redesign the layout — it means two nodes are too close, or the diagram is over budget (split into overview + detail).++4. **Shared edge → fan the attach points.** When two or more connectors enter or exit the *same edge* of a box, each must have its own distinct attach point along that edge — **no two connectors may share a single point on a box**. Spread the attach points evenly along the edge with **≥12px** between adjacent points (8px minimum for very small boxes). Routing rules:+ - For N connectors on an edge of length L, attach point `k` (1..N) sits at offset `L * k / (N + 1)` from the edge's leading corner.+ - When the connectors fan out to destinations on different sides, route each one orthogonally from its own attach point — no merging strokes near the box.+ - When two parallel connectors run in the same direction, keep them ≥12px apart along their entire length, not just at the attach point. Each arrow must remain independently traceable end-to-end.++ 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. 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.++ When in doubt, reroute. The exception exists for the narrow case where rerouting is geometrically impossible, not as a shortcut to avoid layout work.++6. **A label mask must not overlap a node drawn after it.** Rule 2 keeps the label off its own connector; this one keeps it off the boxes. Because nodes are painted after labels, a mask that lands partly inside a node is covered by the node fill and the text renders as a fragment sitting on the node border. Place the label on a segment of the connector that runs through open canvas — for a connector leaving a node's right edge, that means clearing the node's `x + width` before the mask starts. A mask fully *inside* a node is a badge chip and is fine; a mask overlapping a zone container is fine too, since zones are painted first. From a repository checkout, verify with `python3 <repo-root>/scripts/verify-geometry.py <file>`.++## Node box — full pattern++```svg+<!-- 1. Opaque paper mask — prevents arrows bleeding through transparent fills -->+<rect x="X" y="Y" width="W" height="H" rx="6" fill="#f5f5f5"/>+<!-- 2. Styled box -->+<rect x="X" y="Y" width="W" height="H" rx="6" fill="FILL" stroke="STROKE" stroke-width="1"/>+<!-- 3. Rectangular type tag (rx=2, NOT a pill) -->+<rect x="X+8" y="Y+6" width="28" height="12" rx="2" fill="transparent" stroke="[email protected]" stroke-width="0.8"/>+<text x="X+22" y="Y+15" fill="[email protected]" font-size="7" font-family="'Geist Mono', monospace"+ text-anchor="middle" letter-spacing="0.08em">API</text>+<!-- 4. Node name (Geist sans — human-readable) -->+<text x="CX" y="CY+2" fill="#2d3142" font-size="12" font-weight="600"+ font-family="'Geist', sans-serif" text-anchor="middle">Node Name</text>+<!-- 5. Technical sublabel (Geist Mono) -->+<text x="CX" y="CY+18" fill="#4f5d75" font-size="9"+ font-family="'Geist Mono', monospace" text-anchor="middle">tech:port</text>+```++## Arrow labels — always mask, always with margin++Every arrow label needs an opaque rect behind it. Without one it bleeds through the line. **And the label must sit with a visible gap above the connector — never on top of it.**++```svg+<!-- Mask sits 14px above the arrow (8px text height + 6px gap). Stroke is at ARROW_Y. -->+<rect x="MID_X-18" y="ARROW_Y-20" width="36" height="12" rx="2" fill="#f5f5f5"/>+<text x="MID_X" y="ARROW_Y-11" fill="#7a8399" font-size="8"+ font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">WRITE</text>+```++Rules:++- ≤14 characters, all-caps, centered on segment midpoint.+- **Mandatory 6–10px gap** between the bottom of the mask rect and the arrow stroke. The connector must remain visible — a label that hides its own arrow is a hard fail.+- Never `writing-mode` vertical.+- For vertical segments, place the label to the side (not on the line) with the same 6–10px horizontal gap.++## Legend — horizontal strip at the bottom++**Never put the legend inside the diagram area.** Place as a horizontal strip after all nodes, with a hairline separator:++```svg+<line x1="30" y1="LEGEND_Y-8" x2="VIEWBOX_W-30" y2="LEGEND_Y-8"+ stroke="rgba(45,49,66,0.10)" stroke-width="0.8"/>+<text x="30" y="LEGEND_Y+8" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace"+ letter-spacing="0.14em">LEGEND</text>+<!-- Items — horizontal row, ~160px apart -->+```++Expand SVG `viewBox` height by ~60px.++## Accessible SVG contract++SKILL.md §12 lists these six points one line each; this is the long form.++Every diagram is an accessible figure by default:++1. Its `<svg>` carries `role="img"` and `aria-labelledby` naming the diagram's `<title>` and `<desc>`.+2. `<title>` is the first child of `<svg>`, before `<defs>`. Assistive technology may ignore a title placed later.+3. The IDs are prefixed per diagram and variant: `<slug>-title` / `<slug>-desc`, where the slug matches the file (`loop`, `loop-dark`, `loop-full`). Bare `title` / `desc` IDs are banned — two inline diagrams would otherwise share one ID, and the second could be announced with the first's name.+4. `<title>` is the short name of the subject — roughly the page `<h1>`, and about 60 characters or fewer.+5. `<desc>` is one sentence stating what the diagram shows in terms a reader needs without the image. Describe the content, not the geometry: “Org chart showing a command center routing work to specialist agents and escalation owners,” not “A box at the top with five boxes below it.” A shape-by-shape narration is worse than no useful description.+6. Decorative-only SVG, such as the specimen glyphs in `assets/icons.html`, carries `aria-hidden="true"` instead.diff --git a/skills/diagram-design/references/semantic-patterns.md b/skills/diagram-design/references/semantic-patterns.mdindex 159ed51..54d1113 100644--- a/skills/diagram-design/references/semantic-patterns.md+++ b/skills/diagram-design/references/semantic-patterns.md@@ -120,7 +120,7 @@ Use one primary pattern per figure. A second pattern may supply at most one supp**Selection triggers:** A system or product must decompose into addressable, individually citable sub-elements — each with a stable identifier a reader (or a compliance, audit, or IP record) can point at directly, not a name alone. The reader needs to trace a specific block to its parent, to what it consumes and produces, and to the code that implements it. This describes *structure* (what the system is made of), not a process — for a sequence of actions, choose a pattern that routes to Flowchart or Swimlane instead.-**Required primitives:** A stable dotted ID per block (e.g. `PAY-001-02`), shown as a compact badge using the existing node-box type-tag chip (SKILL.md §6 "Node box — full pattern") — never as a separate connector-adjacent label. A noun-phrase block name — the structural element itself ("Fraud Screening"), not an action performed on it — in the node's existing name slot. Parent-child structure is Tree's own elbow connector; this pattern adds no new connector semantics or connector labels. At most one short inbound and one short outbound flow-port label per block, in the existing Geist Mono sublabel slot, shown only when both fit without crowding the name — omit by default. Every block's full record — inputs, outputs, constraints, assumptions, and an implementation path — lives in `data-block-*` attributes on the node (`data-block-id`, `data-block-parent`, `data-block-name`, and terse `data-block-input` / `-output` / `-constraint` / `-assumption` / `-impl` values) and, for anything longer than a short phrase, in the sidecar registry (see `export-registry.md`) — never as additional visible diagram text.+**Required primitives:** A stable dotted ID per block (e.g. `PAY-001-02`), shown as a compact badge using the existing node-box type-tag chip (SKILL.md §6; markup in [primitives-core.md](primitives-core.md#node-box--full-pattern)) — never as a separate connector-adjacent label. A noun-phrase block name — the structural element itself ("Fraud Screening"), not an action performed on it — in the node's existing name slot. Parent-child structure is Tree's own elbow connector; this pattern adds no new connector semantics or connector labels. At most one short inbound and one short outbound flow-port label per block, in the existing Geist Mono sublabel slot, shown only when both fit without crowding the name — omit by default. Every block's full record — inputs, outputs, constraints, assumptions, and an implementation path — lives in `data-block-*` attributes on the node (`data-block-id`, `data-block-parent`, `data-block-name`, and terse `data-block-input` / `-output` / `-constraint` / `-assumption` / `-impl` values) and, for anything longer than a short phrase, in the sidecar registry (see `export-registry.md`) — never as additional visible diagram text.**Complexity budget:** Tree's own root+3-tier / 5-per-level caps and the global 9-node ceiling apply as-is — this pattern does not raise them. A hierarchy that needs more splits into a linked set of diagrams, one per subsystem, each independently traceable; the sidecar registry is the layer that reassembles the full graph across files. At most one in/out port-label pair per block when shown at all; constraints and assumptions are never rendered as visible text, only carried in metadata.diff --git a/skills/diagram-design/references/type-dependency.md b/skills/diagram-design/references/type-dependency.mdindex 249ec8f..cf66d26 100644--- a/skills/diagram-design/references/type-dependency.md+++ b/skills/diagram-design/references/type-dependency.md@@ -5,9 +5,9 @@## Layout conventions- **Ranked layers.** Nodes sit in horizontal rank rows by dependency depth: rank 0 (entry points nothing depends on) at the top, deeper ranks below. Forward edges point downward across ranks, or run horizontal within a single rank row when a dependency compresses to the same depth as its dependent (e.g. a shallow sibling dependency) — never upward outside the one marked cycle. Rank rows are 120px apart.-- Nodes are the standard node-box pattern (§6): `rx=6`, 160px wide, 56px tall.+- Nodes are the standard node-box pattern (§6, [primitives-core.md](primitives-core.md#node-box--full-pattern)): `rx=6`, 160px wide, 56px tall.- **Fan-in badge.** Every node carries a Geist Mono 8px badge in its top-right corner, inside a small `rx=2` box, showing how many nodes depend on it (`4 in`). A mask fully inside a node is a badge chip, not a label — legitimate under §6 rule 6. The node with the highest fan-in is the diagram's structural story; size nothing else to compete with it.-- **Node treatments** (§5 Node type → treatment):+- **Node treatments** ([style-guide.md § Node type → treatment](style-guide.md#node-type--treatment)):- Internal package/service → white fill + `ink` stroke.- External / third-party → `ink @ 0.03` fill + `ink @ 0.30` stroke (the External/Cloud treatment).- Leaf with no outgoing edges → `ink @ 0.05` fill + `muted` stroke.diff --git a/skills/diagram-design/references/type-deployment.md b/skills/diagram-design/references/type-deployment.mdindex 8907ccb..0ab33a1 100644--- a/skills/diagram-design/references/type-deployment.md+++ b/skills/diagram-design/references/type-deployment.md@@ -7,7 +7,7 @@Three nesting levels, outermost to innermost — reuses the containment grammar from `type-nested.md`, specialized for infrastructure:1. **Zone** — an environment or network boundary (`edge`, `prod / eu-west-1`, `data`). A large rect, `rx=8`, fill `ink @ 0.02`, stroke `ink @ 0.20` dashed `4,4`. A Geist Mono 8px (or 7px for tight layouts) uppercase tracked eyebrow label sits inside the top-left corner, on a paper-colored mask over the border. Zones are drawn **first** — before arrows and nodes — so labels and boxes paint over them (z-order: bg → zones → arrows → labels → nodes).-2. **Infrastructure node** — a host, VM, pod, or managed service inside a zone. The §6 node-box pattern (SKILL.md) at `rx=6`, with a rectangular type tag (`rx=2`, **not** a pill) carrying `POD` / `VM` / `MANAGED` / `CDN` in the top-left corner.+2. **Infrastructure node** — a host, VM, pod, or managed service inside a zone. The §6 node-box pattern (SKILL.md; markup in [primitives-core.md](primitives-core.md#node-box--full-pattern)) at `rx=6`, with a rectangular type tag (`rx=2`, **not** a pill) carrying `POD` / `VM` / `MANAGED` / `CDN` in the top-left corner.3. **Artifact chip** — what is deployed onto that node. A small 24px-tall rect `rx=4`, fill `ink @ 0.05`, stroke `muted`, holding the image or service name in Geist sans 12px (left-aligned) plus a Geist Mono 9px version tag (right-aligned, e.g. `v2.4.1`). A node can carry more than one chip (stacked with an 8px gap) when more than one artifact is co-located (a sidecar, for example).**Replica badge.** A node running N copies carries a right-aligned Geist Mono 8px badge (`x3`) inside its own small `rx=2` box in the node's top-right corner. A mask fully inside a node is a badge chip and is a legitimate exception to the "mask must not overlap a later node" rule (SKILL.md §6 rule 6) — it's part of that same node.diff --git a/skills/diagram-design/references/type-fishbone.md b/skills/diagram-design/references/type-fishbone.mdindex f4a0a4c..2e7f1ef 100644--- a/skills/diagram-design/references/type-fishbone.md+++ b/skills/diagram-design/references/type-fishbone.md@@ -4,7 +4,7 @@## Layout conventions-- **Spine.** A horizontal line (`ink`, 1.2px) runs left→right at the vertical centre `CY`, terminating with an arrowhead into an **effect box** at the right head — the node-box pattern from SKILL.md §6, the observed-effect statement inside.+- **Spine.** A horizontal line (`ink`, 1.2px) runs left→right at the vertical centre `CY`, terminating with an arrowhead into an **effect box** at the right head — the node-box pattern from SKILL.md §6 ([primitives-core.md](primitives-core.md#node-box--full-pattern)), the observed-effect statement inside.- **Bones.** Category lines are straight diagonals at a fixed **60°** to the spine, alternating above and below, evenly spaced along it. Each bone carries its category name at the outer end in a small tag-style box (`rx=4`, not a pill) — Geist sans 12px weight 600.- **Sub-causes.** Short horizontal ticks (32px, `soft`) branch off each bone at fixed points along its length, each with a sub-cause label in Geist Mono 9px sitting past the open end of the tick.- **Diagonal exemption.** SKILL.md §6 rule 1 (mandatory rounded right-angle elbows) does not apply to the 60° bones — they are this type's defining grammar. The exemption covers **bones and sub-cause ticks only**; any other connector in a fishbone diagram (e.g. a callout leader, a cross-reference arrow) still uses rounded right-angle elbows.diff --git a/skills/diagram-design/references/type-kanban.md b/skills/diagram-design/references/type-kanban.mdindex 400dafc..e869ba1 100644--- a/skills/diagram-design/references/type-kanban.md+++ b/skills/diagram-design/references/type-kanban.md@@ -6,7 +6,7 @@- **Up to 5 vertical columns of equal width (240px), 32px gutters.** Column background is `ink @ 0.02`; no column border.- **Header band per column:** column name in Geist sans 12px weight 600, anchored left. A right-anchored **WIP chip** — a rectangular tag (`rx=2`, **never** a pill) holding `n/limit` in Geist Mono 8px — or bare `n` on a queue or terminal column, which carries no limit. Every in-process column states one. A hairline `rule` separator sits directly under the header band, full column width.-- **Cards:** the §6 node-box pattern at `rx=6`, column width minus 16px padding on each side, 56px tall, 12px vertical gap between cards. Content: title in Geist sans 12px weight 600, and a Geist Mono 9px `muted` sublabel line for `TICKET-ID · owner` (e.g. `AVA-214 · nadia`).+- **Cards:** the §6 node-box pattern ([primitives-core.md](primitives-core.md#node-box--full-pattern)) at `rx=6`, column width minus 16px padding on each side, 56px tall, 12px vertical gap between cards. Content: title in Geist sans 12px weight 600, and a Geist Mono 9px `muted` sublabel line for `TICKET-ID · owner` (e.g. `AVA-214 · nadia`).- **Drawing order:** background → column fills → header text + WIP chips → header rules → cards (each: box, then left accent bar if blocked, then title, then sublabel) → legend.## Card states — the type's semantic vocabulary@@ -20,7 +20,7 @@ Every card renders in exactly one of four states. Document and use all four when| `waiting / external` | `ink @ 0.02` | `ink @ 0.20` dashed `4,3` | — || `done` | `ink @ 0.05` | `muted` | — |-These map directly onto the SKILL.md §5 node-treatment table (`security` → blocked, `optional` → waiting/external, `store` → done) — the board reuses the system's existing semantic fills rather than inventing new ones.+These map directly onto the node-treatment table in [style-guide.md](style-guide.md#node-type--treatment) (`security` → blocked, `optional` → waiting/external, `store` → done) — the board reuses the system's existing semantic fills rather than inventing new ones.## Over-limit column@@ -40,7 +40,7 @@ When a column's card count `n` exceeds its stated `limit`, the WIP chip's stroke- **In-process columns without WIP limits.** The limit is half the point of the type — a column work flows *through* with no stated limit can't show that it's over budget. The entry queue and the terminal column are the exception: nothing is constrained by holding more done work, so they show a bare count.- **Accenting every blocked card.** One or two blocked cards read as signal; a column full of accent reads as noise and erases the focal rule.- **A "Done" column that grows without bound.** Cap it and note the archive point in the sublabel or a footnote — an unbounded Done column just becomes a second Backlog.-- **Pill-shaped WIP tags.** The chip is a rectangle at `rx=2`, matching the type-tag primitive in §6 — pills read as status badges from an unrelated design language.+- **Pill-shaped WIP tags.** The chip is a rectangle at `rx=2`, matching the type-tag primitive in the §6 node box ([primitives-core.md](primitives-core.md#node-box--full-pattern)) — pills read as status badges from an unrelated design language.## Examplesdiff --git a/skills/diagram-design/references/type-sequence.md b/skills/diagram-design/references/type-sequence.mdindex 7821605..e0dfcfb 100644--- a/skills/diagram-design/references/type-sequence.md+++ b/skills/diagram-design/references/type-sequence.md@@ -87,7 +87,7 @@ Dark mode: frame fill `rgba(245,245,245,0.04)`, stroke `rgba(245,245,245,0.22)`,- Participant create/destroy, found/lost messages, duration timing bars.## Complexity budget (sequence-specific)-- Max lifelines: 5 (same as SKILL.md §7).+- Max lifelines: 5 (same as the §7 budget table in [layout-budget.md](layout-budget.md#complexity-budget-per-diagram)).- Max messages (arrows): 12.- Max combined fragments: 1 (hard default); 2 only if each is a single-region `opt`/`loop`.- Max `alt` regions: 2.