--- name: composing-html description: Composes single-file HTML artifacts (PR review writeups, status reports, incident postmortems, slide decks, design systems, prototypes, flowcharts, module maps, feature explainers, kanban boards, prompt tuners) from a small JSON spec instead of hand-written HTML/CSS/JS. Use when the user asks to "compare options side-by-side", requests an HTML version of a report or review or deck, asks for a flowchart, status update, postmortem, design system reference, interactive prototype, custom editor — or explicitly says "HTML artifact", "single HTML file", "self-contained HTML". Skip for ad-hoc HTML snippets (forms, emails, embedded widgets) where there's no template fit. metadata: version: 0.5.0 --- # composing-html Produce single-file HTML artifacts without hand-writing the page chrome. The composer supplies ``, ``, inlined CSS, `base.js`, design tokens, masthead, and colophon. You supply a title and the body content. The product is the **chrome and inventory below** — primitives you can drop into any artifact without re-deriving what a card, badge, or eyebrow looks like. Templates are shortcuts on top of this, useful when the same artifact shape repeats; see [Templates](#templates-shortcuts-for-repeat-structure) near the end. ## Default workflow: freeform `freeform` gives you the whole chrome with one content slot — `body_html` — for the page body. Reach for it first. Reach for a template only when the structure repeats across artifacts (see [Templates](#templates-shortcuts-for-repeat-structure) near the end). There are two ways to invoke it. **Use the `--set` flow for anything with a substantial body** — it sidesteps the JSON-string escaping that bites heredoc-style spec writing (newlines, quotes, `<`/`&` inside multi-line HTML). ### Recommended: HTML in a file, metadata via `--set` ``` 1. Write the body to a .html file directly (no JSON, no escaping). 2. python scripts/build.py build freeform \ --set title='My Page' \ --set subtitle='Optional subhead' \ --set body_html=@body.html \ --out artifact.html ``` `--set KEY=VALUE` assigns a literal string; `--set KEY=@FILE` loads the file contents verbatim into that spec field. Repeat for any field. Works for `body_html`, `extra_css`, `extra_js`, `eyebrow`, `page_class`, and the same `*_html` fields in any other template (`summary_html`, `intro_html`, `details_html`, …). ### Spec-file workflow (best for structured templates) ``` 1. python scripts/build.py describe