{"slug":"architecture-drawer","title":"architecture-drawer","summary":"Use when asked to draw system architecture diagrams, generate technical architecture SVGs, or export architecture diagrams to editable PowerPoint presentations. Supports multi-layer diagrams with automatic layout validation and scoring (16-dimension evaluator catches collisions, ","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-08-30T09:57:24.916599Z","repo":{"url":"https://github.com/Andy1314Chen/architecture-drawer","stars":47,"forks":3,"license":"MIT","updatedAt":"2026-08-31T23:32:05Z"},"bodyHtml":"<hr>\n<h2>name: architecture-drawer\ndescription: Use when asked to draw system architecture diagrams, generate technical architecture SVGs, or export architecture diagrams to editable PowerPoint presentations. Supports multi-layer diagrams with automatic layout validation and scoring (16-dimension evaluator catches collisions, overlaps, dangles, crossings, palette issues incl. colorless and gray-dominant diagrams, low-contrast labels, misaligned peers, and a Step-1 design-brief contract: the declared palette/layout/flow is asserted against the rendered SVG).</h2>\n<h1>SVG Architecture Drawer (Smart Version)</h1>\n<p>This Skill converts complex technical descriptions into structured SVG architecture diagrams. It integrates layout constraints, collision detection, <strong>connection/arrow connectivity validation</strong>, and quality evaluation, automatically identifying and guiding the correction of layout errors.\nThe script directory (referred to as <code>$SKILL</code> below) is this skill's own\n<code>scripts/</code> folder. From a generator script that lives next to its artifacts,\nresolve it relative to the script's own location (never hard-code an absolute\npath, which breaks on other machines):</p>\n<pre><code>import os, sys\n_HERE = os.path.dirname(os.path.abspath(__file__))\n# From evals/&lt;name&gt;/gen.py -&gt; ../../scripts ; adjust depth for your layout.\n_SKILL = os.path.normpath(os.path.join(_HERE, \"..\", \"..\", \"scripts\"))\nif _SKILL not in sys.path:\n    sys.path.insert(0, _SKILL)\n</code></pre>\n<h2>Step 0 — Intent Judgment (fidelity vs. completion)</h2>\n<p>Before writing any code, classify the requirement — the two failure modes are\nmirror images: transcribing a vague spec literally produces a broken diagram,\nand \"improving\" a precise spec produces one the user did not ask for.</p>\n<p><strong>Faithful mode</strong> — the description is clear and detailed (explicit components,\nrelations, flow direction, canvas): transcribe it exactly. Do <strong>not</strong> invent\ncomponents, layers, edges, or legend entries the user did not state, and do not\n\"upgrade\" the palette or topology on your own taste. Adding unrequested boxes\nis a defect, not a feature (画蛇添足).</p>\n<p><strong>Completion mode</strong> — the description is vague (the user may not have a fixed\npicture in mind yet): infer a reasonable design, then state what you inferred.\nAmbiguity signals and the corresponding conservative defaults:</p>\n<table>\n<thead>\n<tr>\n<th>Missing in the spec</th>\n<th>Conservative default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Relations between named components</td>\n<td>connect adjacent tiers only, in the domain's natural flow (client → API → compute → storage)</td>\n</tr>\n<tr>\n<td>Canvas / size</td>\n<td>1200×800 (or the diagram-type preset in <code>references/diagram_types.md</code>)</td>\n</tr>\n<tr>\n<td>Diagram type</td>\n<td>pick from <code>references/diagram_types.md</code> by content keywords</td>\n</tr>\n<tr>\n<td>Layer grouping</td>\n<td>group only when the spec's own vocabulary implies it (\"… layer\", \"… module\")</td>\n</tr>\n<tr>\n<td>A composite-sounding component (\"gateway\", \"engine\")</td>\n<td>stays ONE node — never split into sub-nodes the user did not mention</td>\n</tr>\n</tbody>\n</table>\n<p>Completion rule: an addition is legitimate only when the diagram is\nstructurally incoherent without it — never decorative. List every assumption\nin the final reply (\"assumed top-to-bottom flow; inferred gateway→auth edge\")\nso the user can veto. When two readings are both plausible, pick the simpler\none and note the alternative.</p>\n<h2>Step 1 — Design Brief (开工前完整设计)</h2>\n<p>After Step 0 classifies the requirement and BEFORE writing any code, produce a\ncomplete design proposal that combines the user's <code>input.md</code> with this skill's\ndesign system — <strong>state the design, then draw it</strong>. In an interactive session\nyou may show the brief first and let the user veto; in headless/automation,\nprint it in the reply and proceed.</p>\n<p>The brief has five mandatory sections:</p>\n<ol>\n<li><strong>Canvas &amp; layout skeleton</strong> — canvas size, band/column/grid partition,\nmargins, and the placement <em>strategy</em> as relative formulas (e.g.\n<code>gap = (band_w − n·card_w) / (n + 1)</code>, <code>y[i+1] = y[i] + h + GUTTER</code>), not\nper-element hard-coded coordinates. Name what Step 0 left open (completion\nmode) or what the spec pinned (faithful mode).</li>\n<li><strong>Palette</strong> — pick ONE preset scheme from <code>references/design_specs.md</code>\n(S1–S4) by information need and give the role→color mapping table: each\nbusiness role gets a light tint fill PAIRED with its dark accent stroke;\nop cards stay white; accents ≤8; at least one chromatic accent (the ⑯\n无配色 floor). Exact hex from the spec, when given, wins over the preset.\nColor must OWN THE STRUCTURE, not decorate it: tint the band/container\nfills (band-style) or color the primary nodes (node-style) — a mostly\ngray/white skeleton with color confined to small chips FAILs the ⑯\n灰色主导 check (chromatic coverage &lt;35% of elements AND &lt;15% of area).</li>\n<li><strong>Typography tiers</strong> — 3–4 tiers with concrete values (e.g. 20 / 14 / 12 /\n10) and which text class uses each (title / section header / node label /\nnote).</li>\n<li><strong>Edge routing</strong> — flow directions, solid vs dashed semantics, spine/bus\ncorridors routed OUTSIDE content areas (kiss container edges, never slice\nfilled rects — the semantic-QA 箭头线盖在组件上 check), junction/merge\npoints, and edge-label placement rules (off the line, perpendicular\noffset).</li>\n<li><strong>Risk checklist</strong> — the pairings and budgets you expect to flirt with:\ntext-on-fill contrast (⑮) for every tint+text pair, node spacing ≥14px,\ncontainer gutter ≥20px, font-tier ratios ≥1.15×, marker ids actually used\n(marker 缺省陷阱).</li>\n</ol>\n<p><strong>Landing rule (常量落盘):</strong> the brief must not stay prose. It lands in TWO\nexecutable forms:</p>\n<ol>\n<li>a constants block at the top of <code>gen.py</code> (dimensions and tokens the\ndrawing code reads), and</li>\n<li>a <strong><code>BRIEF = DesignBrief(...)</code> contract object</strong> from <code>$SKILL/design_brief.py</code>\n— the machine-readable declaration the semantic-QA layer asserts the\nRENDERED SVG against (palette/layout/flow). The brief is the single source\nof truth and <strong>mutable during refine</strong>: if a contrast fix changes a tint,\nupdate <code>BRIEF</code> in the same round rather than silently deviating.</li>\n</ol>\n<pre><code># --- Design Brief tokens (Step 1) — edit here, not scattered below --------\nW, H       = 1240, 970                 # canvas\nGUTTER     = 20                        # band spacing\nINK, SUB   = \"#1A1A1A\", \"#555555\"      # text tiers 20/14/12/10\nTINTS      = [\"#D5E1EB\", \"#BBCEDF\"]    # S1 layer fills (paired strokes below)\nSTROKES    = [\"#1B3A5C\", \"#2563EB\"]    # dark accent per tint\nF_TIERS    = [20, 14, 12, 10]\n\nfrom design_brief import DesignBrief, ColorSpec\nBRIEF = DesignBrief(\n    scheme=\"S1\", layout=\"band\", flow=\"top-down\",   # layout: band|node; flow: top-down|left-right|none\n    palette_role={                                  # key = data-node-id on the shape\n        \"api\":    ColorSpec(TINTS[0], STROKES[0]),  # tinted container: fill+stroke PAIR\n        \"engine\": ColorSpec(TINTS[1], STROKES[0]),\n        \"store\":  ColorSpec(\"white\",  STROKES[0]),  # plain op cards stay white\n    },\n    flow_chain=(\"api\", \"engine\"),   # ordered pipeline stages ONLY — side\n)                                   # bands / text-only bands stay out of the chain\n# Render each palette key with a matching node_id= so the contract can\n# attribute rendered shapes: drawer.rect(..., node_id=\"api\", role=\"layer\")\n</code></pre>\n<p><strong>Contract rules</strong> (enforced by <code>check_design_brief</code> in semantic QA):</p>\n<ul>\n<li><code>palette_role</code> keys are <code>data-node-id</code> values — band layout: layer\ncontainers (<code>role=\"layer\"</code>); node layout: primary nodes. One map, no\nduplicate layer list to drift.</li>\n<li><code>flow_chain</code> is the ordered pipeline (⊆ palette keys). Memory/cache side\ncolumns and text-only bands are palette members but NOT chain stages.</li>\n<li>Declared tints rendered white → FAIL (structure lost its color); wrong\ntint/stroke or undeclared chromatic paint → WARN; ≥70% of inter-layer\nedges must follow the declared flow (return edges tolerated); chain\nfirst/middle/last layers need out/both/in ≥1.</li>\n<li><strong>Capability boundary</strong>: the checker verifies <em>rendering ↔ self-declared\ncontract</em> consistency, not <em>contract ↔ user intent</em> — spec-entity coverage\nand human review of the brief guard the intent side.</li>\n</ul>\n<h2>Core Workflow: Generate-Evaluate-Correct</h2>\n<pre><code>digraph eval_loop {\n    \"Generate gen.py\" -&gt; \"evaluate_svg()\" [label=\"run\"];\n    \"evaluate_svg()\" -&gt; \"score≥100 AND no [FAIL]?\" [label=\"score\"];\n    \"score≥100 AND no [FAIL]?\" -&gt; \"Done\" [label=\"yes\"];\n    \"score≥100 AND no [FAIL]?\" -&gt; \"auto_refine(drawer, max_iter=3)\" [label=\"no\"];\n    \"auto_refine(drawer, max_iter=3)\" -&gt; \"score≥80?\" [label=\"after n iterations\"];\n    \"score≥80?\" -&gt; \"Manual fix (coordinates/text)\" [label=\"yes · ship\"] ;\n    \"score≥80?\" -&gt; \"Regenerate gen.py\" [label=\"no · restart\"];\n}\n</code></pre>\n<ol>\n<li><p><strong>Content Parsing &amp; Design Brief</strong>:</p>\n<ul>\n<li>Identify layers, components, and flow direction.</li>\n<li>Determine canvas dimensions (default 1200x800).</li>\n<li>Write the Step 1 Design Brief (above) — layout skeleton, palette, tiers,\nedge routing, risks — BEFORE any drawing code; land its tokens as the\ngen.py constants block.</li>\n</ul>\n</li>\n<li><p><strong>Coding &amp; Layout</strong>:</p>\n<ul>\n<li>Write a Python script calling <code>$SKILL/svg_utils.py</code>.</li>\n<li><strong>Required</strong>: use <code>drawer.check_collisions()</code> to check overlaps; use the semantic API (below) to register nodes and edges so connections can be auto-validated.</li>\n</ul>\n</li>\n<li><p><strong>Quality Evaluation</strong>:</p>\n<ul>\n<li>Call <code>evaluate_svg(drawer)</code> from <code>$SKILL/evaluator.py</code>.</li>\n<li>Evaluation dimensions: ① <strong>Containment-aware</strong> element overlap detection (parent-child nesting does not count as a collision); ② boundary checks; ③ canvas coverage; ④ <strong>connection/arrow connectivity</strong> (endpoints must land on registered node borders, 12px tolerance; also detects degenerate zero-length edges and duplicate edges); ⑤ <strong>phantom anchor detection</strong> (nodes referenced by edges but invisible); ⑥ <strong>edge-routes-through-node</strong> (edges must not pass through the interior of a non-endpoint node, 3px inset); ⑦ <strong>edge crossing</strong> (two edge segments intersecting internally); ⑧ <strong>same-kind node minimum spacing</strong> (Euclidean distance between op/junction nodes ≥ 14px); ⑨ <strong>font-size tier detection</strong> (parse SVG to extract all <code>font-size</code> values, deduplicate to ≤4 tiers, adjacent tiers must be ≥1.15× apart — prevents accidental micro-steps like 11/12/13/14); ⑩ <strong>palette detection</strong> (accent colors ≤8 warning, ≤12 hard limit; coexistence of very dark L&lt;0.2 and very light L&gt;0.8 accents is flagged as a conflict; background defaults to light); ⑪ <strong>text overflow detection</strong> (parse all <code>&lt;text&gt;</code> elements' true geometry, estimate text width by font metrics: overflowing the canvas = FAIL, text wider than its container [smallest rectangle containing the text center] = WARN — closes the blind spot of text drawn via <code>add_element</code> that doesn't enter <code>bboxes</code> and is invisible to collision/boundary checks); ⑫ <strong>composition quality budget</strong> (ported from fireworks <code>assess_composition</code>: ≤2 bends per edge, path stretch ratio ≤1.35, container gutter ≥20px, shortest path segment ≥16px; <strong>text as a measurable obstacle</strong> — edge segments passing through a <code>&lt;text&gt;</code> bbox = FAIL, systematically eliminating \"text crossed/covered by edges\"; gutter is only checked for nodes fully contained within a container, cross-band nodes are not false-flagged). ⑨⑩⑪⑫ <strong>parse the actual SVG</strong> rather than relying on API calls, so they work equally well for raw <code>add_element</code> drawing.</li>\n<li>⑬ <strong>text-vs-shape &amp; text-vs-text overlap detection</strong> (<code>check_text_overlaps</code>): parses every <code>&lt;text&gt;</code> bbox (center model, <code>dominant-baseline=\"central\"</code>) against all visible circles/rects/polygons/lines/paths AND against other <code>&lt;text&gt;</code> — closes the registry blind spot where <code>bbox=False</code> text/shapes and <code>add_element</code> shapes are invisible to <code>check_collisions</code>. Legend/background shapes, the full-canvas bg rect, and rects fully containing the text (intentional in-box labels) are exempt. Like ⑨⑩⑪⑫, this <strong>parses the actual SVG</strong> rather than trusting the API.</li>\n<li>⑭ <strong>same-kind peer alignment</strong> (<code>check_alignment</code>): two SAME-SIZED same-kind visible nodes that read as a row or column (strong overlap on the perpendicular axis) yet share NEITHER a top/bottom/left/right edge (within 5px) NOR a center line (within 15% of the shorter side) are flagged — the \"align to shared edges\" layout principle. Differently-sized peers are skipped (a row of varied components legitimately staggers).</li>\n<li>⑮ <strong>text-on-fill contrast</strong> (<code>check_contrast</code>): WCAG 2 contrast ratio between each <code>&lt;text&gt;</code>'s fill and the fill of the smallest <code>&lt;rect&gt;</code> containing it — FAIL below 3:1 (large-text floor), WARN below 4.5:1 (AA for normal text) / 3:1 large (≥24px, or ≥18.5px bold). Only text on a <strong>non-neutral (accent)</strong> fill is measured; accent-colored text on a white/neutral canvas (category labels, captions) is a typographic choice, not a fill defect, and is skipped. Replaces the former \"manual review recommended\" placeholder.</li>\n<li>⑯ <strong>chromatic palette floor &amp; gray-dominance</strong> (<code>check_palette</code>): at least one accent must carry a readable hue (HSL saturation ≥0.25) — a diagram whose only \"accents\" are desaturated slate tones (#546E7A et al.) or none at all is <strong>effectively colorless (无配色)</strong> and FAILs. And color must own the <strong>structure</strong>, not just decorate it: when chromatic shapes cover &lt;35% of business elements AND &lt;15% of painted area, the diagram is <strong>gray-dominant (灰色主导)</strong> — neutral bands/containers with color confined to small chips — and also FAILs. One strong axis is a legitimate scheme: band-style diagrams ride the area axis (tinted container fills), node-style diagrams the element axis (colored primary nodes). Pastel tints (#DAE8FC) count as chromatic; slate/pure grays do not. The classic trigger for both: \"fixing\" a contrast WARN by de-coloring.</li>\n</ul>\n<p><strong>3b. Semantic QA</strong> (after the geometry score): call <code>run_semantic_qa</code> from\n<code>$SKILL/semantic_qa.py</code>. The evaluator above checks how the picture\n<em>renders</em>; this checks what the picture <em>means</em> — the three defect classes\na bounding-box evaluator structurally cannot see:</p>\n<ul>\n<li><strong>marker 缺省陷阱</strong> — <code>marker-end=\"url(#X)\"</code> referencing an undefined\n<code>&lt;marker id&gt;</code> (the classic case: <code>arrow_head(\"arrow\", ...)</code> registered but\na <code>connect()</code> call left at its default <code>marker_end=\"arrowhead\"</code>) → every\narrowhead on that edge silently vanishes. FAIL. A defined-but-never-used\nmarker (usually a forgotten <code>marker_end=</code>) is flagged as WARN.</li>\n<li><strong>FIGS 尺寸漂移</strong> — declared canvas vs. actual content bbox: content far\nsmaller than the canvas (mis-sized diagram), content poking outside\n(clipped), or a mismatch against the design-spec size passed as\n<code>expected_size=(w, h)</code>.</li>\n<li><strong>标签错位</strong> — a centered label off its node's centre, a label floating\nin whitespace (not inside, near, or beneath any node — legitimate\ntop-band titles, branch labels beside edges, and cluster captions are\nexempt), or a business node box with no label at all.</li>\n<li><strong>箭头线盖在组件上</strong> (<code>rail-slices-container</code> / <code>connector-through-card</code>)\n— parsed straight from the rendered geometry, role-blind to the\nregistry: a raw-<code>line()</code> bus rail that slices through filled band\ncontainers (the right-spine-at-x≈776-inside-the-band trap), or a\nconnector crossing a business card's interior. The registry evaluator\nis structurally blind to both (rails are never registered as edges;\n<code>role='layer'</code> containers are never registered as nodes).</li>\n<li><strong>文本语义</strong> (<code>check_text_semantics</code>, pass <code>spec_text=input.md</code>) —\nplaceholder/garbled/empty <code>&lt;text&gt;</code> → FAIL; spec component identifiers\n(bold/backtick identifiers like <strong>AgentEvent</strong>, <code>server_queue</code>) missing\nfrom the diagram: coverage &lt;40% → FAIL (regenerate — whole components\nlost), 40–85% → WARN (paraphrase advisory fed back into refine rounds).</li>\n</ul>\n<pre><code>from semantic_qa import run_semantic_qa\n\nscore, report = evaluate_svg(drawer)          # geometry first\nspec = Path(\"input.md\").read_text() if Path(\"input.md\").exists() else None\nqa = run_semantic_qa(drawer, expected_size=(1240, 970), spec_text=spec,\n                     brief=BRIEF)             # + the Step-1 contract\nfor line in qa.report():\n    print(line)\n# qa.has_fail → semantic defect (dangling marker ref, rail over a\n# component, lost spec entities, brief-contract violation): fix before export\n# brief omitted → brief-absent WARN: declaring the contract is not optional\n</code></pre>\n</li>\n<li><p><strong>Auto-Correction</strong>:</p>\n<ul>\n<li>If the evaluation score is below <strong>80</strong>, analyze the <code>[FAIL]</code> items in the report.</li>\n<li>Connection issues (<code>dangles</code> / <code>Degenerate edge</code> / <code>overlaps</code>): use <code>drawer.connect(...)</code> to let endpoints auto-snap to node borders; avoid manually computing offset coordinates.</li>\n<li><code>phantom</code> (phantom anchors): the node referenced by an edge is invisible → give it a real fill/stroke, or use the distinct-port pattern to connect to a visible junction.</li>\n<li><code>routes through node</code>: an edge cuts through an intermediate node → reroute via orthogonal bypass channels, or relay through a junction (see distinct-port pattern), keeping a ≥20px gap from the intermediate node.</li>\n<li><code>cross</code> (edge crossings): adjust node layout or routing channels so edges don't intersect (reference fireworks' zero-crossing budget).</li>\n<li><code>too close</code>: same-kind nodes are clustered → increase spacing or enlarge the canvas.</li>\n<li>Arrow position: <code>connect()</code> auto-retracts by <code>marker_tip_depth</code> — retraction = <code>(markerWidth − refX) × stroke_width</code>, derived from the marker dimensions registered by <code>arrow_head()</code>, so the arrow tip lands exactly on the target border (neither poking in nor leaving a gap). For custom markers, pass the real dimensions via <code>arrow_head(id, color, marker_width=, ref_x=)</code> — no manual tweaking needed.</li>\n<li><code>font</code> (font sizes): more than 4 distinct tiers after dedup → converge to 3-4 tiers (title/body/note); near-overlapping tiers (ratio &lt;1.15, e.g. 11/12) → merge into one tier. Recommended modular scale: 20 / 14 / 12 / 10 (all steps ≥1.15). This matches the tier count measured in each ink-graph style.</li>\n<li><code>palette</code>: accent count &gt;8 → trim toward a preset scheme (S1–S4) — consolidate near-hue accents, drop redundant category colors; &gt;12 → same, harder. <code>no chromatic accent</code> (无配色, FAIL) → restore tinted layer fills + accent strokes from a preset scheme. <code>gray-dominant</code> (灰色主导, FAIL) → color is marginal: tint the band/container fills (band-style) or color the primary nodes (node-style) so the scheme owns the skeleton — do not merely enlarge a legend/chip. <strong>Never satisfy a palette or contrast finding by reverting the whole diagram to neutral</strong> — that trades a WARN for a colorless or gray-dominant diagram, which now FAILs. Luminance conflict (very dark + very light coexist) → unify into one brightness family. Non-light background → apply white by default; dark themes must declare <code>set_background()</code>/<code>bg=</code>. See <code>references/design_specs.md</code> for the 4 preset schemes (S1–S4) and when to use each.</li>\n<li>Layout issues: adjust component coordinates, spacing, or scale ratio, then regenerate.</li>\n<li><code>text</code> overflow: text exceeds the canvas → shorten the copy or shift the start point left; text wider than its card/container → shorten, auto-wrap by container width (greedy word-wrap), or widen the container. Note that <code>&lt;text&gt;</code> does not enter <code>bboxes</code> by default, so collision/boundary checks can't see it — this detection fills that gap.</li>\n<li><code>text overlap</code> (text on a shape or another text): a label sits on top of a circle/triangle/arc/line or collides with a neighboring label → move the label clear of the shape (place it above/below the icon, not on it) or shorten it. <code>auto_refine</code> cannot fix this (no geometry handle for raw <code>add_element</code> text) — adjust coordinates manually. This catches overlaps <code>check_collisions</code> misses because <code>bbox=False</code> text/shapes and <code>add_element</code> shapes bypass the collision registry.</li>\n<li><code>contrast</code> (low text-on-fill contrast): a label doesn't read against its accent card (ratio &lt;3:1 FAIL, &lt;4.5:1 WARN for normal text) → darken/lighten the text fill toward the channel extreme (pure <code>#000000</code>/<code>#ffffff</code> on a mid-tone card is always safe), or switch the card to a lighter tint of the same hue so a dark label clears AA. <strong>De-coloring the card to white/gray is NOT a fix</strong> — it silences this check by making the diagram colorless, which the ⑯ chromatic floor then FAILs; always keep a tint fill paired with its dark accent stroke. Note: accent-colored text on a <strong>neutral</strong> canvas is a deliberate category/heading choice and is not flagged — only labels on accent fills are. <code>auto_refine</code> does not touch colors; adjust manually.</li>\n<li><code>alignment</code> (misaligned same-size peers): two same-sized same-kind nodes in a row/column share no edge/center line → nudge one onto the other's top/bottom (row) or left/right (column) edge, or onto a shared center line. Differently-sized peers are exempt (they legitimately stagger). <code>auto_refine</code> does not handle alignment yet — adjust coordinates manually.</li>\n<li><code>composition</code> gutter (insufficient container margin): node too close to the container edge → push the node toward the container center; or call <strong><code>auto_refine(drawer)</code></strong> (below) to iteratively auto-correct.</li>\n<li><strong><code>auto_refine(drawer, target_score=100, max_iter=3)</code></strong>: reads the <code>evaluate_svg</code> report and auto-corrects programmable issue categories (gutter → nudge node toward container center; too close → spread along the primary axis), looping until the target is met or iterations are exhausted. Returns <code>(score, report, fixes)</code>. Complex fixes (dangles/cross/route-through) still need manual intervention — auto_refine only handles geometric micro-adjustments.</li>\n</ul>\n</li>\n</ol>\n<h2>Node &amp; Edge Semantics</h2>\n<p>For the evaluator to \"see\" connections, drawing code must register connectable rectangles as <strong>nodes</strong> and connections as <strong>edges</strong>:</p>\n<ul>\n<li><strong>Register nodes</strong>: <code>drawer.rect(..., node_id=\"op1\", node_kind=\"op\")</code> — draws a rectangle and registers a node simultaneously. <code>node_kind</code> can be <code>\"op\" | \"layer\" | \"block\" | \"region\"</code>; used for provenance only, not for validation.</li>\n<li><strong>Circle nodes (junctions/markers)</strong>: <code>drawer.circle(cx, cy, r, ..., node_id=\"jn\", node_kind=\"junction\")</code> — draws a visible circle and registers a square Node of side 2r as a snap anchor; endpoints landing at the center register distance 0. Ideal for bus junctions and port markers.</li>\n<li><strong>Register edges</strong>: prefer <code>drawer.connect(from_id, from_side, to_id, to_side, ...)</code> — endpoints are taken from node border midpoints (<code>\"top\"|\"bottom\"|\"left\"|\"right\"</code>), so arrows always land precisely on the node edge. Options: <code>dashed=True</code> (dashed, e.g. lowering/bypass flows), <code>as_curve=True</code> + <code>curve_dir=\"left\"|\"right\"</code> (curve), <code>edge_label=</code> (annotation).</li>\n<li><strong>Dashed rendering</strong>: <code>dashed=</code> is available on <strong>all</strong> primitives — <code>rect</code>, <code>circle</code>, <code>line</code>, <code>path</code>, and <code>connect</code>. Pass <code>dashed=True</code> for the standard <code>\"6,3\"</code> pattern, or <code>dashed=\"4,3\"</code> for a custom dash pattern. This replaces the old <code>extra='stroke-dasharray=\"...\"'</code> spelling (which still works for backward compatibility).</li>\n<li><strong>Low-level entry</strong>: <code>drawer.line(..., register_edge=True)</code> / <code>drawer.path(..., register_edge=True, start=..., end=...)</code> can also manually register edges (for curves, <code>start/end</code> are the semantic endpoints; <code>d</code> can be any path).</li>\n<li><strong><code>group(transform)</code> context</strong>: nodes/edges/bboxes drawn inside <code>with drawer.group(\"translate(100,50) rotate(30)\"):</code> are registered in <strong>absolute coordinates</strong> via the accumulated affine matrix, so local coordinates inside a group are also validated. Supports chained <code>matrix()/translate()/scale()/rotate()/skewX()/skewY()</code>.</li>\n<li><strong>Advanced shapes</strong> (ported from ink-graph <code>shapes.md</code>, local coordinates via <code>&lt;g transform&gt;</code>): <code>drawer.database(x,y,w,h,...)</code> (cylinder, top ellipse depth=min(8,h<em>0.12)), <code>drawer.decision(...)</code> (diamond, four points around center), <code>drawer.hexagon(...)</code> (gateway, 25% corner insets), <code>drawer.component(...)</code> (with left-edge double tabs), <code>drawer.cloud(...)</code> (multi-lobe cubic curves). All accept <code>node_id/role/label</code>, register nodes consistently with <code>rect()</code>/<code>circle()</code>, and support connection snapping. Text centering uses <code>dominant-baseline=\"central\"</code> (exact, replacing the old y+0.35</em>fs approximation).</li>\n<li><strong>Semantic role <code>role=</code></strong> (optional): <code>rect/circle/connect/line/path</code> all accept <code>role=\"node|edge|decoration|legend|background|layer\"</code>. Elements set to <code>decoration</code>/<code>legend</code>/<code>background</code> emit a <code>data-graph-role</code> attribute and are <strong>excluded from business checks</strong> (spacing, collision, palette count) — used for decorative layers (rail casings, background textures, legends). <code>role=\"layer\"</code> marks tinted band containers: they emit <code>data-graph-role=\"layer\"</code> and are the primary signal for band detection in the design-brief layout check (pair each with a <code>node_id=</code> that matches a <code>palette_role</code> key). Default <code>node</code>/<code>edge</code> means business elements.</li>\n<li><strong>Math formulas with sub/superscripts</strong>: <code>drawer.formula(x, y, markup, font_size=, fill=, anchor=, weight=)</code> renders genuine <code>&lt;tspan&gt;</code> baseline shifts — unlike <code>text()</code> (which HTML-escapes content and can only show literal underscores/carets). Markup: <code>_{...}</code> → subscript, <code>^{...}</code> → superscript; baseline auto-resets between tokens so multiple indices align (e.g. <code>\"F_{k} = MS^{↑}_{k} + g_{k}\"</code>). Default monospace family + bold for an equation look; pass <code>weight=\"normal\"</code> for inline annotations. The sub/superscript glyph sizes (~0.72×) are derivative of the parent text size and are <strong>excluded from the font-tier count</strong> (see <code>check_font_scale</code>), so formulas do not inflate the 3–4-tier typography budget. (Note: <code>svg2pptx</code> concatenates <code>&lt;tspan&gt;</code> text flat — use image mode if you need exact subscript fidelity in PowerPoint.)</li>\n</ul>\n<blockquote>\n<p><strong>\"Invisible anchor\" anti-pattern (now forcefully blocked)</strong>: it used to be possible to create <code>fill=\"none\" stroke=\"none\"</code> invisible rectangles to cheat the connection validation — the evaluator would pass, but the human eye would see dangling lines. Now <code>check_phantom_anchors()</code> detects any node referenced by an edge that is invisible (<code>fill=none ∧ stroke=none</code>/opacity=0/zero-size) and flags it as FAIL. When you need a \"bus rail\" or cross-layer channel, use the distinct-port pattern below to connect to a visible junction.</p>\n</blockquote>\n<blockquote>\n<p><strong>Distinct-port / junction pattern</strong> (cross-layer aggregation, side channels): place visible circular junction nodes at the channel position, connect each real component to the junction with a short solid line <code>connect(layer, \"left\", junction, \"right\")</code>, then chain them into a rail with dashed lines <code>connect(junction, \"bottom\", junction2, \"top\", dashed=True)</code>. This way each rail segment lands between real visible nodes — passing validation while remaining clear to humans.</p>\n</blockquote>\n<blockquote>\n<p>Tip: container-type large rectangles (Module/Layer) enter bbox collision and coverage stats by default; for interior small elements (text, operation nodes), pass <code>bbox=False</code> to avoid false overlap reports or inflated coverage.</p>\n</blockquote>\n<h2>Design Specifications</h2>\n<ul>\n<li><strong>Font-size tiers</strong>: use only 3-4 tiers per diagram (title 20 / section header 14 / body 12 / note 10), adjacent tiers ≥1.15× apart (modular type scale). Exceeding this triggers an evaluator warning.</li>\n<li><strong>Palette</strong>: pick by <strong>information need</strong> (see <code>references/design_specs.md</code> and the per-type table in <code>references/diagram_types.md</code>) — S2 Categorical when 2–4 classes / branches / roles need hue, S3 Semantic for fixed component types (cloud / network), S4 Duotone for one focal element, S1 Monochrome Blue only as the fallback for pure layering with no categorical role. Do <strong>not</strong> reflex-default to S1 — it makes every diagram blue. All schemes pre-verified (accent ≤12, no luminance clash). Op cards stay <code>fill=\"white\"</code>; color lives in layer fills + borders — and it must own the structure: at least one chromatic accent (无配色 floor) AND enough chromatic weight that the skeleton doesn't read gray (灰色主导: &lt;35% of elements AND &lt;15% of painted area FAILs; tint the containers or color the primary nodes). Background defaults to white (<code>SVGDrawer(bg=\"#FFFFFF\")</code>); only use <code>set_background()</code> for dark themes.</li>\n<li><strong>Color &amp; typography</strong>: see <code>references/design_specs.md</code>.</li>\n<li><strong>Shapes &amp; layout per type</strong>: when the user names a diagram type (architecture / flowchart / ML model / ER / sequence / swimlane / network), apply the matching preset in <code>references/diagram_types.md</code> — it maps each semantic role to a primitive (<code>rect</code> / <code>database</code> / <code>decision</code> / <code>hexagon</code> / <code>component</code> / <code>cloud</code>) and gives direction + spacing defaults that pass the evaluator.</li>\n<li><strong>Stability</strong>: prefer relative layout logic (i.e. compute new component positions based on known component coordinates).</li>\n<li><strong>Entity escaping</strong>: SVG is strict XML — never use HTML entities in text (<code>&amp;middot;</code>/<code>&amp;mdash;</code> etc. are rejected by the parser). Use Unicode characters (<code>·</code> <code>—</code>) or <code>html.escape</code> instead.</li>\n</ul>\n<h2>Example: Generation with Evaluation</h2>\n<pre><code>import sys\n# Resolve the skill scripts dir relative to this file (see $SKILL note above).\nsys.path.append(os.path.join(os.path.dirname(__file__), \"..\", \"..\", \"scripts\"))\nfrom svg_utils import SVGDrawer, save_svg\nfrom evaluator import evaluate_svg\nfrom pathlib import Path\n# Write outputs next to this script (see \"Output Layout Convention\" below).\nOUT = Path(__file__).resolve().parent\n\ndrawer = SVGDrawer(1200, 800, bg=\"#FFFFFF\")   # white background is the default; change only for dark themes\ndrawer.arrow_head(\"arrowhead\", \"#333\")\n\n# Nodes (Scheme S1 Monochrome Blue — L1 tier; see design_specs.md for the full library)\ndrawer.rect(100, 100, 90, 34, fill=\"#D5E1EB\", stroke=\"#1B3A5C\",\n            node_id=\"a\", node_kind=\"op\", bbox=False)\ndrawer.rect(300, 100, 90, 34, fill=\"#D5E1EB\", stroke=\"#1B3A5C\",\n            node_id=\"b\", node_kind=\"op\", bbox=False)\n\n# Edges: endpoints auto-snap to node borders, arrows land precisely on the edge\ndrawer.connect(\"a\", \"right\", \"b\", \"left\",\n               stroke=\"#1B3A5C\", marker_end=\"arrowhead\", edge_label=\"value\")\n\n# Evaluation (includes connection/arrow validation)\nscore, report = evaluate_svg(drawer)\nprint(f\"Quality Score: {score}\")\nfor line in report:\n    print(line)\n\nif score &gt;= 80:\n    save_svg(drawer.render(), str(OUT / \"diagram.svg\"))\nelse:\n    print(\"Score too low, need adjustment.\")\n</code></pre>\n<h2>Output Layout Convention</h2>\n<p>Every diagram generation is <strong>self-contained in its own subdirectory</strong> under <code>output/</code>. One diagram = one directory; the generator script and its SVG/PNG/PPTX triplet live together.</p>\n<pre><code>output/&lt;timestamp&gt;_&lt;name&gt;/\n- gen_&lt;name&gt;.py        # generator script (version-controlled source)\n- &lt;name&gt;.svg           # -\n- &lt;name&gt;.png           #  |- triplet, regenerated in place on each run\n- &lt;name&gt;.pptx          # -\n</code></pre>\n<p><strong>Rules:</strong></p>\n<ul>\n<li><strong>Script and outputs are co-located.</strong> The <code>gen_*.py</code> lives <em>inside</em> its <code>output/&lt;ts&gt;_&lt;name&gt;/</code> directory — never in the repo root, never scattered away from its artifacts. Deleting the directory removes script + outputs together.</li>\n<li><strong>Write to the script's own directory, not a fresh timestamped dir per run</strong> — re-running refreshes the triplet in place rather than accumulating duplicate directories:\n<pre><code>from pathlib import Path\nOUT = Path(__file__).resolve().parent   # this script's own directory\nNAME = \"&lt;name&gt;\"\n</code></pre>\n</li>\n<li><strong>The <code>&lt;timestamp&gt;_&lt;name&gt;</code> directory name is frozen at creation</strong> (a born-on date); it is not regenerated on each run.</li>\n<li><strong>Always emit the full quartet</strong> — SVG (<code>save_svg</code>), PNG (<code>rasterize_svg</code>, wraps <code>rsvg-convert</code>), PPTX (<code>svg2pptx.svg_to_pptx</code>), and <code>brief.json</code> (<code>BRIEF.write(...)</code>, the declared design contract) — so the directory is self-describing.</li>\n<li><strong>Artifacts are gitignored by extension</strong> (<code>**/*.svg</code>, <code>**/*.png</code>, <code>**/*.pptx</code>); the <code>gen_*.py</code> scripts stay version-controlled. Never gitignore the whole output directory — that hides the scripts.</li>\n</ul>\n<h3>The save/rasterize helpers</h3>\n<p><code>save_svg()</code>, <code>rasterize_svg()</code>, and <code>svg2pptx.svg_to_pptx()</code> write wherever you ask — they create parent directories as needed and impose no layout constraint. A prior version enforced an <code>output/&lt;task&gt;/</code> directory at the library boundary (<code>validate_output_path</code> / <code>OutputPathError</code>); that was removed for the public release because it refused legitimate cross-project and temporary paths.</p>\n<pre><code>from svg_utils import save_svg, rasterize_svg\n\nsave_svg(content, OUT / \"diagram.svg\")      # writes, mkdir -p the parent\nrasterize_svg(OUT / \"diagram.svg\", OUT / \"diagram.png\", width=1200)\n</code></pre>\n<ul>\n<li><code>save_svg(content, filename)</code> — writes SVG <em>content</em> to <em>filename</em>, creating parents; returns the resolved path.</li>\n<li><code>rasterize_svg(svg_path, png_path, width)</code> — runs <code>rsvg-convert -w &lt;width&gt;</code>; creates parents; returns the PNG path.</li>\n<li><code>svg2pptx.svg_to_pptx(svg, pptx_path, config=None)</code> — converts to PPTX; creates parents.</li>\n</ul>\n<blockquote>\n<p>Prefer these wrappers over a raw <code>subprocess.run([\"rsvg-convert\", ...])</code> so path handling stays uniform.</p>\n</blockquote>\n<h2>SVG to PPTX Export (svg2pptx)</h2>\n<p>After generating an SVG, you can export it to an <strong>editable PowerPoint file</strong> with one call. The module <code>$SKILL/svg2pptx.py</code> parses SVG elements into native PowerPoint shapes (rectangles, ovals, connectors, text boxes, freeforms) rather than embedding an image — so each element can be individually resized, recolored, and edited in PowerPoint/Keynote/LibreOffice. Inspired by the <a href=\"https://github.com/benouinirachid/svg2pptx\">svg2pptx</a> project.</p>\n<h3>Two Export Modes</h3>\n<table>\n<thead>\n<tr>\n<th>Mode</th>\n<th>Parameter</th>\n<th>Effect</th>\n<th>Use Case</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>shapes</strong> (default)</td>\n<td><code>mode=\"shapes\"</code></td>\n<td>Each element → an independent editable shape</td>\n<td>Architecture diagrams you want to fine-tune in PPT</td>\n</tr>\n<tr>\n<td><strong>image</strong></td>\n<td><code>mode=\"image\"</code></td>\n<td>Rasterize to PNG and embed (100% visual fidelity)</td>\n<td>Complex SVGs for display only, no editing needed</td>\n</tr>\n</tbody>\n</table>\n<h3>API</h3>\n<pre><code># sys.path was set above in the Example section ($SKILL = scripts directory)\nfrom svg2pptx import svg_to_pptx, PptxConfig, save_pptx\n\n# Option 1: SVG string → PPTX (most common, takes drawer.render())\nsvg_to_pptx(drawer.render(), OUT / \"diagram.pptx\")\n\n# Option 2: SVG file → PPTX (file must end with .svg, otherwise parsed as an SVG string)\nsvg_to_pptx(OUT / \"diagram.svg\", OUT / \"diagram.pptx\")\n\n# Option 3: Export directly from an SVGDrawer (equivalent to Option 1)\nsave_pptx(drawer, OUT / \"diagram.pptx\")\n\n# Custom config: 16:9 slide, 2x scale, shapes mode\nsvg_to_pptx(OUT / \"diagram.svg\", OUT / \"diagram.pptx\",\n            config=PptxConfig(slide_w=13.333, slide_h=7.5, scale=2.0))\n\n# Image mode (rasterized embed, requires rsvg-convert)\nsvg_to_pptx(OUT / \"diagram.svg\", OUT / \"diagram.pptx\", config=PptxConfig(mode=\"image\"))\n\n# Add to an existing presentation's slide (no new file created)\n# Note: add_svg_to_slide only supports shapes mode, not image rasterization\nfrom svg2pptx import add_svg_to_slide\nadd_svg_to_slide(drawer.render(), slide, x=1.0, y=0.5, scale=0.8)\n</code></pre>\n<h3>SVG → PPTX Element Mapping</h3>\n<table>\n<thead>\n<tr>\n<th>SVG Element</th>\n<th>PPTX Shape</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>&lt;rect rx=0&gt;</code></td>\n<td>Rectangle</td>\n<td>Auto shape; <strong>rotates correctly</strong> inside a rotated <code>&lt;g&gt;</code></td>\n</tr>\n<tr>\n<td><code>&lt;rect rx&gt;0&gt;</code></td>\n<td>Rounded Rectangle</td>\n<td>Corner radius auto-mapped; <strong>rotation</strong> also handled</td>\n</tr>\n<tr>\n<td><code>&lt;circle&gt;</code> / <code>&lt;ellipse&gt;</code></td>\n<td>Oval</td>\n<td>Ellipse/circle; <strong>rotation</strong> handled correctly</td>\n</tr>\n<tr>\n<td><code>&lt;line&gt;</code></td>\n<td>Connector (Straight)</td>\n<td>Straight-line connector</td>\n</tr>\n<tr>\n<td><code>&lt;polygon&gt;</code></td>\n<td>Freeform (closed)</td>\n<td>Polygon → freeform</td>\n</tr>\n<tr>\n<td><code>&lt;polyline&gt;</code></td>\n<td>Freeform (open)</td>\n<td>Polyline → freeform</td>\n</tr>\n<tr>\n<td><code>&lt;path&gt;</code></td>\n<td>Freeform</td>\n<td><strong>Bezier/Arc auto-flattened</strong> to line segments (<code>curve_tolerance</code> controls precision)</td>\n</tr>\n<tr>\n<td><code>&lt;text&gt;</code> / <code>&lt;tspan&gt;</code></td>\n<td>Text Box</td>\n<td>Preserves font/size/color/alignment, CJK works; <code>&lt;tspan&gt;</code> child text is auto-concatenated</td>\n</tr>\n<tr>\n<td><code>&lt;g transform&gt;</code></td>\n<td>Coordinate transform</td>\n<td><strong>Accumulated affine matrix</strong> (translate/scale/rotate) applied to all child shapes</td>\n</tr>\n<tr>\n<td><code>marker-end</code></td>\n<td>Freeform triangle</td>\n<td><strong>Arrow auto-rendered</strong>: draws a triangle at the segment endpoint based on marker geometry</td>\n</tr>\n<tr>\n<td><code>fill-opacity</code></td>\n<td>Transparency</td>\n<td>Implemented via <code>&lt;a:alpha&gt;</code> XML injection (python-pptx does not support this natively)</td>\n</tr>\n<tr>\n<td><code>stroke-dasharray</code></td>\n<td>Dashed line</td>\n<td><code>prstDash</code> or <code>custDash</code> XML injection</td>\n</tr>\n</tbody>\n</table>\n<h3>Limitations</h3>\n<ul>\n<li><strong>Gradients</strong> are not supported (the first color is used).</li>\n<li><strong>Filters/effects</strong> (blur, shadow) are not supported (shape shadows are disabled by default).</li>\n<li><strong>Bezier curves</strong> are flattened to line segments (lower <code>curve_tolerance</code> = smoother, default 1.0px).</li>\n<li><strong>Font scaling</strong>: font size scales proportionally with the fit-to-slide <code>scale</code> (<code>Pt(fs * scale * 72/96)</code>) — i.e. a large canvas mapped to a small slide shrinks text, and vice versa. The text-to-box ratio always stays consistent. To fix the font size, set <code>scale=1.0</code> and adjust <code>slide_w/slide_h</code> yourself.</li>\n<li><strong><code>add_svg_to_slide</code></strong> only supports shapes mode (no image rasterization); for image mode use <code>svg_to_pptx</code>.</li>\n<li><strong>Image mode</strong> requires <code>rsvg-convert</code> (installed on this system); shapes mode only requires <code>python-pptx</code>.</li>\n</ul>\n<h2>Capabilities</h2>\n<p>All detection/export capabilities parse the actually-rendered SVG (<code>evaluate, don't assert</code>), so they work equally well for raw <code>add_element</code> drawing.</p>\n<table>\n<thead>\n<tr>\n<th>#</th>\n<th>Capability</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>①</td>\n<td>Containment-aware collision</td>\n<td>Parent-child nesting does not count as a collision</td>\n</tr>\n<tr>\n<td>②</td>\n<td>Phantom anchor detection</td>\n<td>Nodes referenced by edges but invisible → FAIL</td>\n</tr>\n<tr>\n<td>③</td>\n<td>Edge × edge crossing</td>\n<td>Two edge segments intersecting internally</td>\n</tr>\n<tr>\n<td>④</td>\n<td>Marker depth auto-derivation</td>\n<td><code>(markerWidth−refX)×stroke</code></td>\n</tr>\n<tr>\n<td>⑤</td>\n<td>Font-size tier detection</td>\n<td>Parses SVG, ≤4 tiers, adjacent tiers ≥1.15× apart</td>\n</tr>\n<tr>\n<td>⑥</td>\n<td>Palette detection</td>\n<td>Accent ≤8/12, ≥1 chromatic (无配色 floor), and color owns the structure (灰色主导: FAIL when chromatic coverage &lt;35% of elements AND &lt;15% of painted area — one strong axis suffices); background defaults to light</td>\n</tr>\n<tr>\n<td>⑦</td>\n<td>Curve bezier/arc sampling</td>\n<td>Ported from fireworks <code>path_routes</code></td>\n</tr>\n<tr>\n<td>⑧</td>\n<td>Luminance conflict by channel</td>\n<td>Fill/stroke checked separately for dark+light coexistence</td>\n</tr>\n<tr>\n<td>⑨</td>\n<td>Transform matrix accumulation</td>\n<td><code>group()</code> context</td>\n</tr>\n<tr>\n<td>⑩</td>\n<td><code>data-graph-role</code> semantic roles</td>\n<td>decoration/legend/background skip business checks</td>\n</tr>\n<tr>\n<td>⑪</td>\n<td>Coverage bbox union</td>\n<td>Sweep-line algorithm</td>\n</tr>\n<tr>\n<td>⑫</td>\n<td>Text overflow detection</td>\n<td>Parses <code>&lt;text&gt;</code> geometry</td>\n</tr>\n<tr>\n<td>⑬</td>\n<td>Composition quality budget</td>\n<td>bend≤2/stretch≤1.35/gutter≥20/segment≥16 + text as obstacle</td>\n</tr>\n<tr>\n<td>⑭</td>\n<td>Node shape library</td>\n<td>database/decision/hexagon/component/cloud</td>\n</tr>\n<tr>\n<td>⑮</td>\n<td>Barycenter crossing minimization</td>\n<td>Ported from DiagramForge: reorder by barycenter within layers</td>\n</tr>\n<tr>\n<td>⑯</td>\n<td><code>auto_refine</code> auto-correction</td>\n<td>Reads eval report, iteratively fixes gutter/spacing by issue code</td>\n</tr>\n<tr>\n<td>⑰</td>\n<td>SVG→PPTX export</td>\n<td>Native editable shapes + rasterized image dual modes, arrow rendering, Bezier/Arc flattening, transparency/dash injection</td>\n</tr>\n<tr>\n<td>⑱</td>\n<td>Text-vs-shape &amp; text-vs-text overlap</td>\n<td>Parses rendered SVG: <code>&lt;text&gt;</code> bbox vs visible circles/rects/polygons/lines/paths + text vs text; closes the bbox-registry blind spot (<code>bbox=False</code>/<code>add_element</code>)</td>\n</tr>\n<tr>\n<td>⑲</td>\n<td>Formula rendering (sub/superscript)</td>\n<td><code>drawer.formula()</code> emits real <code>&lt;tspan&gt;</code> baseline shifts for <code>_{}</code>/<code>^{}</code> markup; evaluator strips markup in width estimates and counts only <code>&lt;text&gt;</code>-tier font sizes so subscripts don't inflate the tier budget</td>\n</tr>\n<tr>\n<td>⑳</td>\n<td>Text-on-fill contrast (WCAG 2)</td>\n<td><code>check_contrast</code>: ratio of each <code>&lt;text&gt;</code> fill vs its smallest containing <code>&lt;rect&gt;</code> fill — FAIL &lt;3:1, WARN &lt;4.5:1 (AA) / 3:1 large (≥24px / ≥18.5px bold); only accent fills measured, accent text on neutral canvas skipped</td>\n</tr>\n<tr>\n<td>㉑</td>\n<td>Same-kind peer alignment</td>\n<td><code>check_alignment</code>: same-sized same-kind nodes in a row/column must share a top/bottom/left/right edge (±5px) or a center line (±15%); differently-sized peers exempt</td>\n</tr>\n<tr>\n<td>㉒</td>\n<td>Semantic QA (<code>semantic_qa.py</code>)</td>\n<td>Meaning-level smoke check after scoring: dangling marker refs (marker 缺省陷阱, FAIL), defined-but-unused markers (WARN), declared-vs-actual canvas size drift (FIGS 尺寸漂移), label/host mismatch (标签错位), raw rails slicing filled containers or cards (箭头线盖在组件上), text semantics vs spec (placeholder/garbled/empty FAIL; spec-entity coverage &lt;40% FAIL / &lt;85% WARN) — parses the rendered SVG incl. grouped shapes, composite arcs, and stroke widths</td>\n</tr>\n<tr>\n<td>㉓</td>\n<td>Design-brief contract (<code>design_brief.py</code> + <code>check_design_brief</code>)</td>\n<td>Step-1 declared intent as data: <code>DesignBrief(scheme, layout band|node, flow top-down|left-right|none, palette_role {data-node-id: (fill,stroke)}, flow_chain)</code>. The rendered SVG is asserted against it — declared tint gone white FAIL, wrong/undeclared paint WARN, empty declared band FAIL, side-band-in-chain chain-broken FAIL, ≥70% inter-layer flow dominance (return edges tolerated), chain degree rules, declared order vs geometry. Absent brief → visible WARN. Capability boundary: verifies rendering ↔ self-declared contract, not contract ↔ user intent</td>\n</tr>\n</tbody>\n</table>\n<h2>References &amp; Acknowledgments</h2>\n<p>This Skill's geometry/connection detection draws on the following open-source projects (their references and validator implementations were actually studied):</p>\n<ul>\n<li><strong>ink-graph</strong> (<code>qaz1230sp/ink-graph</code>): its references/pitfalls.md #2 (arrow occluded by node → retract endpoint 8px), #3/#10 (edge crossing through node → 20px gap bypass), #17 (fan-out alignment), #26 (marker size proportional to stroke), #29 (fan-out/fan-in + junction dot); its references/shapes.md <code>dominant-baseline=\"central\"</code> centering, its references/layout-rules.md grid/spacing rules. <strong>Measured each of its <code>style-*.md</code> at exactly 3-4 font tiers, 4-13 palette colors</strong> — empirical basis for the font-tier/palette thresholds. <em>(These files live in the ink-graph repo, not this skill.)</em></li>\n<li><strong>fireworks-tech-graph</strong> (<code>yizhiyanhua-ai/fireworks-tech-graph</code>): its references/composition-quality-contract.md (executable budget: zero crossings/≤2 bends/≥40px node spacing/≥20px container gutter); its scripts/validate_svg.py <code>find_collisions</code> + <code>segment_hits_bounds</code> (path sampling vs node bbox), <code>data-graph-role</code> semantic roles, transform matrix accumulation, \"evaluate, don't assert\" (parse actual SVG rather than trusting API calls). <em>(Files live in the fireworks repo, not this skill.)</em></li>\n<li><strong>svg-animations</strong> (<code>supermemoryai/skills</code>): SMIL/CSS animation basics and <code>stroke-dasharray</code> stroke animation recipes (this Skill does not enable animation yet, reserved for later).</li>\n<li><strong>svg-design</strong> (<code>tryopendata/skills</code>): primitive-first (circles use <code>&lt;circle&gt;</code>), <code>stroke-linecap=\"round\"</code>, strict XML with no HTML entities, and other hygiene conventions.</li>\n<li><strong>svg2pptx</strong> (<code>benouinirachid/svg2pptx</code>): architectural blueprint for the PPTX export module. Its \"SVG element → PowerPoint native editable shape\" philosophy (rect→rectangle, circle→oval, line→connector, path→freeform, text→textbox), Config dataclass design, <code>build_freeform</code> + <code>add_line_segments</code> usage, and Bezier flattening tolerance parameter were all adapted into the self-contained <code>scripts/svg2pptx.py</code> module (which adds arrow marker rendering, <code>fill-opacity</code> transparency injection, <code>stroke-dasharray</code> dash injection, and an image rasterization fallback mode).</li>\n</ul>\n","files":[{"path":"evals/20260728_120000_mlir_pipeline/brief.json","sizeBytes":705,"isText":true},{"path":"evals/20260728_120000_mlir_pipeline/gen.py","sizeBytes":16757,"isText":true},{"path":"evals/20260728_120000_mlir_pipeline/input.md","sizeBytes":2543,"isText":true},{"path":"evals/20260728_153000_agent_infra_architecture/brief.json","sizeBytes":887,"isText":true},{"path":"evals/20260728_153000_agent_infra_architecture/gen.py","sizeBytes":12093,"isText":true},{"path":"evals/20260728_153000_agent_infra_architecture/input.md","sizeBytes":2855,"isText":true},{"path":"evals/20260728_203836_llm_inference_arch/brief.json","sizeBytes":1025,"isText":true},{"path":"evals/20260728_203836_llm_inference_arch/gen.py","sizeBytes":15898,"isText":true},{"path":"evals/20260728_203836_llm_inference_arch/input.md","sizeBytes":3099,"isText":true},{"path":"evals/20260728_2157_satellite_arch/brief.json","sizeBytes":541,"isText":true},{"path":"evals/20260728_2157_satellite_arch/gen.py","sizeBytes":12282,"isText":true},{"path":"evals/20260728_2157_satellite_arch/input.md","sizeBytes":2779,"isText":true},{"path":"evals/20260729_llama_cpp_arch/brief.json","sizeBytes":470,"isText":true},{"path":"evals/20260729_llama_cpp_arch/gen.py","sizeBytes":9505,"isText":true},{"path":"evals/20260729_llama_cpp_arch/input.md","sizeBytes":1388,"isText":true},{"path":"evals/20260729_pi_agent_architecture/brief.json","sizeBytes":575,"isText":true},{"path":"evals/20260729_pi_agent_architecture/gen.py","sizeBytes":8221,"isText":true},{"path":"evals/20260729_pi_agent_architecture/input.md","sizeBytes":2300,"isText":true},{"path":"evals/20260730_vllm_arch/brief.json","sizeBytes":553,"isText":true},{"path":"evals/20260730_vllm_arch/gen.py","sizeBytes":10474,"isText":true},{"path":"evals/20260730_vllm_arch/input.md","sizeBytes":2223,"isText":true},{"path":"evals/20260802_100000_cicd_pipeline_flow/brief.json","sizeBytes":1373,"isText":true},{"path":"evals/20260802_100000_cicd_pipeline_flow/gen.py","sizeBytes":12521,"isText":true},{"path":"evals/20260802_100000_cicd_pipeline_flow/input.md","sizeBytes":2610,"isText":true},{"path":"references/api_quickref.md","sizeBytes":2679,"isText":true},{"path":"references/checks_cheatsheet.md","sizeBytes":7259,"isText":true},{"path":"references/design_specs.md","sizeBytes":6792,"isText":true},{"path":"references/diagram_types.md","sizeBytes":13168,"isText":true},{"path":"references/gen_template.md","sizeBytes":3137,"isText":true},{"path":"scripts/design_brief.py","sizeBytes":7328,"isText":true},{"path":"scripts/evaluator.py","sizeBytes":73745,"isText":true},{"path":"scripts/semantic_qa.py","sizeBytes":56615,"isText":true},{"path":"scripts/svg2pptx.py","sizeBytes":44882,"isText":true},{"path":"scripts/svg_utils.py","sizeBytes":57512,"isText":true},{"path":"SKILL.md","sizeBytes":46557,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-03T16:07:24.708256Z","sha256":"AD603977BF4B69E757F7D5B279E5E815C29123F493F5EAD83953A9FA53223EB8","sizeBytes":160700},"review":null,"source":{"repositoryUrl":"https://github.com/Andy1314Chen/architecture-drawer","path":"plugins/architecture-drawer/skills/architecture-drawer","license":"MIT","commit":"3f5fb5a8bcd3e024c9358dd1ce9fc73503f646b0","subtreeSha":"5231780B1E16CC0D6313489B7DB6BED4D455EA90DD9032F4389F18345B53B6FA","lastSyncedAt":"2026-11-16T00:39:47.266483Z"},"reviewedAt":"2026-09-03T16:12:28.501492Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/Andy1314Chen/architecture-drawer/tree/main/plugins/architecture-drawer/skills/architecture-drawer"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install andy1314chen-architecture-drawer@llmmart"},{"target":"git","command":"git clone https://github.com/Andy1314Chen/architecture-drawer.git"}]}