Local-First: Turn Drafts into Publishable HTML with an AI Assistant

    Draft formats such as Markdown, CSV, and JSON are easy to edit and version, but readers expect finished HTML with layout, hierarchy, interaction, and brand presentation. This article explains a local-first workflow that reuses an already signed-in AI coding session to turn common drafts into publishable pages, with agent-style editing, a skill-by-scenario matrix, and quality gates.

    Treating a draft as a finished deliverable is one of the most common mismatches in content publishing. Markdown, CSV, and JSON are convenient for collaboration and version control, but what readers actually open is usually an HTML page where typography, hierarchy, interaction, and brand presentation are already in place. A local-first approach that reuses an AI coding session already signed in on the terminal can turn “any common input in, a publishable page out” into a repeatable workflow—without requesting a new cloud key for every conversion or sending sensitive drafts off the internal network.

    Why the finished product must be HTML

    Draft formats solve author-side problems: clear structure, easy diffs, and scriptability. Reader-side problems are different: type and line spacing, heading hierarchy, readable charts and tables, mobile layout, crop-safe print and share cards, and accessible semantic markup. A high-density draft preview still looks unfinished. Making HTML the only deliverable writes design constraints into the pipeline. Color, grid, component states, and responsive breakpoints can be versioned instead of restyled by hand every time.

    Local-first work also has security and cost implications. Documents, résumés, and internal reports often contain unpublished data. Reusing an AI coding assistant session that is already signed in on the machine avoids a second account system and reduces the risk of hard-coding keys into scripts or pasting full drafts into a public chat. For a team, the boundary stays clear: model inference happens in an authorized environment, and the output is static or lightly interactive HTML that can go through existing object storage, static hosting, or an internal portal.

    Agentic editing: treat “revise this page” as a plannable task

    Agentic HTML editing is not a one-shot “generate the whole page and stop.” It breaks the goal into checkable steps: parse the input structure, choose layout skills, generate semantic markup, fill in styles and responsive behavior, self-check against a scenario list, and revise locally from feedback. The assistant is the executor; the person is the reviewer. Is the title too long? Does the table wrap on a narrow screen? Does the color meet contrast requirements? Did draft syntax leak onto the page?

    In practice, fix three input contracts. Documents: title, summary, sections, citations, and formula placeholders. Tables: field names, types, summary rows, and a static stand-in when filtering or paging is needed. Structured data: how nested objects expand into cards, timelines, or dashboard blocks. With those contracts written down, output can be regression-tested. Missing fields should fail rather than drop columns silently. Unknown types should fall back to plain text rather than invent charts.

    A useful prompt is a task brief, not a vague request to “make it look nice”:

    1. Input: section Markdown + one metrics CSV
    2. Goal: single-page report HTML, semantic headings, TOC anchors, zebra-striped table, print-hidden nav
    3. Constraints: no external fonts or analytics scripts; narrow screens use cards instead of the table; contrast meets accessibility targets
    4. Acceptance: no leftover draft syntax; key figures match CSV row counts

    Local revisions should be agentic as well: “change only the header and the first table; leave the rest of the DOM untouched.” That avoids regenerating the whole page and losing paragraphs that were already tuned by hand.

    Skills and scenarios: cover delivery with a matrix, not a pile of templates

    Splitting capability into “skill × scenario” is more sustainable than maintaining dozens of unrelated templates. A skill is a composable unit: layout grid, vertical or horizontal CJK typesetting, data-table styling, infographic blocks, share-card safe areas, print pagination, or a light motion-frame sequence. A scenario is the delivery context: a long academic piece, a talk outline, a résumé, an event poster, a short content card, a web prototype, a data report, or a frame-sequence preview. The same “table styling” skill emphasizes alignment and notes in a report, fewer columns and larger type on a poster, and clickable hotspot hints in a prototype.

    Long-form pages should favor semantics and reading rhythm: article and section, a table of contents, footnotes, and a clear contrast between code blocks and quotations. Do not drop presentation-style color blocks onto a paper. Talks work the other way: one idea per page, very large type, and speaker notes that can be hidden. Résumés should stay restrained and highlight a timeline plus scannable skill tags. Posters and short cards need platform crop-safe areas, with the main message centered so edges are not cut off. Web prototypes should use real spacing and states (default, hover, disabled) without pretending a backend is connected. Data reports should put “number source and update time” in the footer so a polished shell does not hide unclear definitions. Sequence or “super-frame” previews fit static HTML plus a CSS timeline of key frames better than a complex player before review.

    Skills should be switchable. Remote fonts and tracking scripts stay off by default; brand fonts are turned on explicitly, with licensing noted. Motion defaults to CSS transitions so a report does not become an unprintable animation.

    Delivery flow and quality gates

    A practical pipeline is: normalize input, route by scenario, generate, run static checks, sample manually, then publish. Normalization covers character encoding, unique table headers, and Markdown headings that do not skip levels. Scenario routing can use file-header metadata or directory conventions so the choice does not have to be restated every time. Static checks should at least cover leftover draft markers, image alt text, contrast, unique titles, and whether print layout is cropped. Manual review checks whether the information is correct, not only whether it looks good.

    Keep the handoff to cloud resources generic: pages and assets go to object storage or a static site; access logs and alerts use the existing logging and monitoring setup; large report files can run a conversion job on a container platform and then emit HTML. Do not commit assistant session keys. For internal documents, separate the machine that generates from the machine that publishes, and keep only necessary data in the artifact.

    Common failures include rendering an entire raw JSON document as an unreadable tree, adding heavy scripts for effect, and reusing one type scale so a résumé looks like a poster. The countermeasures are scenario defaults, a skill allowlist, and reconciliation of figures against the source file. When iterating, change skill parameters—spacing, grid, component density—rather than redescribing taste from scratch each time.

    Summary

    Markdown and structured data are efficient drafts. HTML is the reader-facing product. Agentic editing with a locally signed-in AI coding assistant can fold parsing, layout, scenario fit, and revision into one reviewable path. That lowers the cost of keys and of sending data outward, and it lets papers, talks, résumés, cards, prototypes, and reports share one skill matrix. With input contracts, quality gates, and the publish path written down, a polished page stops being a one-time generation gamble and becomes a repeatable engineering output.