This skill generates professional slide decks from academic papers, auto-detects figures, and creates outline-driven, ready-to-share presentations.
npx playbooks add skill luwill/research-skills --skill paper-slide-deck
Transform any content — an article, a topic, or a paper — into stylized, shareable slide images; for PDF papers, figures are detected and extracted from the source. Generated slides are AI images that garble math and numbers, so every slide recorded as generated (generated.json, written by generate-slides.py or proofread.ts --record) must carry a proofread disposition before the merge scripts accept the deck (Step 6.5).
/paper-slide-deck path/to/paper.pdf
/paper-slide-deck path/to/paper.pdf --style academic-paper
/paper-slide-deck path/to/content.md --style sketch-notes
/paper-slide-deck path/to/content.md --audience executives
/paper-slide-deck path/to/content.md --lang zh
/paper-slide-deck path/to/content.md --slides 10
/paper-slide-deck path/to/content.md --outline-only
/paper-slide-deck # Then paste content
The TypeScript scripts (merge-to-*, detect-figures, extract-figure,apply-template) need Node dependencies. Install them once:
cd ${SKILL_DIR}/scripts && npm install
This installs canvas, pdfjs-dist, pptxgenjs, and pdf-lib (a package-lock.json
pins versions). If a script exits with missing Node dependency "<name>", run the
command above. The Python generator (generate-slides.py) auto-installs google-genai
on first run.
Also install PyMuPDF (pip install pymupdf) — it is the reliable fallback for
extracting figures from pages that embed bitmaps (X-rays, CAM heatmaps, photographs),
where the pdfjs + canvas path in extract-figure.ts fails withError: Image or Canvas expected. For medical-imaging papers this is the common case,
not the exception, so treat PyMuPDF as required, not optional.
Also install Pillow (pip install Pillow) — when Gemini returns image/webp,
every slide goes through a Pillow conversion to PNG; without it each image errors with
"converting it needs Pillow (pip install Pillow)" until installed. Treat it as required
alongside PyMuPDF.
Image generation needs either a GOOGLE_API_KEY/GEMINI_API_KEY (Gemini API) or the
Gemini Web skill. **If no key and no web option is available, the skill still works in
a degraded mode** — do not abort:
--outline-only to produce the outline + prompts (no images).detect-figures.ts +extract-figure.ts + apply-template.ts (no API key needed — pure rendering).
extract-sourced pages) into PPTX/PDF, and hand theprompts/ back to the user to generate images later when a key is available.
Important: All scripts are located in the scripts/ subdirectory of this skill.
Agent Execution Instructions:
SKILL_DIR${SKILL_DIR}/scripts/<script-name>.ts${SKILL_DIR} in this document with the actual pathScript Reference:
| Script | Purpose |
|--------|---------|
| scripts/generate-slides.py | Generate AI slides via Gemini API (Python) |
| scripts/merge-to-pptx.ts | Merge slides into PowerPoint |
| scripts/merge-to-pdf.ts | Merge slides into PDF |
| scripts/detect-figures.ts | Auto-detect figures/tables in PDF (heuristic; verify pages) |
| scripts/extract-figure.ts | Render a full PDF page to PNG (optional --crop; PyMuPDF fallback) |
| scripts/apply-template.ts | Apply figure container template |
| scripts/proofread.ts | Record a proofread disposition (--mark); the merge scripts' Step 6.5 gate |
| Option | Description |
|--------|-------------|
| --style <name> | Visual style — gallery + auto-selection rules in [references/style-selection.md](references/style-selection.md) |
| --audience <type> | Target audience: beginners, intermediate, experts, executives, general |
| --lang <code> | Output language (en, zh, ja, etc.) |
| --slides <number> | Target slide count |
| --outline-only | Generate outline only, skip image generation |
Style & layout selection: read [references/style-selection.md](references/style-selection.md)
when picking a style (explicit or auto-selected from content signals — including the
academic-signal caution about garbled math/numbers). Read
[references/layout-gallery.md](references/layout-gallery.md) only when composing the
outline's // LAYOUT hints (Layout: <name> per slide).
This deck is designed for reading and sharing, not live presentation:
Each session creates an independent directory named by content slug:
slide-deck/{topic-slug}/
├── source-{slug}.{ext} # Source files (text, images; source-paper.pdf for papers)
├── figures.json # Figure-detection results (academic PDFs)
├── outline.md # Final outline (with IMAGE_SOURCE blocks)
├── outline-{style}.md # Style variant outlines
├── extracted/ # Raw PDF page extractions (pre-template)
├── figures/ # Extracted figure crops (pre-template)
├── prompts/
│ └── {NN}-slide-{slug}.md, ...
├── {NN}-slide-{slug}.png # Final slide images in the deck ROOT — both AI-generated
│ # and extracted-figure slides; ext may be .jpg
├── {topic-slug}.pptx
└── {topic-slug}.pdf
Slug Generation:
intro-machine-learningIf slide-deck/{topic-slug}/ already exists:
{topic-slug}-YYYYMMDD-HHMMSSintro-ml exists → intro-ml-20260118-143052Copy all sources with naming source-{slug}.{ext}:
source-article.md (main text content)source-diagram.png (image from conversation)source-data.xlsx (additional file)Multiple sources supported: text, images, files from conversation.
source.md)references/analysis-framework.md for deep content analysis--style or auto-select from signals)--slides or dynamic) npx -y bun ${SKILL_DIR}/scripts/detect-figures.ts --pdf source-paper.pdf --output figures.json
This outputs a JSON file with all detected figures/tables, their page numbers, and captions.
Caption detection is heuristic — verify, especially the first-page teaser. The
line-anchored Figure N matcher reliably finds captions that sit on their own line
(single-column layouts), but **misses figures whose caption is interleaved with body
text on a two-column first page** — which is often the paper's most important
architecture/overview figure. After running detect-figures, cross-check the source'sFigure 1 explicitly: if the paper's text references a Figure N that is absent fromfigures.json, add it manually via an // IMAGE_SOURCE block and extract it with the
PyMuPDF fallback. Do not assume figures.json is complete.
--style <name>, use that style directly and skip thevariant question below (asking again after an explicit choice is noise). Otherwise,
generate 3 style variant outlines based on content analysis
references/outline-template.md for structurefigures.json from Step 1references/analysis-framework.md Section 8// IMAGE_SOURCE blocks to appropriate slides:Source: extract)Source: extract)Source: extract)Source: generate or omit)outline-{style}.md for each variantSingle AskUserQuestion with all applicable options:
| Question | When to Ask |
|----------|-------------|
| Style variant | Only when --style was NOT passed (3 options + custom); an explicit --style is the answer |
| Language | Only if source ≠ user language |
After selection:
outline-{style}.md to outline.mdoutline.md for fine-tuningIf --outline-only, stop here.
references/base-prompt.mdLayout: specified in outline, include layout guidance in prompt:Layout: hub-spoke → "Central concept in middle with related items radiating outward"prompts/ directoryBefore generating images, ask user to choose generation method:
Use AskUserQuestion with options:
| Option | Label | Description |
|--------|-------|-------------|
| 1 | Gemini API (Recommended) | Official Google API via Python. Requires GOOGLE_API_KEY env var. |
| 2 | Gemini Web (Browser-based) | ⚠️ Uses reverse-engineered web API. No API key needed but may break. |
If no API key is available, do not still recommend Option 1 — offer the degraded
no-key path from the Setup section (--outline-only + extraction + prompts handoff).
GOOGLE_API_KEY or GEMINI_API_KEY environment variable python3 ${SKILL_DIR}/scripts/generate-slides.py <slide-deck-dir>
The model id is stated once here: gemini-3-pro-image (Nano Banana Pro, GA; the
older -preview id is deprecated). Override with --model <id> only if needed.
Script behavior (details in the script docstring):
google-genai; errors out (non-zero) if no prompt files are foundland, so one merge step picks up both
(the merge scripts only accept png/jpg/jpeg)
The Web path does not write generated.json itself — record each slide it produces withproofread.ts --record <slide-deck-dir> <slide-file> --model gemini-web, or the merge gate
cannot tell those slides are AI-generated (it warns when prompts/ exists without a ledger).
Read [references/gemini-web.md](references/gemini-web.md) for the consent check,
per-slide invocation, and proxy setup. It requires the baoyu-danger-gemini-web
skill and explicit user consent to the reverse-engineered-API disclaimer.
For academic presentations, IMAGE_SOURCE metadata was auto-populated in Step 2 based on figure detection from Step 1.
Automatic Execution:
Source: extractmkdir -p figures npx -y bun ${SKILL_DIR}/scripts/extract-figure.ts \
--pdf source-paper.pdf \
--page <page-number> \
--output figures/figure-<N>.png
Note: extract-figure.ts renders the entire page to a high-resolution
PNG — it does not auto-detect or crop a single figure's bounding box. On a
two-column page you will get both columns. To isolate one figure, either pass--crop "x,y,width,height" (pixels in the rendered/scaled page) or open the
PNG, confirm it visually, and crop manually before applying the template.
npx -y bun ${SKILL_DIR}/scripts/apply-template.ts \
--figure figures/figure-<N>.png \
--title "<slide-headline>" \
--caption "Figure <N>: <caption-text>" \
--output <NN>-slide-<slug>.png
Source: generate (or no IMAGE_SOURCE):Note: Source PDF must be saved as source-paper.pdf in output directory.
Troubleshooting:
// IMAGE_SOURCE block to outlineFigure: and Page: values in outlinePyMuPDF Fallback for Page Extraction:
If extract-figure.ts fails with "Image or Canvas expected" error (common with complex PDFs), use PyMuPDF:
import fitz
doc = fitz.open("source-paper.pdf")
page = doc[page_num - 1] # 0-indexed
mat = fitz.Matrix(3, 3) # 3x scale for high resolution
pix = page.get_pixmap(matrix=mat)
pix.save(f"extracted/page-{page_num}.png")
Then apply template using apply-template.ts.
Source: extract)slides-{topic-slug}-{timestamp}Text-to-image **bakes text into pixels and will garble spelling, math symbols, and
numbers** — this is the single biggest risk of this skill. Do not ship unchecked.
(This is this skill's instance of the repository's shared citation-integrity core
[docs/citation-integrity-core.md]: numbers and claims must match the source, and
failures surface as visible flags — never silent substitutes.)
For every generated slide (especially any with equations, tables, key numbers,
or non-Latin text), use Read to open the PNG and visually check:
mangled words.
(or absent). Assume the model got them wrong until you confirm otherwise.
Record every disposition — generate-slides.py lists each slide it produced ingenerated.json (with its sha256), and both merge scripts refuse a deck in which a
recorded slide has no disposition or was regenerated after its disposition:
npx -y bun ${SKILL_DIR}/scripts/proofread.ts --mark <slide-deck-dir> 04-slide-results.png ok
npx -y bun ${SKILL_DIR}/scripts/proofread.ts --mark <slide-deck-dir> 05-slide-eq.png check --note "σ garbled in eq. 2"
ok = checked, nothing wrong; check = still suspect after retries (listed as [CHECK] by the
merge and in the Step 8 summary). Extracted-figure slides are never in generated.json and are
not gated. --allow-unproofread on the merge scripts overrides the refusal with a warning —
only when the user explicitly accepts an unchecked deck.
If garbling is found:
phonetically, reduce text density, move exact numbers to a caption). Max 2 retries.
[CHECK] in the Step 8 summaryand recommend one of:
Source: extract), orscholar-slides.
Never silently deliver a slide with garbled math or data — always surface it.
npx -y bun ${SKILL_DIR}/scripts/merge-to-pptx.ts <slide-deck-dir>
npx -y bun ${SKILL_DIR}/scripts/merge-to-pdf.ts <slide-deck-dir>
Both exit 1 and name the slides when an AI-generated slide has no current proofread
disposition (Step 6.5); fix that rather than reaching for --allow-unproofread.
Slide Deck Complete!
Topic: [topic]
Style: [style name]
Location: [directory path]
Slides: N total
- 01-slide-cover.png ✓ Cover
- 02-slide-intro.png ✓ Content
- 04-slide-results.png ⚠ [CHECK] math/numbers — verify or use scholar-slides
- ...
- {NN}-slide-back-cover.png ✓ Back Cover
Outline: outline.md
PPTX: {topic-slug}.pptx
PDF: {topic-slug}.pdf
List any [CHECK]-flagged slides (from Step 6.5) explicitly so the user knows which
slides may contain garbled text/math/data and how to remediate them.
See references/modification-guide.md for:
Requires:
GOOGLE_API_KEY or GEMINI_API_KEY environment variablegoogle-genai package (auto-installed by script)Model id: stated once in Step 5.
See [references/gemini-web.md](references/gemini-web.md) — requires thebaoyu-danger-gemini-web skill, Chrome with a logged-in Google account, and user consent.
Requires (install via cd ${SKILL_DIR}/scripts && npm install):
pdfjs-dist npm package (use legacy build for Node.js)canvas npm package for extract-figure.ts / apply-template.tspymupdf Python package (more reliable for complex PDFs)Read only the reference file for the stage you are in — never glob references/.
| File | Read when |
|------|-----------|
| references/analysis-framework.md | Step 1 — deep content analysis; IMAGE_SOURCE mapping rules |
| references/style-selection.md | Step 1/3 — style gallery + auto-selection (incl. academic-signal caution) |
| references/outline-template.md | Step 2 — outline structure and STYLE_INSTRUCTIONS format |
| references/layout-gallery.md | Step 2 — per-slide Layout: hints |
| references/base-prompt.md | Step 4 — base prompt for image generation |
| references/gemini-web.md | Step 5 Option 2 — consent, invocation, proxy |
| references/modification-guide.md | Post-delivery edits — add/delete/renumber slide workflows |
| references/content-rules.md | Content and style guidelines |
| references/figure-container-template.md | Step 5.5 — visual specs for extracted figure containers |
| references/styles/<style>.md | Full specification of the selected style |
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.