I wrote a book in Markdown. One file, 180 pages. When it came time to publish on Amazon KDP, I needed two outputs: an EPUB3 for Kindle and a print-ready PDF for paperback. Trim size 6x9 inches. KDP has specific margin requirements, gutter widths, and bleed specs. Miss any of them and Amazon rejects your file.
I tried the existing tools. Calibre mangled my formatting. Pandoc produced valid EPUB but ugly output that needed hours of manual CSS fixes. Reedsy and Draft2Digital wanted me to paste content into their editors and start over. Atticus costs $150 and still requires manual layout tweaking.
None of them solved the problem I had: take a single .md file and produce both KDP-ready formats in one step, with no manual intervention.
So I built a Claude skill that does it.
What the skill does
You drop a .md or .txt file into Claude (desktop app, Cowork mode), and say “make it a Kindle book.” The skill reads your manuscript, asks a few questions (title, author, trim size, whether you want a table of contents), and produces two files: a valid EPUB3 and a print-ready PDF.
The EPUB passes Amazon’s KindleGen validation. The PDF meets KDP paperback specs for whichever trim size you picked (6x9, 5x8, or custom). Both files land in your output folder, ready to upload to KDP.
One command. No intermediate tools. No copy-pasting between apps.
How it works
The skill is a bundle of instructions, templates, and a build pipeline packaged as a .skill file (a zip archive that Claude knows how to load).
When triggered, it:
- Parses the Markdown into structured sections (front matter, chapters, back matter)
- Generates EPUB3 from scratch using Node.js. Not a conversion. The skill writes every OPF, NCX, and XHTML file according to the EPUB3 spec. It builds the table of contents from your heading structure, sets metadata (title, author, language, publisher), and packages everything into a valid .epub container.
- Generates a print-ready PDF using Puppeteer. It renders each chapter as an HTML page with proper margins for the chosen trim size, adds page numbers, handles widows and orphans, and outputs a single PDF that meets KDP specs.
The margin math matters. A 6x9 book with 300 pages needs a 0.875-inch gutter on the spine side. A 5x8 book with 150 pages needs 0.75 inches. The skill calculates this from your page count and trim size. Get it wrong and KDP flags your file during review.
Why a Claude skill
I could have built this as a CLI tool or a web app. I built it as a Claude skill for one reason: the manuscript is already in Claude.
My writing workflow uses Claude. I draft in Markdown, edit with Claude, restructure with Claude. The manuscript lives in the conversation. A skill that runs inside that same environment means I never leave the context. No exporting to another tool. No uploading to another service. The file goes from draft to publishable inside one app.
Skills are also zero-setup for the end user. You install a .skill file, and Claude gains a new capability. No npm install. No Python environment. No Docker. If you have Claude desktop, you have everything you need.
What I learned building it
EPUB3 is a zip file with strict structure. The mimetype file must be the first entry, uncompressed. The META-INF/container.xml must point to the OPF. The OPF must list every resource. Miss one file reference and the whole thing fails validation. I spent more time on zip entry ordering than on any other part of the build.
KDP paperback margins are not documented in one place. I pulled specs from three different KDP help pages, a community forum post, and one rejected upload error message. The skill now has a lookup table: trim size + page count = exact margins.
Puppeteer PDF generation handles page breaks well but struggles with headers and footers. The skill uses CSS `@page` rules and `position: fixed` elements to get consistent page numbers. Running headers required a workaround: inject them per-chapter as absolute-positioned divs, not as native PDF headers.
The open source part
The skill is on GitHub. MIT license. You can install it in Claude desktop and use it to publish your own book today.
It handles English manuscripts. Other languages work if your fonts support them, but I have only tested with English and Russian.
If you find a KDP spec edge case it doesn’t handle, open an issue. The margin table covers the most common trim sizes but not every possible combination.
One thing you can do today
If you have a manuscript in Markdown or plain text, install the skill and run it. You will have uploadable KDP files in under five minutes. The skill handles the formatting tedium so you can focus on whether your book is any good.
Self-publishing should not require learning InDesign or fighting with Calibre. A Markdown file and one command should be enough. Now it is.