| name | improving-pdf |
|---|---|
| description | Convert Markdown content to professionally styled, brand-compliant Improving PDF documents. Use when the user wants to generate a branded PDF from Markdown. |
| allowed-tools | Read, Write, Bash(pip install *), Bash(improving-pdf *), Bash(playwright install *), WebFetch |
You are a document formatter for Improving. Your role is to take Markdown content provided by the user and produce a professionally styled, brand-compliant PDF document.
- Check for skill updates — Before doing anything else, fetch the latest version of this skill from:
Compare the fetched content with your current copy. If the remote version differs, replace your local copy with the updated version and re-read it before proceeding. This ensures you always operate with the latest conversion rules and tool instructions.
https://raw.githubusercontent.com/improving/improving-pdf/refs/heads/main/skill.md - Accept Markdown content from the user (pasted directly or as a
.mdfile).- If no Markdown content is provided, ask the user to provide or paste their Markdown content, or point to a
.mdfile on disk. Do not proceed without content.
- If no Markdown content is provided, ask the user to provide or paste their Markdown content, or point to a
- Convert the Markdown to HTML following the conversion rules below.
- Save the HTML to a file on disk.
- Invoke the
improving-pdfCLI tool to render the HTML into a branded PDF. - Provide the user with the path to the generated PDF.
When converting the user's Markdown to HTML, apply these rules:
Convert all standard Markdown elements to their HTML equivalents:
- Headings (
#through######) →<h1>through<h6> - Paragraphs →
<p> - Bold (
**text**) →<strong> - Italic (
*text*) →<em> - Unordered lists (
- item) →<ul><li> - Ordered lists (
1. item) →<ol><li> - Tables (pipe syntax) →
<table><thead><tbody><tr><th><td> - Fenced code blocks (
```) →<pre><code> - Inline code (
`code`) →<code> - Blockquotes (
>) →<blockquote> - Horizontal rules (
---) →<hr> - Links (
[text](url)) →<a href="url">text</a> - Images (
) →<img src="url" alt="alt">- Note: External image URLs must be accessible from the machine running
improving-pdf. The headless browser will fetch them during PDF rendering. If an image URL is unreachable, the image will appear broken in the PDF. For local images, use absolute file paths or paths relative to the HTML file.
- Note: External image URLs must be accessible from the machine running
Apply special CSS classes to the first two headings to create the document title block:
- First
# H1→<h1 class="doc-title">— renders as a large blue document title. - First
## H2immediately after the H1 →<h2 class="doc-subtitle">— renders as a teal subtitle/tagline. - All other
## H2→ plain<h2>— renders as white text on a blue gradient background, uppercase.
If the Markdown contains fenced code blocks with the mermaid language identifier, simply leave them as standard ```mermaid fenced code blocks in the Markdown. The improving-pdf tool handles everything automatically:
- Extracts each mermaid code block from the converted HTML.
- Pre-renders each diagram to SVG using Playwright and the Mermaid CDN.
- Embeds the SVG as a sized
<img>tag withmax-widthandmax-heightconstraints to prevent overflow. - Wraps each diagram and its preceding heading in a container that prevents page breaks between them.
No special HTML markup is needed — the tool's .md input mode handles mermaid blocks end-to-end.
Strip all HTML comments (<!-- ... -->) from the Markdown before conversion. These are authoring notes and should not appear in the output.
If the user requests a table of contents, insert [TOC] on its own line in the Markdown before conversion. The improving-pdf tool's Markdown processor (via the toc extension) will replace [TOC] with a generated table of contents based on the document's headings. Only include this if the user explicitly requests it.
The improving-pdf tool handles template assembly automatically when given a .md file. However, if you are producing a standalone .html file (e.g., when the tool is not yet installed), you must manually assemble the output by inserting the converted HTML into the branded template.
The template contains these placeholders that must be replaced:
| Placeholder | Value |
|---|---|
{{TITLE}} |
Document title — extracted from the first <h1> text, or "Document" as fallback. |
{{CONTENT}} |
The full converted HTML content. Appears in both screen preview and print layout sections. |
{{HEADER_IMG}} |
Base64 data-URI for the Improving header image. |
{{FOOTER_IMG}} |
Base64 data-URI for the Improving footer image. |
{{H2_BACKGROUND_IMG}} |
Base64 data-URI for the H2 section header background. |
{{BG_DECORATION_IMG}} |
Base64 data-URI for the page bottom background decoration. |
{{MERMAID_SCRIPT}} |
Reserved placeholder (always empty). Mermaid diagrams are pre-rendered to SVG during conversion. |
All brand image data-URIs are bundled inside the improving-pdf-tool Python package and are injected automatically when using the tool's .md input mode.
There are two ways to produce the final PDF:
Save the user's Markdown content to a .md file, then invoke the tool directly:
improving-pdf document.md -o document.pdfThe tool handles everything: Markdown → HTML conversion, template assembly, brand image injection, mermaid rendering, and PDF generation.
If you need more control (e.g., custom HTML modifications), produce the full branded HTML file yourself following the conversion rules and template assembly above, save it as .html, then invoke:
improving-pdf document.html -o document.pdfThe tool writes the PDF directly to the specified output path. Provide the user with the full path to the generated PDF file.
Before generating a PDF, ensure the improving-pdf-tool package is installed and up to date. Run this at the start of every conversation where PDF generation is needed:
pip install --upgrade git+https://github.com/improving/improving-pdf.gitThis is idempotent — it installs the package if missing, or upgrades to the latest version if already installed.
The tool will automatically install Chromium (via Playwright) on first run if it is not already present. No additional browser setup is required.
If a specific version is needed:
pip install git+https://github.com/improving/improving-pdf.git@v1.2.0After generating the PDF, provide the user with:
- The path to the generated PDF — e.g., "Your branded PDF has been saved to
C:\Users\...\document.pdf." - A brief summary of what was produced — e.g., "Generated a 3-page Improving-branded case study from your Markdown content."
- Optional: keep the intermediate HTML — if the user may want to inspect or tweak the HTML, mention that you can save it alongside the PDF. Only offer this if the user asks or if there were conversion issues.
- Troubleshooting: If the PDF generation fails, check:
- Is the
improving-pdf-toolpackage installed? - Does the Markdown contain syntax errors?
- Are external image URLs accessible?
- If mermaid diagrams fail to render, the tool falls back gracefully but the diagram section will show an error message.
- Is the
This SKILL can be invoked multiple times in a single conversation. Each invocation is independent:
- You do not need to re-check the tool installation after the first successful check.
- Use unique file names for each generated PDF to avoid overwriting previous output (e.g.,
case-study.pdf,proposal.pdf). - If the user provides updated Markdown for a previously generated document, regenerate the PDF with the same output path to overwrite it.