/prometheus-skills-mini:convert-htmx-pdffrom prometheus-skills-mini
Convert a branded HTML/HTMX artifact into a paginated, print-correct PDF via headless Chromium — with embedded fonts, a running header and page numbers, pagination discipline that prevents orphaned pages and split components, and a verification loop that proves the output before it ships.
Ships in prometheus-skills-mini. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Deterministic HTML → PDF conversion that preserves the browser rendering. Chromium is the
renderer, because it is the only engine that reproduces modern CSS — grid, flexbox,
print-color-adjust, and web fonts — the same way the artifact was authored.
Do not reach for WeasyPrint, pdfkit, or wkhtmltopdf here. Their CSS support diverges from the browser in exactly the areas branded artifacts depend on, which defeats the purpose of converting a designed page.
artifact_type: pdfcontent_type: direct:pdfdata: URLs for images)The user will provide: $ARGUMENTS
Parse for:
--source <path-to-html> (required)--output <path-to-pdf> (required)--format Letter|A4|Legal|Tabloid (optional; default Letter)--landscape (optional)--margin <css-length> (optional; default 0.62in. Top is raised to 0.72in
automatically when the header is enabled, so it has room to draw)--header-left <text> / --header-right <text> (optional; enables the running header)--footer-left <text> (optional; page numbers always occupy footer-right)--no-header-footer (optional; suppresses both)--embed-fonts (optional; default on — see Font Embedding)--no-inject-print-css (optional; disables the baseline print stylesheet)--print-css <path> (optional; an additional print stylesheet appended after the baseline)--preview <path-to-png> (optional; rasterizes page 1 for visual verification)--verify (optional; default on — see Verification)Dispatch to the orchestration script:
node scripts/convert-htmx-pdf.mjs \
--source "${SOURCE}" \
--output "${OUTPUT}" \
--format "${FORMAT:-Letter}" \
${HEADER_LEFT:+--header-left "${HEADER_LEFT}"} \
${HEADER_RIGHT:+--header-right "${HEADER_RIGHT}"} \
${FOOTER_LEFT:+--footer-left "${FOOTER_LEFT}"} \
--preview "${PREVIEW:-/tmp/pdf-page-1.png}"
The script runs five stages in order. Each one exists because skipping it produced a visibly wrong PDF at least once.
External font loads are a render-time dependency, and a PDF built against a missing font substitutes silently. Substitution changes glyph widths, which changes line breaks, which changes pagination — so the PDF stops matching the artifact.
The script finds fonts.googleapis.com <link> tags, fetches the CSS with a browser
user-agent, keeps only the @font-face blocks whose unicode-range covers Latin or
Latin Extended, downloads each woff2, base64-inlines it as a data: URI, and replaces
the <link> with an inline <style>.
Dropping the non-Latin subsets matters — the unfiltered Inter + Roboto Slab + JetBrains
Mono set is 74 @font-face blocks and roughly 4 MB. Filtered, it is 22 blocks and
~1.4 MB, and the rendered output is identical for Latin text.
Fonts already inlined as data: URIs, or referenced by local path, are left alone.
A baseline @media print block is appended to the document. It is deliberately
conservative — it fixes what is always wrong and touches nothing else:
break-inside: avoid on callouts, tables, figures, cards, list items and code blocksbreak-after: avoid on headings, so a heading cannot be orphaned from its contentorphans: 3; widows: 3 on paragraphs and list itemsthead { display: table-header-group }, so long tables repeat their header-webkit-print-color-adjust: exact, so brand backgrounds surviveIt does not insert page breaks. Break placement is a per-artifact decision and belongs
in --print-css. See references/print-pagination.md for the canonical patterns and the
three failure modes.
Static checks against the source before rendering. These catch the errors that are expensive to diagnose from the finished PDF:
| Check | Why |
|---|---|
@page { margin: … } present while header/footer is enabled | The CSS wins. A margin in @page overrides the margins passed to the renderer, so the header draws into the text. The script strips the declaration and warns. |
break-before: page on more than a third of top-level sections | Forcing every section onto a fresh page produces near-empty pages wherever the previous section ends early. Warned, not blocked. |
| Unbalanced code fences or unclosed tags | A malformed document paginates unpredictably |
External <img src="http…"> or <link rel="stylesheet"> remaining | Render-time network dependency; the PDF is not reproducible |
Chromium via Playwright, emulate_media('print'), printBackground: true.
When a header or footer is requested the script uses Chromium's headerTemplate /
footerTemplate, which draw inside the page margin on every page. The footer carries
<span class="pageNumber"></span> / <span class="totalPages"></span> on the right.
Templates use system fonts only. Chromium renders header and footer in a separate
document that does not inherit the page's @font-face rules, so a branded font in a
template silently falls back — and the mismatch is visible.
Never declare a PDF finished without looking at it. The script runs four checks and writes a preview PNG of page 1:
| Check | Fails when |
|---|---|
| Content preservation | Extracted PDF text is under 90% of the source's visible word count — indicates clipped or dropped content |
| Page density | Any page below a word threshold (default 40, excluding the first and last) — indicates an orphan page from an over-aggressive break |
| Font embedding | pdffonts reports a font with emb: no — indicates a substitution |
| Text extraction | Zero extractable words — indicates the page rendered as images |
Open the preview and confirm it before reporting success. Density numbers catch structural faults; they do not catch a diagram rendering at the wrong scale.
printBackground on)Markdown → convert-md-to-htmx → branded HTML
↓
(optional) rebrand-artifact
↓
convert-htmx-pdf → paginated PDF
refine-validate may be run against the HTML before conversion. Conversion does not fix a
document whose structure is wrong; it makes the structure visible one page at a time.
artifact_type: pdf
content_type: direct:pdf
outputs:
- path: <output>.pdf
description: Paginated, print-correct PDF with embedded fonts
- path: <preview>.png
description: Page 1 raster for visual verification
constraints_satisfied:
- rendered_via_headless_chromium
- fonts_embedded_base64_latin_subset
- print_backgrounds_preserved
- running_header_and_page_numbers
- pagination_discipline_applied
- verification_loop_passed
Three that cost a rebuild each. All three are now checked, and all three are worth knowing because they present as design problems rather than configuration problems.
Content collides with the running header. Symptom: the first line of every page
overlaps the header text. Cause: @page { margin: 0 } in the artifact's print CSS, which
overrides the renderer's margins. Fix: keep @page to size only and let the renderer own
margins. Preflight strips this automatically.
A page renders nearly blank. Symptom: a page containing a heading and nothing else, or
three lines of a paragraph. Cause: break-before: page on a section whose predecessor
ended near the top of a page. Fix: restrict forced breaks to genuine structural
boundaries — a cover, a major part division, back matter — and let everything else flow.
Page-density verification catches this.
Type looks subtly wrong and line breaks differ from the browser. Cause: a font failed
to load and Chromium substituted. Fix: embed the fonts. pdffonts verification catches it.
scripts/convert-htmx-pdf.mjs — orchestration scriptreferences/print-pagination.md — canonical print stylesheet, break placement patterns,
cover-page recipe, and the header/footer template contractWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub prometheus-ags/prometheus-skills-mini --plugin prometheus-skills-mini106 skills in this plugin
/adversarial-reviewIsolated, cross-model adversarial review of KBD artifacts and change diffs. Dispatches a fresh-context LLM judge over an OpenAI-compatible REST gateway (openai-proxy or `liter-llm api`) with an explicit mandate to find problems — the model that produced an artifact or change is never the model that reviews it. Runs as a pipeline stage inside kbd-assess/analyze/plan (artifact mode) and kbd-execute's per-change QA gate (diff mode). Findings are severity-bucketed (CRITICAL/WARNING/SUGGESTION) and the judge's own report is screened by sycophancy-correction before it is surfaced.
/agent-team-creatorCreate, revise, package, and deploy agent-team definitions with staged questions and native exports for UAR, Codex, Claude Code, Copilot, Kimi Code, MiniMax CLI, OpenCode and DeepSeek. Use for team definition and catalog lifecycle; use agent-team-manage for active runtime task state./agent-team-handoffPrepare and accept a durable handoff between agent roles or coding harnesses using task context, Git identity, evidence and memory references. Use when work must continue in another harness or agent; use agent-team-manage for ordinary same-owner task updates. Do not use for ordinary same-owner task updates (see agent-team-manage).Other plugins' skills for the same job
3 plugins ship this exact skill · first indexed Jul 31, 2026