/lecture-to-anki:lecture-to-anki [lecture.pptx|lecture.pdf] [--deck M1::Block::Lecture]from lecture-to-anki
Turns a lecture PowerPoint or PDF into an Anki .apkg deck of cloze and basic cards, keeping the slide figures and the professor's speaker notes. Use when asked to make flashcards, an Anki deck, or study cards from a lecture, slide deck, .pptx, or PDF.
Ships in lecture-to-anki. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Ask for the PowerPoint before you settle for the PDF. A .pptx states what a PDF
only depicts: titles, reading order, the original figure files, and the speaker notes a
PDF export discards. If it can be had, ask for it — once — and carry on either way.
lecture.pptx lecture.pdf
│ │
│ 0b probe.py ...... measures FREE
│ 1 YOU ........... profile.json ~2k
0 extract_pptx.py 2 extract.py .... digest FREE
└─────────────┬─────────────────┘
3 YOU ......... audit the extraction ~1k
4 YOU ......... write the cards the real work
5 lint.py ...... structural + coverage FREE
6 build_deck.py deck.apkg FREE
Both extractors emit the same work/ contract; steps 3–6 are identical. The mechanical
work is deterministic and the judgement is yours. The reasoning behind every rule here is
in the repository's docs/overview.md; this file is the instructions.
Scripts live in scripts/. ${CLAUDE_SKILL_DIR} resolves to the skill root — it is
often unset, so check once and, if empty, substitute the absolute path of the directory
containing this file. Everything runs on a bare python3 (3.7 or newer). PDFs read
best with PyMuPDF; without it, extract.py hands over by itself to a reduced path
on pypdf (preinstalled in Claude Cowork's sandbox) and says so. Reduced means: figures
are the embedded images as stored, with nothing drawn over them; a slide with neither
text nor an image is lost and listed; there is no probe and no profile — probe.py
exits and tells you to skip to extract and ask the round-one questions yourself. If
the environment has pip or uv and network, python3 -m pip install --user pymupdf
once restores the full path; do that when the reduced run reports lost slides or
the deck is figure-driven.
In a sandbox (Cowork, or anything where the home directory may not survive the
session): write work/ and the finished .apkg next to the lecture file, in the
folder the user connected, and save the course profile there too as
<course-slug>.profile.json — the probe finds profiles beside the lecture as well as in
~/.lecture-to-anki/profiles/. If AskUserQuestion is not available, ask the same
batched round in your message.
Read the lecture PDF. Never render all the slides.work/slides.md once, whole (it is a few thousand tokens), not per chunk.work/cards.part-N.jsonl. Never re-emit earlier cards.The cost is turns, not pixels and not cards. Measured on one 55-slide anatomy deck: five parallel subagents, comprehensive, ~507k tokens; single-threaded comprehensive, 96 cards, 34 figures opened, 55 tool calls, ~187k; single-threaded objectives-first, 69 cards, 29 figures, 53 calls, ~186k — the same, because the turn count was the same. After the turn budget below was written in: 70 cards, 17 figures, 42 calls, ~179k. Every turn re-sends everything before it, so the levers are, in order: turns per chunk, sequential over parallel (each subagent re-pays the whole context), then scope.
A deck is good when the student can answer every card cold in six weeks and the cards
between them cover what the course will examine. Slide coverage is not the goal and card
count is not the goal. Scope (what deserves a card) is a judgement worth asking about;
fidelity (does the card say what the lecture said) is enforced by lint.py.
Ask only what cannot be read off the lecture, in one batched round with
AskUserQuestion — plus the single follow-up below, which cannot be asked until the
lecture has been read. For a PDF the round comes after the probe, which raises the
questions as decide: "user" findings; put the .pptx question in the same round.
| Question | Ask when |
|---|---|
Is there a .pptx of this lecture? | Given a PDF. Once; proceed on the PDF either way |
| Where does this deck belong? | No preferences.deck_root in a matched profile |
How thorough — comprehensive, objectives-first, or high-yield? | No preferences.scope; matters most on a figure-driven lecture |
| Should the professor's practice questions become cards? | After extraction, only if the lecture has some — the one permitted follow-up |
Lead with your recommendation and what it costs. If the user already said what they want,
that is the answer; do not confirm it back. Do not ask: layout questions (the probe
and the samples settle them); card style (default blush, say so, it is a rebuild flag);
anything a matched profile already records (asking twice is the failure mode);
whether to proceed; and whether to cover an objective the lecture does not support — say
in your report that the lecture never teaches it, and invent nothing.
Write the answers into the profile under preferences, in both the saved copy and
work/profile.json, and say where the saved file is. When the practice-question answer
arrives after extraction, add it to both. deck_root becomes the deck name as
<deck_root>::<lecture title>; style is the --style flag. The next lecture from this
course asks nothing.
"preferences": {"deck_root": "M1::Anatomy", "style": "blush",
"scope": "objectives-first", "practice_questions": true}
| Given | Do |
|---|---|
.pptx | extract_pptx.py; skip the probe and the profile. Then step 3. |
.pptx and its PDF | extract_pptx.py; keep the PDF only to render vector_slides. |
.pdf only | Note the .pptx question for round one, then step 0b. |
.ppt | Not readable; ask for it re-saved as .pptx. |
python3 ${CLAUDE_SKILL_DIR}/scripts/extract_pptx.py LECTURE.pptx --out work/
Read four things in its output. vector_slides: diagrams drawn in PowerPoint have no
image file; render those pages from the PDF export if you have it, otherwise card the
slide's text and say the slide has no figure (SmartArt is the exception — its labels
arrive as a [diagram] A · B · C line and its rendered picture is extracted).
skipped_media: logos, icons, metafiles Anki cannot show, and pictures linked from
the author's disk; skim it once and say if something real was dropped. hidden_slides:
kept and marked in slides.md because a PDF export would drop them; card them only if the
material was taught. chrome: the master's text, where the institution usually is.
slides.md indents sub-bullets (an indented line qualifies the one above; do not split
them across cards) and carries Speaker notes: under the slide — lecture content with
full standing, often where the professor says what the bullets only gesture at. Alt
text is the figure budget: where authors described their images, read the descriptions
and open only the figures a card depends on. same image as slide N is not a second
figure. LO n slide labels are not objective numbers. author_lo_tags records them
without resolving them, and objectives.json keeps each objective's level and
parent. When the labels run 1–7 and there are seven top-level objectives, the author
is indexing the headings — a useful hint for which topic a figure-only slide belongs to.
Tag cards with the flat numbers from objectives.json; a card tagged to a child also
counts for its heading.
python3 ${CLAUDE_SKILL_DIR}/scripts/probe.py LECTURE.pdf --out work/ # add --profiles DIR to use another profile store
Measures the deck, renders a few representative slides to work/probe/, and prints
findings: each with the evidence, a suggested setting, a confidence, and who decides.
decide: "model" — look at the samples and settle it. decide: "user" — a question of
intent; it names the profile key its answer goes to (answers). Thresholds are derived
from the document: for the figure-vs-picture-of-text split, high confidence means two
separated populations (take the cutoff), medium means a narrow gap (take it, verify in
step 3), low means no natural split (look; if still unclear keep the default and rely
on the whole-slide fallback).
Profiles live in ~/.lecture-to-anki/profiles/, one per course. The probe lists them
and matches this lecture on what it says about itself. On a match, reuse it and skip to
step 2: pass the saved file's path straight to extract.py --profile, unedited. The
probe also prints source_hints and a suggested profile filename — that is what to name
a new profile from; manifest.json does not exist yet.
Settle every decide: "model" finding and write work/profile.json. Be clear what
looking can settle: at sample resolution rendered text and real text look the same, so
trust the probe's word counts on that (confidence: high). Looking is for telling a real
chart from decorative vector art, spotting a quirk nothing flagged, and low findings.
If every model finding is high or medium and there are no vector clusters, do not
open the samples — they would only confirm the probe, at an image read each.
{
"name": "Renfrew College of Medicine · Anatomy",
"source_hints": {"institution": "Renfrew College of Medicine", "course": "ANAT 601"},
"drop_banners": true, "drop_text_images": true, "text_density_cutoff": 0.287,
"vectors": false, "whole_slide_fallback": true,
"preferences": {"deck_root": "M1::Anatomy", "style": "blush", "scope": "objectives-first"},
"notes": "Titles are images; some body bullets are too. No vector art."
}
Every key is optional (extract.py --write-default-profile defaults.json dumps them
all). Symptoms after extraction: banner candidates are real figures → drop_banners: false; labelled diagrams dropped as pictures of text → lower text_density_cutoff;
vector clusters are table rules → vectors: false; figures cut in half → raise
merge_gap; media far too large → lower max_fig_px or render_dpi.
Save it to the suggested path under ~/.lecture-to-anki/profiles/ as well as
work/profile.json, with source_hints copied in (that is how the next lecture matches)
and notes on the layout. In a sandbox, save it beside the lecture instead, as the
probe's second suggested path. Tell the user the path.
python3 ${CLAUDE_SKILL_DIR}/scripts/extract.py LECTURE.pdf --out work/ --profile work/profile.json
Writes work/slides.md, work/media/ (card copies), work/read/ (reading copies),
work/manifest.json, and work/objectives.json when the lecture states objectives. A
slide yielding neither text nor a figure is rendered whole rather than dropped; the run
lists those, and lists the slides it dropped pictures of text from.
slides.md reads two-column slides column by column, and puts the callouts printed inside
a figure on a labels: line under it — the PDF's stand-in for alt text, when the
labels are live text. Plates with labels baked into the image show none. A figure-only
slide whose text is a page citation ("Text, page 344") is opaque until opened, and its
title may be the professor's annotation of the picture rather than its subject. A
[dropped: picture of text · read/dropped/…] line marks a rendered-text image that was
removed; its words are already in the slide's text, and the thumbnail is there if you
doubt the drop.
WARNING: slides [...] produced neither text nor a figure is never acceptable: fix the
profile, re-extract. Glance at "pictures of text dropped on slides": if one is a slide
you expected a diagram from, lower the cutoff.slides.md. Whole sentences or shredded? Two facts welded? Real titles?probe.py LECTURE.pdf --out work/ --render 2,38 renders only
those pages. Do not re-run extraction with filters off to see what a slide holds.From a .pptx, check instead that skipped_media dropped nothing real, that every
vector_slides entry got a figure or is acknowledged, and that a cropped figure stored
whole is not misleading.
Read work/objectives.json first: it is the specification. Read reference/card-rubric.md
and reference/exemplars.md before the first chunk. Then work in as few chunks as
possible: the figure count decides — up to about eight figures opened per message is
comfortable, so a deck needing 14 figures is two chunks, whatever its slide count — and
each chunk costs at most two turns: one opening every figure the chunk needs, one
writing the whole work/cards.part-N.jsonl, one object per line:
{"type":"cloze","claim":"...","text":"... {{c1::...}} ...","extra":"...","figure":"fig-3e1c7bf30f26","slide":6,"lo":4,"tags":["#System::Thorax"]}
{"type":"basic","claim":"...","front":"...","back":"...","extra":"...","figure":"fig-2bc4f3913153","slide":15,"lo":[9,10],"verified":true,"tags":[]}
| field | meaning |
|---|---|
claim | The single proposition this card tests. Write it first, pronouns resolved. The linter audits the card against it. |
text / front+back | Cloze sentence, or basic prompt and answer. |
extra | Mechanism, why, mnemonic, contrast. Shown on reveal, never tested. |
figure | A fig-… id from the manifest, or "". |
slide | Source slide. Always set it. |
lo | Objective number, or a list [6, 7]. Counts as coverage for those objectives and their heading. |
tags | #System::…, #Concept::…, ^Formula. No spaces. |
verified | true once you opened the figure and confirmed the claim's label is in it; silences unsourced_figure. |
{{c1::rib 8}}, not rib {{c1::8}}.
Never a function word, never the word grammar forces.extra; an empty extra should be the exception.There is no alt text. Triage in this order: the slide's own text (a slide that states
its facts rarely needs its picture opened — the picture goes on the card unopened);
the labels: line (live callouts say what the figure teaches; under
objectives-first open it only if an objective needs it); nothing (no labels, no
text: an unlabelled photograph, cadaver plate or endoscopy still — a third of the figures
opened in early runs, every one yielding no card; open one only for an objective with no
other source).
Open the read_file from the manifest, never file first. It is the same figure sized so
labels stay legible, including pasted paragraphs of textbook text; when the figure is
already small it points at the original. If a reading copy is blurry rather than small,
the source is a low-resolution screenshot and the full copy will not help — card only
what you can actually read, and say so.
python3 ${CLAUDE_SKILL_DIR}/scripts/lint.py work/cards.part-*.jsonl --work work/
Give it the part files directly; do not concatenate them. Findings are reported as
file:line and slide. Fix every ERROR — the build refuses while any remain; the
common ones are cloze_malformed ({{c1:x}}, {{c1::}}, an unclosed {{),
cloze_in_basic, and unknown_type. Triage WARN:
unsourced_figure — the claim's words are not in the slide text but a figure is
attached; the linter cannot read labels inside an image. Open the figure and check;
if the label is there, set "verified": true on the card.unsourced with no figure — genuinely suspicious; the lecture may not contain this.near_dup_front, compound_front, trivial_cloze on a numeral, cloze_count of 4 —
usually real improvements; four deletions only for a true sequence.figure_slide (figure from far away), slide_range, slide_missing, unknown_lo
(an author's LO n label leaking in as an objective number), bad_tag.An empty-Extra advisory means the deck is bare facts; go back and add mechanism.
Slides with no card are listed: title, summary and deliberately unopened figure-only
slides belong there; a run of consecutive numbers you did not choose is a skipped chunk.
Objective coverage reports objectives with no card, and objectives whose cards miss a named clause, saying which words it looked for. Both are prompts, not verdicts: write the cards, or state plainly that the lecture does not teach it. Inventing a card to complete the count is the one wrong answer.
python3 ${CLAUDE_SKILL_DIR}/scripts/build_deck.py work/cards.part-*.jsonl --work work/ \
--deck "M1::Anatomy::Thoracic Cage & Lungs" --out "Thoracic Cage & Lungs.apkg" --style blush
Refuses while lint errors remain (--force overrides; say so in your report if you use
it). Styles: blush (default), clinical, slate, paper. Note GUIDs derive from the
claim, so a rebuild after a correction updates the notes in Anki instead of duplicating.
Above ~40 slides you may run chunks as parallel subagents, each with the rubric, exemplars, objectives and its slide range, writing its own part file. It is not cheaper — each pays its own context — so reach for it when the user is waiting, not when the budget is tight. Tell each subagent to report which objectives it covered (they straddle chunks), and lint all the part files together once at the end.
Deck path, note count by type, figures attached, lint result, objective coverage, any warnings you consciously left, and where the profile was saved. Never paste the deck.
reference/card-rubric.md (opens in a new tab)reference/exemplars.md (opens in a new tab)scripts/apkg.py (opens in a new tab)scripts/build_deck.py (opens in a new tab)scripts/extract.py (opens in a new tab)scripts/extract_lite.py (opens in a new tab)scripts/extract_pptx.py (opens in a new tab)scripts/lint.py (opens in a new tab)scripts/note_types.py (opens in a new tab)scripts/pdftext.py (opens in a new tab)scripts/probe.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub skyfox-io/lecture-to-anki --plugin lecture-to-anki