anki-flashcard-generator
Scannednpx machina-cli add skill maaarcooo/claude-skills/anki-flashcard-generator --openclawAnki Flashcard Generator
Generate study flashcards from PDF or Markdown content in Anki-importable format. Card design follows evidence-based principles from cognitive psychology and neuroscience research to optimize active recall and long-term retention under spaced repetition scheduling.
Process
- Read the source file (PDF or Markdown) thoroughly
- Verify accuracy of all information in the source — correct any errors
- Identify all key content: bolded terms, highlighted text, and Higher Tier material
- Generate flashcards covering all essential topic content, selecting the most effective card type for each piece of knowledge (see Card Types below)
- Run the interference check: scan the full card set for confusable pairs and add discriminative cards where needed
- Format output as one card per line:
Question | Answer
Core Design Principles
These principles are ordered by impact on retention. Every card must satisfy the first three. The remaining principles should be applied wherever the content allows.
1. Understand-first rule
Never create cards for content the learner has not yet studied or that the source does not explain. Cards built on material the learner does not understand become intractable leeches (cards failed 8+ times that consume disproportionate review time). A flashcard consolidates existing understanding into long-term memory; it does not teach new concepts from scratch.
2. Minimum information principle (atomicity)
Each card tests exactly one atomic piece of knowledge. This is the single highest-impact design decision.
Why it matters for SRS: Anki's scheduling algorithm models each card as having a single forgetting curve. A card that tests multiple facts is a superposition of multiple curves decaying at different rates, producing a flattened, non-exponential curve that no algorithm can optimally schedule. When the learner lapses, the algorithm cannot identify which sub-fact was forgotten, so it resets the entire card. Research shows poorly formulated multi-fact cards can require up to 300% more repetitions than well-formulated atomic cards.
Target: Each card should be answerable in under 6 seconds during review. If a card regularly takes longer, it likely violates atomicity and should be split.
3. Production over recognition
Cards must require the learner to produce an answer from memory, not merely recognize it. This exploits the testing effect (meta-analytic effect size d = 0.50-0.61), where retrieving information strengthens memory traces far more than re-reading. Free-recall and cloze formats engage deeper prefrontal-hippocampal encoding circuits than recognition formats.
In practice: Avoid yes/no or true/false questions. Frame cards so the answer must be generated, not selected. A card like "Is copper a good conductor? | Yes" is weak. Prefer: "Name a metal that is a good electrical conductor | Copper" or "Why is copper used for electrical wiring? | Copper has low resistivity because its outer electron is weakly bound and moves freely as a delocalised charge carrier."
4. Depth of processing
Cards that require semantic reasoning produce 2-3x the retention of cards testing surface-level facts. Wherever possible, frame questions using "why," "how," or "explain" to force elaborative processing rather than rote retrieval. This is especially valuable for exam preparation, where explain/justify questions carry the most marks.
5. Dual coding
<!-- DISABLED: Do not output #image-candidate tags or any visual annotations in the generated cards. The output is directly imported into Anki and must be clean Question | Answer lines with no metadata. The existing exclusion rule ("do not create questions that depend on interpreting a diagram or visual to answer") still applies. This principle is retained here as design rationale only — the learner may choose to attach images manually in Anki after import. -->Combining verbal and visual encoding creates two independent retrieval pathways, exploiting the picture superiority effect. When the source contains diagrams, graphs, or spatial information, extract all factual content from them and convert it into text-based cards. The learner may later attach images to these cards manually in Anki, but the generated output must not include image tags, comments, or any markup beyond the standard Question | Answer format.
6. Personal connection and self-reference
Where the content allows, frame cards using concrete, relatable scenarios rather than abstract statements. Connecting knowledge to tangible situations activates richer encoding networks and improves recall. This is particularly useful for "explain" cards where a real-world application can serve as the prompt.
Why does a metal spoon feel colder than a wooden spoon at the same temperature? | Metal has higher thermal conductivity, so it transfers thermal energy away from your hand faster, producing a greater rate of heat loss
Card Types
Select the card type that best fits the knowledge being tested. A single source topic will typically use a mix of several types.
Definition cards (forward + reverse)
For key terms and concepts. Always create both directions to build bidirectional retrieval links, strengthening the association from both term-to-meaning and meaning-to-term. This forces the brain to form two distinct retrieval routes, reducing the chance that the knowledge becomes accessible from only one direction.
What is [term]? | [definition]
[definition] — what term describes this? | [term]
Explain/justify cards
For concepts where understanding the reasoning matters, not just the fact. These target common "explain" and "justify" style exam questions (typically 2-4 marks).
Answers must include the full cause-and-effect chain, not just restate the fact. The goal is to train the learner to reproduce the reasoning under exam conditions. "Because of temperature" is not an acceptable answer. State the mechanism: what happens, why it happens, and what effect it produces. If the chain has multiple steps, include all of them. However, if the chain has more than 3 logical steps, split into multiple cards that each cover a segment of the chain plus one linking card that tests the overall sequence.
Explain why [phenomenon occurs] | [reasoning with cause-and-effect chain]
Why does [X] lead to [Y]? | [mechanism/reasoning]
Cloze-style cards
For facts embedded in context where the surrounding sentence provides a natural retrieval cue. Cloze deletion exploits the generation effect (meta-analytic d = 0.40): producing a missing word from context engages broader neural encoding than simple Q&A. It also dramatically speeds card creation for dense factual material.
Rules for cloze cards:
- Delete exactly one semantically critical keyword per card. Deleting function words or words recoverable from grammar alone produces trivial pattern-matching, not genuine recall.
- If a sentence contains multiple important terms, create separate cloze cards for each, deleting only one per card.
- The surrounding context must not make the answer trivially obvious. If the sentence structure gives away the answer, rephrase.
The SI unit of electrical resistance is the [...] | ohm (Ω)
In a series circuit, the current is [...] at all points | the same
Ohm's law states that V = [...] | IR
Compare/contrast cards (interference prevention)
For related concepts that are commonly confused or examined together. These cards serve a dual purpose: they test knowledge and they directly combat interference, which is the primary cause of forgetting in mature SRS collections.
Both sides of the comparison must be addressed in the answer so the learner understands the actual distinction. When two concepts share surface similarities but differ in mechanism or outcome, make the card highlight the specific point of divergence.
How does [concept A] differ from [concept B]? | [A does X because of mechanism P; B does Y because of mechanism Q]
What is the similarity between [A] and [B]? | [shared properties]
Formula and equation cards
For mathematical relationships. Create the formula card plus at least one application card that requires identifying when and why the formula is used, not just what it is.
What is the equation for kinetic energy? | Ek = ½mv²
When calculating the energy of a moving object, which equation is used? | Ek = ½mv² (kinetic energy equation)
State Ohm's law in equation form | V = IR
A component has a potential difference of 6V and current of 2A. What is its resistance? | R = V/I = 6/2 = 3Ω
Keep calculation cards to single-step applications only. Multi-step numerical problems are not suitable for flashcard review.
Enumeration cards (sets and lists)
When the source contains a set of items (e.g., types of electromagnetic radiation, Newton's three laws), avoid creating a single card that asks the learner to recall the entire list. Instead, use one of these approaches:
Preferred — individual cards per item:
What type of electromagnetic radiation has the longest wavelength? | Radio waves
Which EM radiation is used in thermal imaging? | Infrared
Acceptable — overlapping cloze for short lists (3-5 items):
Newton's three laws: 1) Inertia, 2) [...], 3) Action-reaction | F = ma (force equals mass times acceleration)
Newton's three laws: 1) [...], 2) F = ma, 3) Action-reaction | An object remains at rest or in uniform motion unless acted on by a resultant force (inertia)
Avoid: "List all seven types of EM radiation in order" — this is a multi-fact card that violates atomicity.
Card Design Rules
Conciseness
Use simple, direct language. Strip unnecessary words. Short answers are easier to self-assess during review ("Did I get it right?"), and reduce the temptation to passively read rather than actively recall. Aim for answers under 25 words for factual cards. Explain cards may be longer but should still be as concise as the reasoning chain allows.
Unambiguous phrasing
Each question must have exactly one correct answer. If a question could reasonably be answered multiple ways, it will produce inconsistent self-grading that corrupts the SRS scheduling signal. Rephrase to be more specific.
Bad: "What is important about copper?" (ambiguous — conductivity? ductility? colour?) Good: "Why is copper used for electrical wiring?" (targets one specific property)
Bidirectional links for definitions
Always create both forward (term → definition) and reverse (definition → term) cards for key terms. Each direction tests a different retrieval pathway. The forward card tests comprehension; the reverse card tests vocabulary recall. Both are needed for flexible knowledge access.
Interference management
After generating all cards, scan the set for pairs that are likely to be confused with each other (similar terms, similar mechanisms, similar values). For each confusable pair, ensure at least one dedicated compare/contrast card exists that directly highlights the distinguishing feature. This is the primary defense against interference, which research identifies as the single greatest cause of forgetting in mature SRS collections.
Common high-interference situations:
- Terms with similar names (e.g., fission vs fusion, elastic vs inelastic)
- Quantities with the same units but different meanings
- Processes that share steps but diverge at a key point
- Formulas with similar structure (e.g., Ek = ½mv² vs E = mc²)
Leech prevention through card design
A leech is a card that is repeatedly forgotten despite multiple reviews. Most leeches are caused by poor card design, not inherently difficult content. Before a card becomes a leech, address the root cause:
- Violates atomicity → Split into smaller cards
- Ambiguous question → Rephrase to have exactly one clear answer
- Interference with another card → Add a discriminative comparison card
- No understanding behind it → The learner needs to study the concept before memorising it; this card should not exist yet
- Missing a mnemonic hook → Add a vivid or unusual association in the answer to make it distinctive
Exclusions
Do not create:
- Questions that depend on interpreting a diagram or visual to answer (factual content shown in diagrams should still be converted into text-based cards)
- Multi-step numerical calculations (single-step formula application is fine)
- Yes/no or true/false questions (these test recognition, not production)
- Cards that list more than 3 items in the answer (split into individual cards instead)
- Cards for content the source does not adequately explain (understanding must precede memorisation)
Coverage Guidance
Aim for thorough coverage of the source material. As a rough guide, a typical A-level topic page should yield 10-25 cards depending on density. Prioritise content by examinability:
- High priority: Definitions, laws, key equations, and relationships that appear repeatedly in exam mark schemes
- High priority: Common explain/justify points, especially multi-step reasoning chains that students typically struggle to reproduce
- Medium priority: Frequently confused pairs (generate compare/contrast cards)
- Medium priority: Units, standard values, and conditions
- Lower priority: Supplementary context, historical details, or edge cases (include only if the source emphasises them)
Do not pad with trivial or redundant cards. Every card should earn its place in the deck by testing knowledge the learner genuinely needs to retrieve under exam conditions.
Output Format
One card per line, question and answer separated by a pipe:
Question | Answer
Example output:
What is the unit of electrical resistance? | Ohm (Ω)
A material that allows electric current to flow through it is called what? | A conductor
Define specific heat capacity | The energy required to raise the temperature of 1 kg of a substance by 1°C
The energy required to raise 1 kg of a substance by 1°C — what quantity is this? | Specific heat capacity
The SI unit of energy is the [...] | joule (J)
Explain why resistance increases with temperature in a metal | At higher temperatures, metal ions vibrate with greater amplitude, so conduction electrons collide more frequently with ions, transferring less charge per unit time
How does electrical conduction differ between metals and semiconductors? | In metals, resistance increases with temperature (more ion vibrations impede electron flow). In semiconductors, resistance decreases with temperature (more electrons gain enough energy to enter the conduction band, increasing the number of charge carriers)
What is the equation for kinetic energy? | Ek = ½mv²
When calculating the energy of a moving object, which equation is used? | Ek = ½mv² (kinetic energy equation)
Why does a metal spoon feel colder than a wooden spoon at the same temperature? | Metal has higher thermal conductivity, so it transfers thermal energy away from your hand at a greater rate, producing faster heat loss
Quality Checklist
- All bolded/highlighted terms covered with both forward and reverse cards
- Higher Tier content included
- Every card tests exactly one atomic fact or one reasoning chain (no multi-fact cards)
- Questions require production, not recognition (no yes/no or true/false)
- Explain cards include the full cause-and-effect chain, not just restated facts
- Compare cards address both sides of the comparison with the specific point of divergence
- Confusable pairs identified and covered by dedicated compare/contrast cards
- No diagram-dependent or multi-step calculation questions
- Formula cards include both recall ("State the equation for...") and application ("Which equation is used when...") variants
- Enumeration/list content split into individual atomic cards
- Cloze cards delete exactly one semantically critical keyword each
- Factual content from diagrams/visuals in the source extracted into text-based cards
- Every question has exactly one unambiguous correct answer
- Clear, concise phrasing throughout (target under 25 words for factual answers)
Source
git clone https://github.com/maaarcooo/claude-skills/blob/main/anki-flashcard-generator/SKILL.mdView on GitHub Overview
Generates Anki flashcards directly from PDF or Markdown content in anki-importable format. Cards are designed using evidence-based cognitive principles to optimize active recall and long-term retention under spaced repetition. Each card is produced as a single line in the format 'Question | Answer' for easy import.
How This Skill Works
Reads the source (PDF or Markdown), validates accuracy, and extracts key content (bold terms, highlights, higher-tier material). It then selects appropriate card types, runs an interference check for confusable pairs, and outputs one line per card in the exact 'Question | Answer' format.
When to Use It
- You have a PDF or Markdown study material and want it converted into an Anki deck
- You need atomic, single-fact cards that fit cleanly into SRS scheduling
- You want production-over-recognition prompts to maximize recall
- You require an interference check to minimize confusable card pairs
- You need an import-ready deck formatted as Question | Answer for Anki
Quick Start
- Step 1: Provide a source PDF or Markdown file containing study material
- Step 2: Run the generator to produce cards in the 'Question | Answer' format
- Step 3: Import the output into Anki and sync your deck
Best Practices
- Use content the learner already understands; avoid introducing new concepts in initial cards
- Ensure each card tests a single fact (atomicity); split multi-fact content
- Favor recall prompts (What/Why/How) over Yes/No questions
- Craft prompts that require explanation or justification to deepen processing
- Run interference checks and add discriminative cards for confusable pairs; keep answers quick (under 6 seconds)
Example Use Cases
- Convert a biology PDF syllabus into an Anki deck with atomic, recallable questions
- Turn a Markdown lecture notes file into an exam-prep deck for coursework
- Create a legal concepts deck from case briefs with questions on standards and holdings
- Generate a programming fundamentals deck from Markdown notes for coding interviews
- Build a historical dates and events deck from class notes for quick recall