# Contributing to Diagram Design Thanks for wanting to contribute — this project only gets better with more eyes on it. Please read [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) first. All contributions are expected to keep the community welcoming. --- ## 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 52 visual types has its own reference file, and the extractor scripts in `skills/diagram-design/scripts/` turn draw.io, Mermaid, Excalidraw, and PlantUML sources into a structured IR. See [README.md](README.md) for the full picture, including the design system and the import/export flows. --- ## Before you start - **Create an issue first** for anything non-trivial (new type, behavior change, import grammar work). Small fixes and docs can go straight to a PR. - **Work on a branch** — never commit directly to `main`. - **Keep the scope tight.** One PR = one concern. Mixing a new diagram type with a docs rewrite makes review slow. - **Keep at most five PRs open at a time.** GitHub enforces this limit for contributors without write access, including draft PRs. Finish review feedback and close or merge an existing PR before opening another. If you have more ideas, open an issue first so we can agree on priority. Maintainers may ask you to close duplicate or superseded PRs. - **Python 3.10+ is required** for the development scripts (CI runs 3.11 and 3.12 across Linux, Windows, and macOS). --- ## Validation gates Every validation gate below must pass before a PR is ready. They also run automatically as GitHub Actions CI (`.github/workflows/ci.yml`). **Do not bump the plugin version in your PR.** The Claude, Codex, Factory, and Qoder manifest versions are bumped automatically on `main` after each merge by the Auto Version Bump workflow (`.github/workflows/auto-bump.yml`, ADR 0009), so pull requests must leave all four `plugin.json` versions untouched — CI rejects any change to them. This keeps open PRs from conflicting with each other on every merge. If your change warrants more than a patch release, say so in the PR description and the maintainer will apply the `release:minor` or `release:major` label before merging; the label selects the bump size. (`scripts/bump-plugin-version.py` still exists for the workflow and the maintainer — contributors never need to run it.) | What it checks | Command | |---|---| | Plugin bump helper and adversarial package cases | `python3 scripts/test-plugin-package.py` | | Maintainer policy matches native manifests and current CI gates | `python3 scripts/test-maintainer-policy.py` | | OpenAI plugin directory listing limits and upload ZIP contents | `python3 scripts/test-build-openai-plugin-zip.py` | | Manifest versions untouched and synchronized; valid marketplace paths; packaged skill | `python3 scripts/verify-plugin-package.py --require-no-bump origin/main` | | Claude marketplace and plugin schema, with warnings treated as errors | `claude plugin validate . --strict` | | Accessible SVG contract (unit tests for the a11y linter) | `python3 scripts/test-lint-a11y.py` | | No HTML comment in the skill trips the Hermes Agent install scanner's `html_comment_injection` rule (#482) | `python3 scripts/test-install-scan.py` | | Semantic-pattern routing | `python3 scripts/verify-semantic-motion.py --markdown-only` | | Animated-example structure and accessibility | `python3 scripts/verify-semantic-motion.py --example-only` | | Skin conformance of every example and template (colors, fonts, a11y, assets, scripts) | `python3 scripts/lint-skin.py --all --baseline` | | Skin token contrast: every text token clears 4.5:1 and every essential mark 3:1 on paper, light and dark, with translucent tokens composited first | `python3 scripts/test-verify-contrast.py && python3 scripts/verify-contrast.py` | | Rendered-layout checker and shipped examples/templates | `python3 scripts/lint-render.py --self-test && python3 scripts/lint-render.py --all` | | Unit Grid equal cells, reading order, printed values, and movement | `python3 scripts/test-verify-unit-grid.py && python3 scripts/verify-unit-grid.py --all` | | Quantitative polar encoding and variant parity | `python3 scripts/test-verify-polar.py && python3 scripts/verify-polar.py` | | Heatmap monotone opacity ramp, complete N×M grid, ≤1 focal cell | `python3 scripts/test-verify-heatmap.py && python3 scripts/verify-heatmap.py --all` | | Requirement traceability IDs, typed links, and explicit gaps | `python3 scripts/verify-requirement-traceability.py --all && python3 scripts/test-verify-requirement-traceability.py` | | Event modeling stage order, role IDs, and typed link endpoints | `python3 scripts/verify-event-modeling.py --all && python3 scripts/test-verify-event-modeling.py` | | A single file, e.g. a new example | `python3 scripts/lint-skin.py skills/diagram-design/assets/example-my-type.html` | | Sequence-doc consistency, visible ALT guards, ordinary OAuth returns, and headline activation | `python3 scripts/verify-sequence-oauth.py` | | Semantic-motion verifier behaves (pass + adversarial cases) | `python3 scripts/test-verify-semantic-motion.py` | | Sequence-oauth verifier behaves (pass + adversarial cases) | `python3 scripts/test-verify-sequence-oauth.py` | | draw.io import path (real extractor vs fixtures + docs sync) | `python3 scripts/verify-drawio-import.py && python3 scripts/test-verify-drawio-import.py` | | Mermaid import path (grammars, adversarial input, caps, docs sync) | `python3 scripts/verify-mermaid-import.py` | | Excalidraw import path (scenes, adversarial input, caps, docs sync) | `python3 scripts/verify-excalidraw-import.py && python3 scripts/test-verify-excalidraw-import.py` | | PlantUML import path (sequence/class, adversarial input, caps, docs sync) | `python3 scripts/verify-plantuml-import.py && python3 scripts/test-verify-plantuml-import.py` | | Optional motion contract (fallbacks, controls, budgets, determinism) | `python3 scripts/test-verify-motion.py` | | 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, 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` | | Packaged PNG exporter's stalled-webfont fallback (window.stop on timeout, warning, normal load) | `python3 scripts/test-export-wait.py` (requires Playwright; skips without it) | | Screenshot freshness checker behaves (CRLF checkout, real source drift, raw PNG digests) | `python3 scripts/test-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, including `--offline`) | `python3 scripts/test-self-check.py` | | Standalone SVG export carries CSS, namespaces defs IDs, and honors `--system-fonts` | `python3 scripts/test-export-svg-standalone.py` | | Label masks are never clipped by a node painted after them; connectors stay orthogonal, off node borders, corners, and each other, and on their own ports | `python3 scripts/verify-geometry.py --all` | | Label geometry checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-geometry.py` | | Architecture delta snapshots preserve identity, ledger coverage, signatures, positions, and relationship endpoints | `python3 scripts/verify-architecture-delta.py --all` | | Architecture delta checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-architecture-delta.py` | | Architecture containment IDs, parents, geometry, PaaS placement, and peerings | `python3 scripts/verify-architecture-containment.py --all` | | Architecture containment checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-architecture-containment.py` | | Exploded examples are what the builder produces | `python3 scripts/build-exploded-examples.py --check` | | Exploded axonometric silhouettes match their declared boxes, gaps are equal, and labels sit in one clear column | `python3 scripts/verify-exploded.py --all` | | Exploded axonometric checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-exploded.py` | | Axonometric plan examples are what the builder produces | `python3 scripts/build-axonometric-plan-examples.py --check` | | Axonometric plan boxes match their declared footprints, paint back to front, never overlap, and carry one clear tag each | `python3 scripts/verify-axonometric-plan.py --all` | | Axonometric plan checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-axonometric-plan.py` | | SBGN maps are bipartite, compartment-contained, and under the Bruno ceiling | `python3 scripts/verify-sbgn.py --all` | | SBGN checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-sbgn.py` | | Traceable block decomposition registries have unique IDs, resolving parents, names, and no cycles | `python3 scripts/verify-block-registry.py --all` | | Block registry checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-block-registry.py` | | Treemap cells match the values they are labelled with, and labels fit | `python3 scripts/verify-treemap.py --all` | | Treemap checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-treemap.py` | | Marimekko columns, segments and areas match the amounts they declare, in one series order | `python3 scripts/verify-marimekko.py --all` | | Marimekko checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-marimekko.py` | | Dumbbell domain resolves finitely and its marks clear 3:1 | `python3 scripts/verify-dumbbell.py` | | Dumbbell checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-dumbbell.py` | | Slopegraph axes share one scale and every endpoint matches its printed value | `python3 scripts/verify-slopegraph.py --all` | | Slopegraph checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-slopegraph.py` | | Streamgraph layers tile one shared scale on a symmetric baseline and every total is a sum | `python3 scripts/verify-streamgraph.py --all` | | Streamgraph checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-streamgraph.py` | | Ridgeline ridges share one amplitude and every printed range matches its bins | `python3 scripts/verify-ridgeline.py --all` | | 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` | | Service-blueprint visibility line, stage grid, and census | `python3 scripts/verify-service-blueprint.py --all` | | Service-blueprint checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-service-blueprint.py` | | Steps equal-width contiguous rail, numbering, medallions, and focal stage | `python3 scripts/verify-steps.py --all` | | Steps checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-steps.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` | | Bump checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-bump.py` | | Beeswarm dots sit exactly at their values on one shared scale with no overprint | `python3 scripts/verify-beeswarm.py --all` | | Beeswarm checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-beeswarm.py` | | Box-plot five-number summaries sit on one shared scale, ordered, with outliers outside the whiskers | `python3 scripts/verify-box-plot.py --all` | | Box-plot checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-box-plot.py` | | Arc-diagram spans sit on one shared pitch, each a rising semicircle whose height is the seat count | `python3 scripts/verify-arc-diagram.py --all` | | Arc-diagram checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-arc-diagram.py` | | Git-graph commits sit on lanes and a shared time grid; every merge has two earlier parents | `python3 scripts/verify-git-graph.py --all` | | Git-graph checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-git-graph.py` | | Quoted CSS data is not read as a geometry declaration by any verifier (pass + adversarial cases) | `python3 scripts/test-css-string-scan.py` | | Every directional tone claim matches the ramp it describes, on every skin | `python3 scripts/verify-skin-polarity.py --all` | | 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. 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 diagram claims checked Every diagram gets the common skin, accessibility, render, and geometry gates above. A chart with a numerical or structural claim also needs a type-specific verifier: identify the claim (for example, waterfall running totals, Sankey flow conservation, or treemap area shares), bind each displayed value to machine-readable data, and compare the rendered marks and labels with recomputed values. Add a complete valid example and at least one **plausible rendered error** as an adversarial fixture. The [waterfall case](docs/pr-previews/waterfall/plausible-wrong.md) shows a chart whose end label says 236 when its signed contributions sum to 238. Name the pair `scripts/verify-.py` and `scripts/test-verify-.py`, then run both on the shipped variants in CI. `scripts/test-maintainer-policy.py` now fails if any verifier or its adversarial test is missing from the CI-backed local gate list. This guards the wiring as new checkers arrive. The current type checkers verify **internal consistency** of the chart and its declarations. They cannot prove that a correctly drawn number matches an external budget, spreadsheet, or API. To cover that boundary for generated diagrams, keep an independent source-data file, make the type verifier compare it with the chart's declarations, package the verifier with the installed skill, and call it from the generated-output self-check. Until a type has that path, run its repository verifier explicitly and do not describe the source data as verified. Keep native plugin and marketplace `description` fields within 500 characters for Cowork installation compatibility ([#208](https://github.com/cathrynlavery/diagram-design/issues/208)). They summarize the main families and don't need to name a new type. The skill frontmatter description and the Codex `longDescription` must name every visual type. The docs-sync gate checks the length and the routing vocabulary, and the package gate keeps native descriptions aligned. The Codex `interface` block doubles as the OpenAI plugin directory listing, so `displayName` and `shortDescription` stay within 30 characters and `longDescription` within 4,000. `scripts/build-openai-plugin-zip.py --check` enforces those limits. The maintainer publishes the directory listing; please don't submit this plugin to OpenAI or any other plugin directory yourself. Static geometry verifiers using `scripts/css_property_scan.py` refuse escaped CSS declaration names, including escaped custom-property names ([#518](https://github.com/cathrynlavery/diagram-design/issues/518)). Spell declaration names literally. Escapes in values, quoted data, comments and selector preludes retain each verifier's existing restrictions; `scripts/test-css-string-scan.py` covers both accepted data and rejected declarations. Run them all at once before pushing: ```bash python3 scripts/test-plugin-package.py \ && python3 scripts/test-maintainer-policy.py \ && python3 scripts/test-build-openai-plugin-zip.py \ && python3 scripts/verify-plugin-package.py --require-no-bump origin/main \ && claude plugin validate . --strict \ && python3 scripts/test-lint-a11y.py \ && python3 scripts/test-install-scan.py \ && python3 scripts/verify-semantic-motion.py --markdown-only \ && python3 scripts/verify-semantic-motion.py --example-only \ && python3 scripts/verify-motion.py --shipped \ && python3 scripts/lint-skin.py --all --baseline \ && python3 scripts/lint-render.py --self-test \ && python3 scripts/lint-render.py --all \ && python3 scripts/test-verify-unit-grid.py \ && python3 scripts/verify-unit-grid.py --all \ && python3 scripts/test-verify-polar.py \ && python3 scripts/verify-polar.py \ && python3 scripts/test-verify-heatmap.py \ && python3 scripts/verify-heatmap.py --all \ && python3 scripts/verify-sequence-oauth.py \ && python3 scripts/test-verify-semantic-motion.py \ && python3 scripts/test-verify-sequence-oauth.py \ && python3 scripts/verify-drawio-import.py \ && python3 scripts/test-verify-drawio-import.py \ && python3 scripts/verify-mermaid-import.py \ && python3 scripts/verify-excalidraw-import.py \ && python3 scripts/test-verify-excalidraw-import.py \ && python3 scripts/verify-plantuml-import.py \ && python3 scripts/test-verify-plantuml-import.py \ && python3 scripts/test-verify-motion.py \ && python3 scripts/verify-doctor.py \ && python3 scripts/test-verify-doctor.py \ && python3 scripts/verify-docs-sync.py \ && python3 scripts/test-verify-docs-sync.py \ && python3 scripts/verify-screenshot-freshness.py \ && python3 scripts/test-verify-screenshot-freshness.py \ && python3 scripts/test-build-readme-thumbs.py \ && python3 scripts/build-readme-thumbs.py --check \ && python3 scripts/test-verify-contrast.py \ && python3 scripts/verify-contrast.py \ && python3 scripts/test-self-check.py \ && python3 scripts/test-export-svg-standalone.py \ && python3 scripts/verify-geometry.py --all \ && python3 scripts/test-verify-geometry.py \ && python3 scripts/verify-architecture-delta.py --all \ && python3 scripts/test-verify-architecture-delta.py \ && python3 scripts/verify-architecture-containment.py --all \ && python3 scripts/test-verify-architecture-containment.py \ && python3 scripts/build-exploded-examples.py --check \ && python3 scripts/verify-exploded.py --all \ && python3 scripts/test-verify-exploded.py \ && python3 scripts/build-axonometric-plan-examples.py --check \ && python3 scripts/verify-axonometric-plan.py --all \ && python3 scripts/test-verify-axonometric-plan.py \ && python3 scripts/verify-sbgn.py --all \ && python3 scripts/test-verify-sbgn.py \ && python3 scripts/verify-block-registry.py --all \ && python3 scripts/test-verify-block-registry.py \ && python3 scripts/verify-treemap.py --all \ && python3 scripts/test-verify-treemap.py \ && python3 scripts/verify-marimekko.py --all \ && python3 scripts/test-verify-marimekko.py \ && python3 scripts/verify-dumbbell.py \ && python3 scripts/test-verify-dumbbell.py \ && python3 scripts/verify-slopegraph.py --all \ && python3 scripts/test-verify-slopegraph.py \ && python3 scripts/verify-streamgraph.py --all \ && python3 scripts/test-verify-streamgraph.py \ && python3 scripts/verify-ridgeline.py --all \ && 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-service-blueprint.py --all \ && python3 scripts/test-verify-service-blueprint.py \ && python3 scripts/verify-steps.py --all \ && python3 scripts/test-verify-steps.py \ && python3 scripts/verify-bubble.py --all \ && python3 scripts/test-verify-bubble.py \ && python3 scripts/verify-bump.py --all \ && python3 scripts/test-verify-bump.py \ && python3 scripts/verify-beeswarm.py --all \ && python3 scripts/test-verify-beeswarm.py \ && python3 scripts/verify-box-plot.py --all \ && python3 scripts/test-verify-box-plot.py \ && python3 scripts/verify-arc-diagram.py --all \ && python3 scripts/test-verify-arc-diagram.py \ && python3 scripts/verify-git-graph.py --all \ && python3 scripts/test-verify-git-graph.py \ && python3 scripts/test-css-string-scan.py \ && python3 scripts/verify-skin-polarity.py --all \ && python3 scripts/test-verify-skin-polarity.py \ && python3 scripts/test-export-wait.py ``` ### If a gate fails - **`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 52 renders, and commit the updated PNGs plus `docs/screenshots/manifest.json`. The gate hashes example sources in their canonical LF form, so a checkout that converts LF to CRLF still passes; `scripts/test-verify-screenshot-freshness.py` covers that case, real source drift, and raw PNG digests. - **`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-marimekko.py`:** a column is drawn off its category's share of the width, a segment off its series' share of the column, the columns do not share one plot height or one gutter, segments leave a gap or overlap, a series changes order between columns, a second segment wears the accent, anything positions a segment or a bound label from a `transform` attribute, an inline `style`, or a `