Context
Prepares the project for PDF generation without requiring Playwright. The previous
measure skill used Playwright to measure rendered HTML, but its output was never
consumed by gen-slides-pdf.ts. The PDF renderer reads static theme JSON files via
a 4-layer merge (base → theme → style → overrides). This skill validates that all
pieces are in place and produces a summary of what the PDF will look like.
When to Use
- PM Agent dispatches after Gate 4 (Build approval)
- User says "prep for PDF", "estimate layout", "check PDF layout"
- Before PDF export to verify fonts and spec merge
Execution Steps
Step 1: Estimate Layout
bun scripts/co-deck/estimate-layout.ts --project deliverables/<project>
This automatically:
- Reads
lecture-profile.md(theme + style + layout_overrides) - Loads the 4-layer spec merge (base → theme → style → overrides)
- Validates the merged spec has regions and slide types
- Checks font availability (Pretendard or MaruBuri)
- Outputs
layout_summary.mdto the project folder
No Playwright installation required.
Step 2: Font Download (if needed)
If the font check reports missing fonts:
bun scripts/co-deck/download-font.ts pretendard
Step 3: (Optional) Auto-Calibrate (CSS Estimation)
For new themes or when tuning layout, generate estimated overrides from CSS:
bun scripts/co-deck/gen-slides-pdf.ts --auto-calibrate --project deliverables/<project>
This reads CSS custom properties and computes estimated layout_overrides values.
Copy the printed YAML block into lecture-profile.md.
Step 4: (Optional) Iterative Calibration Loop
For precise layout tuning, run the numerical calibration loop:
bun scripts/co-deck/auto-calibrate.ts --project deliverables/<project> --max-iter 3 --sample 5
This generates a 5-page sample PDF, converts it to images (requires pdf-to-png-converter v4),
numerically validates font sizes and line heights, auto-adjusts layout_overrides, and repeats
up to 3 iterations. After the loop, it prompts for user approval of the final values.
If pdf-to-png-converter is not installed, the step degrades gracefully — it still generates
the sample PDF and validates the spec merge, but skips image-based numerical validation.
Step 5: Generate Sample PDF
bun scripts/co-deck/estimate-layout.ts --project deliverables/<project> --sample
Or directly:
bun scripts/co-deck/gen-slides-pdf.ts --project deliverables/<project> --sample 5
Output Format
deliverables/<project>/layout_summary.md— spec merge summary (regions, fonts, sizes)deliverables/<project>/sample_5slides.pdf— sample for Gate 5 review (with --sample)deliverables/<project>/calibration_report.md— iterative calibration results (with auto-calibrate.ts)
Key Differences from Deprecated `measure` Skill
| Aspect | measure (deprecated) | prep-pdf (current) |
|--------|---------------------|-------------------|
| Playwright | Required | Not required |
| Output | layout_spec.json (unused) | layout_summary.md (review reference) |
| Screenshots | Yes (via Playwright) | No |
| Spec merge | No | Yes (4-layer preview) |
| Font check | Manual | Automatic |
| Sample PDF | Separate step | Integrated (--sample flag) |
Related Skills
html-build— produces the HTML filepdf-export— generates the final PDF (consumes the same 4-layer spec)version— snapshot files before PDF regeneration