Repository navigation
feat(skills): add installable paper-templates skill and skills-lock tooling - #4121
karotkriss wants to merge 6 commits into
Conversation
…-lock index Package the two durable house print templates (A classic report, C two-column journal) as an installable agentskills.io skill: verbatim stylesheets with the %%SHORT%% running-header contract, the Paged.js polyfill and settle-wait render driver, the print color map with its completeness scan, the verification checklist, the known pitfalls from both production builds, and the two real transforms as worked examples. Index public skills in a root skills-lock.json generated by bin/fm-skills-lock.sh and kept honest by tests/skills-lock.test.sh.
Render the same invented excerpt in template A and productionized template C so a reader can see what each template produces without any real document content; build_samples.py reads the stylesheets from assets/ at build time and demonstrates the C productionizing recipe.
|
Closing: this was meant to be a local skill for the author's own machine, not an upstream change. No action needed. |
|
CI note: the required check |
Intent
Make the two durable house paper templates into an installable skill, and create that skill using the skill-creator skill. The recent journey PDF failed to follow either durable template precisely because the templates were not a skill yet. The durable pair, ruled on 2026-08-11, is style C, the two-column journal, which is the default house template for paper-style documents, and style A, the classic LaTeX-like report, the durable alternative that the journey papers shipped with; style B was reviewed and not adopted. The skill must carry the working reference material in substance: both labeled stylesheets with the %%SHORT%% running-header placeholder (Paged.js ignores string-set attr(), so the running header must be a literal string in the CSS), the Paged.js polyfill and the settle-wait headless-Chrome render driver (plain chrome --print-to-pdf races Paged.js pagination and has truncated a 28-page document to 7 pages), the print chart palette and the dark-to-print color mapping with its recolor-completeness scan, and the transform-and-verification knowledge from the three papers already produced with this pipeline (two journey papers and a go-live paper), including the defects found and fixed in the latest rebuild: an HTML entity leaking literally into CSS content in the running header, a near-empty page caused by break-inside avoidance on a table slightly taller than one page, a table-of-contents page number off by one when the anchor id sits on the section wrapper instead of the heading, an SVG label overrunning its viewBox under the serif font override, and a caption restating a note that already precedes its table. Standing view: never plain web-card styling for upward-facing documents; presentation is part of correctness.
What Changed
paper-templatesskill (skills/paper-templates/): aSKILL.mdplus both house stylesheets (template-c.csstwo-column journal default,template-a.cssclassic report alternate) carrying the literal%%SHORT%%running-header placeholder, the Paged.js v0.4.3 polyfill, the settle-waitrender.jsChrome driver, andreferences/covering the transform guide, print color map/recolor scan, verification checklist, worked flat/sectioned transform examples, and apitfalls.mdof the defects hit and fixed by this pipeline;samples/build_samples.pyrenders the checked-in sample-A/sample-C page PNGs.bin/fm-skills-lock.shto regenerate the rootskills-lock.json(folder-hash index ofskills/for the agentskills.ioskillsCLI), withtests/skills-lock.test.shfailing when the committed lock drifts from the tree, and register thepaper-templatesentry inskills-lock.json.README.md,docs/scripts.md, anddocs/documentation-audiences.jsonto document the new script and skill.Risk Assessment
✅ Low: Additive, self-contained public skill; all prior findings are verifiably resolved, the lock hash matches the tree, and the re-rendered C sample confirms the running header and folio actually appear on page 2.
Testing
Ran the targeted skills-lock test (passes), rebuilt the samples with build_samples.py to confirm template C productionizes from its own @page rules with the running-header placeholder substituted, and used the committed C preview PNGs as visual evidence that the running header and centered folio appear on page 2 while being suppressed on the title page - exactly the round-2 fix. I did not re-render the PDFs from scratch because the render toolchain is not installed in this environment (node puppeteer-core for render.js and pypdfium2/pillow for PDF-to-PNG are absent; bs4 is also absent but is only needed for real-document transforms, not the sample build); instead I verified the committed previews are produced by the current CSS by matching the rendered small-caps header text to the SHORT string substituted into template-c.css. Overall result: intent satisfied, no issues found, working tree left clean (transient generated HTML removed).
Evidence: skills-lock test result
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed (3) ✅
skills/paper-templates/samples/build_samples.py:100- shell() writes the sample HTML into samples/ with a relative<script src="paged.polyfill.js">, but samples/ contains no paged.polyfill.js (it lives in assets/). Following this file's own docstring (node render.js sample-a.html sample-a.pdf) the script 404s, Paged.js never runs, so.pagedjs_pagecount stays 0: render.js loops the full 180s timeout (its break requires n>0) and then emits an unpaginated PDF - a silent wrong result plus a 3-minute hang. This also contradicts SKILL.md step 3, which says to copy assets/paged.polyfill.js alongside the built HTML. Point the src at../assets/paged.polyfill.js(or copy the polyfill into samples/ during the build). Remedy corrects the helper without extending scope.tests/skills-lock.test.sh:22- test_lock_covers_every_skill asserts coverage with a raw substringgrep -q "\"$name\""over the generated skills-lock.json - the source-content-grep anti-pattern for declarative artifacts, which should be checked by parsing the JSON into a semantic model. It is also redundant: test_lock_matches_tree already invokes the real generator (fm-skills-lock.sh --check) and requires the committed lock to equal the regenerated tree output, which by construction includes an entry for every skill with a SKILL.md. Remove it or refine it to parse the JSON and assert the skills key set equals the skills/ directory set.🔧 Fix: fix sample polyfill path and drop redundant lock grep test
1 warning still open:
skills/paper-templates/assets/template-c.css:1- The intent marks as required substance "both labeled stylesheets with the %%SHORT%% running-header placeholder (Paged.js ignores string-set attr(), so the running header must be a literal string in the CSS)." template-c.css - the DEFAULT house template per SKILL.md - contains no %%SHORT%% placeholder and no @page rules at all (no size, margins, running header, or folio); it is only the .sC-scoped body stylesheet. SKILL.md line 24 and build_samples.py line 109 recover the header by borrowing template A's @page block (with %%SHORT%% already substituted) at productionization time, so the substance is carried via A rather than duplicated in C. This reads as deliberate design (C is the 'approved sample-scale stylesheet'), but it means the default template as shipped does not itself carry the placeholder the criteria call for, and a user applying template-c.css directly gets no running header. Confirm whether the borrow-from-A design satisfies the intent, or whether template-c.css should carry its own @page rules with %%SHORT%%. The remedy is a product/design decision, not a mechanical correction, so it needs authorization.🔧 Fix: give template C its own @page running-header and folio rules
1 info still open:
skills/paper-templates/samples/build_samples.py:8- The module docstring still says the script "productionizes template C exactly as SKILL.md describes: drop the .sC scoping prefix, add template A's @page rules, keep the two-column body flow." The 'add template A's @page rules' clause is now stale: the fix round moved the @page rules into template-c.css itself, and main() no longer borrows from A (lines 115-119 just read template-c.css and drop the .sC prefix). SKILL.md line 24 and the inline comment at line 115-116 were updated to match; only this top-of-file docstring still describes the removed borrow-from-A behavior, so it contradicts the code and the rest of the docs. Drop the 'add template A's @page rules' phrase (e.g. '...keep the template's own @page rules and the two-column body flow'). Purely a comment correction, no scope change.🔧 Fix: correct stale borrow-from-A docstring in build_samples
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash tests/skills-lock.test.sh- passes (skills-lock.json matches the skills/ tree after the skill files changed)python3 skills/paper-templates/samples/build_samples.py- runs on stdlib alone and productionizes template C from its own @page rulesInspected the generated sample-c.html: %%SHORT%% substituted (no residual), SHORT string present in @top-center,.sCscope dropped tobody{, @page :first suppression retained,.cols{column-count:2}keptViewed committed samples/sample-c-p1.png (title page: header+folio suppressed) and samples/sample-c-p2.png (running header + folio '2' visible) as the product surface✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.