| name | book-publishing |
| description | Use when publishing a book, preparing an arXiv submission, formatting a manuscript for KDP, or turning a markdown manuscript into a print-ready PDF. End-to-end pipeline orchestrating parallel agent swarms for LaTeX (memoir) conversion, BibTeX citation extraction, diagram/chart generation, image upcycling, and visual verification. NOT for single-document LaTeX compilation (use latex-documents), general prose editing, or ebook-only EPUB flows. |
| triggers | ["/book-publishing","publish book","arxiv submission","KDP publishing","manuscript to PDF","book pipeline"] |
Book Publishing Skill
End-to-end pipeline: markdown manuscript → arXiv-compliant / KDP-ready PDF, using parallel agent swarms for each stage.
Pipeline Overview
Markdown Source
│
├─── [Skeleton Builder] → main.tex skeleton (FIRST, blocking)
├─── [BibTeX Extractor] → references.bib (parallel)
│
├─── [Chapter Converters × N] → chapters/ch*.tex (after skeleton)
├─── [Front Matter] → front/ (after skeleton)
├─── [Appendix Converter] → appendices/ (after skeleton)
├─── [Citation Index] → cite_index.tex (after bibtex)
├─── [Design Consultant] → typography/styles (after skeleton)
│
├─── [Diagram Engineer] → TikZ + Mermaid .mmd (parallel)
├─── [Market Analyst] → matplotlib charts/PDF (parallel)
├─── [Wardley Mapper] → Wardley .mmd files (parallel)
├─── [Research Verifier] → citation verification (parallel)
│
├─── [Image Upcycler] → Gemini-enhanced PNGs (after diagrams)
│
└─── [Build + Verify] → latexmk + PDF preview (final)
Stage 1: Skeleton Builder (Blocking — runs first)
Creates the root main.tex with:
- Document class:
memoir (12pt, a4paper, twoside)
- Package imports (fontspec, microtype, biblatex, hyperref)
- Chapter
\include{} stubs
- Front/back matter structure
All other converters wait for skeleton before starting.
Stage 2: Parallel Foundation
Run simultaneously after skeleton:
Stage 3: Parallel Content Generation
All run simultaneously:
| Agent | Output | Notes |
|---|
| Diagram Engineer | TikZ .tex files | Compile standalone, include via \includegraphics |
| Market Analyst | matplotlib .pdf charts | Python script, PDF for vector quality |
| Wardley Mapper | .mmd + rendered .png | See Wardley Maps skill |
| Research Verifier | verification report | Web search, flag unverifiable claims |
Stage 4: Image Upcycling
After diagrams exist, upscale them for print. This container has no configured Gemini
CLI/API path, so the default is the offline ImageMagick pass — deterministic and never
hallucinates text:
convert diagram.png -resize 200% -unsharp 0x1.0 diagram_hires.png
Prefer regenerating charts as vector PDF over raster upscaling where possible.
An optional AI enhancement path (current google-genai client + a current Gemini image
model) exists but requires a provisioned API key and must be visually diffed against the
source — its output can alter text/data. Full code and guardrails:
references/image-upcycling.md.
Stage 5: Build and Verify
latexmk -xelatex -biber -interaction=nonstopmode main.tex
browser_navigate({ url: "file:///path/to/main.pdf" })
browser_take_screenshot({ filename: "page_verify.png", fullPage: false })
Swarm Topology (claude-flow)
mcp__claude-flow__swarm_init({
topology: "hierarchical",
maxAgents: 15,
strategy: "book-conversion"
})
await mcp__claude-flow__agent_spawn({
type: "coder",
name: "skeleton-builder",
task: "Build main.tex skeleton with memoir class, all chapter stubs, preamble"
})
await Promise.all([
mcp__claude-flow__agent_spawn({ type: "coder", name: "bibtex-extractor", ... }),
mcp__claude-flow__agent_spawn({ type: "coder", name: "chapter-conv-A", ... }),
mcp__claude-flow__agent_spawn({ type: "coder", name: "chapter-conv-B", ... }),
mcp__claude-flow__agent_spawn({ type: "coder", name: "chapter-conv-C", ... }),
mcp__claude-flow__agent_spawn({ type: "coder", name: "front-matter", ... }),
mcp__claude-flow__agent_spawn({ type: , : , ... }),
mcp__claude-({ : , : , ... }),
mcp__claude-({ : , : , ... }),
mcp__claude-({ : , : , ... }),
mcp__claude-({ : , : , ... }),
mcp__claude-({ : , : , ... }),
])
mcp__claude-({ : , : , ... })
Publication Targets
arXiv
- memoir class, XeLaTeX, biber-compiled
.bbl
- All fonts embedded, no shell-escape
- Submit: source
.tex + .bbl + figures (PDF/PNG/JPG)
KDP (Kindle Direct Publishing)
- PDF/X-1a or PDF/X-4 for print
- Bleed: 3mm all sides (
\setlrmarginsandblock in memoir)
- Cover: separate high-res PDF (300 DPI minimum)
- Interior: 6×9 inch (memoir
[6in,9in])
Print-on-Demand (general)
- Trim size specified in
\setstocksize{9in}{6in}
- Spine calculation: pages × 0.002252 inches (60gsm paper)
Quality Gates
Before shipping:
Related Skills
latex-book — LaTeX conventions, memoir class, citation patterns
wardley-maps — Wardley map generation with LaTeX integration
art — Gemini API image enhancement (diagram upcycling)
browser — PDF preview, Mermaid rendering workaround
latex-documents — general LaTeX compilation