make-pdf · diff

v1.0.0 to v1.0.0

2 added, 0 removed. Audit A to A.

What this update changes in the checks

No check changed: every fixed check gives the same answer before and after this update.

A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.

---
name: make-pdf
description: Convert Markdown or HTML content to a PDF file using md-to-pdf. Writes content to a temp Markdown file under ~/.ethos/files/generated/, then runs md-to-pdf to produce a PDF alongside it. Output is A4 with standard margins. Useful for generating reports, summaries, or any document the user wants to print or share as a PDF.
version: 1.0.0
author: ethosagent
tags: [document, pdf, export, markdown]
required_tools: [terminal, write_file]
ethos:
+ external_cli_alternatives:
+ - md-to-pdf
category: document
default_personalities: []
prerequisites:
external_cli: [md-to-pdf]
auth: []
env_vars: []
optional_tools: []
integrates_with: []
surface_metadata:
invocation_trigger: "user says 'generate a PDF', 'export as PDF', 'save this as a PDF', 'create a PDF report'"
estimated_turns: "2-4"
---
# Make PDF
Convert Markdown or HTML content to a PDF file. The content is written to a temp Markdown file and rendered to PDF via `md-to-pdf`. Output lands at `~/.ethos/files/generated/<slug>.pdf`.
## When to use this skill
- User asks to generate a PDF, export content as PDF, save a report as PDF, or create a printable document.
- User has a Markdown or HTML document and wants a portable, shareable PDF version.
- User says "make this into a PDF", "PDF of this summary", or "I want to send this as a PDF".
## When NOT to use this skill
- User wants an HTML report — use the `make-html-report` skill instead.
- User wants a spreadsheet — use `export-excel` or `export-csv`.
- User already has a PDF and wants to read or modify it — this skill only creates PDFs from Markdown/HTML.
- The content isn't prose or structured text (e.g. raw binary data).
## Workflow
**Step 1: Create the output directory**
```bash
mkdir -p ~/.ethos/files/generated
```
**Step 2: Write the content to a temp Markdown file**
Use `write_file` to write the Markdown content to:
```
~/.ethos/files/generated/<slug>.md
```
Where `<slug>` is a short, descriptive, lowercase-hyphenated identifier for the document (e.g. `weekly-report-2026-06`, `project-summary`). Do not use spaces or special characters.
**Step 3: Check if `md-to-pdf` is installed**
```bash
which md-to-pdf 2>/dev/null || echo "not found"
```
**Step 4a: If found — proceed to Step 5.**
**Step 4b: If not found — attempt install**
```bash
npm install -g md-to-pdf
```
If the install fails (no npm, no network, permission denied), stop and tell the user:
> "This skill requires md-to-pdf to be installed. Run: `npm install -g md-to-pdf`
> If npm is unavailable, ask your system administrator to install it."
Do not proceed further.
**Step 5: Convert to PDF**
```bash
md-to-pdf ~/.ethos/files/generated/<slug>.md --pdf-options '{"format":"A4","margin":{"top":"20mm","bottom":"20mm","left":"15mm","right":"15mm"}}'
```
`md-to-pdf` writes the output file alongside the input file, replacing `.md` with `.pdf`. The output path is:
```
~/.ethos/files/generated/<slug>.pdf
```
**Step 6: Confirm to the user**
Tell the user:
> "PDF created at: `~/.ethos/files/generated/<slug>.pdf`"
## Anti-patterns
- **Do not guess a slug** — derive it from the document title or user's request. If the user says "generate a PDF of the Q2 report", the slug is `q2-report`.
- **Do not skip the directory creation step** — `md-to-pdf` will fail silently if the directory doesn't exist.
- **Do not embed absolute paths in the Markdown content** — use relative references or inline all images as base64 if the PDF needs them.
- **Do not attempt conversion on empty or near-empty Markdown** — add meaningful content before invoking `md-to-pdf`.
## Hard rules
- All generated files go to `~/.ethos/files/generated/`. Never write outside this directory.
- Always tell the user the exact output path after completion.
- If `md-to-pdf` install fails, show the fallback message verbatim — do not proceed.
- The slug must be lowercase, hyphen-separated, and contain no spaces or special characters.