Anki Card Creator
by @aipoch-ai
Convert medical textbook content, lecture notes, and study materials into Anki flashcards using spaced repetition optimization. Supports multiple card types...
clawhub install anki-card-creatorπ About This Skill
name: anki-card-creator description: Convert medical textbook content, lecture notes, and study materials into Anki flashcards using spaced repetition optimization. Supports multiple card types (basic, cloze, image occlusion) with automated tagging and deck organization for efficient medical exam preparation. allowed-tools: [Read, Write, Bash, Edit] license: MIT metadata: skill-author: AIPOCH
Anki Card Creator
Overview
Intelligent flashcard generation tool that transforms medical study materials into Anki-compatible cards optimized for long-term retention through evidence-based spaced repetition.
Key Capabilities:
When to Use
β Use this skill when:
β Do NOT use when:
Integration:
abstract-summarizer (textbook chapter condensation), pdf-text-extractor (content extraction)anki-sync-server (cloud backup), study-schedule-optimizer (review planning)Core Capabilities
1. Cloze Deletion Generation
Create fill-in-the-blank cards from dense text:
from scripts.card_creator import AnkiCardCreatorcreator = AnkiCardCreator()
Generate cloze cards from text
text = """
Acute inflammation is characterized by five cardinal signs:
redness (rubor), heat (calor), swelling (tumor), pain (dolor),
and loss of function (functio laesa). These result from
vasodilation, increased vascular permeability, and leukocyte
infiltration.
"""cards = creator.create_cloze_cards(
text=text,
n_cards=3, # Generate 3 cards from this text
difficulty="intermediate",
tags=["Pathology", "Inflammation", "General_Pathology"]
)
Output format (Anki-compatible)
Card 1: "Acute inflammation is characterized by {{c1::five}} cardinal signs..."
Card 2: "...signs: {{c1::redness}} (rubor), {{c2::heat}} (calor)..."
Cloze Strategies: | Strategy | Use Case | Example | |----------|----------|---------| | Single Deletion | Key facts | "The {{c1::liver}} is the largest internal organ" | | Multiple Deletions | Lists/groups | "CRAB symptoms: {{c1::Calcium}}, {{c2::Renal}}, {{c3::Anemia}}, {{c4::Bone}}" | | Hierarchical | Progressive detail | "{{c1::Metformin}} is a {{c2::biguanide}} that {{c3::decreases hepatic glucose production}}" |
2. Basic and Reversible Cards
Generate question-answer pairs:
# Create basic cards
cards = creator.create_basic_cards(
content={
"What is the mechanism of action of penicillin?":
"Inhibition of bacterial cell wall synthesis by binding to PBPs",
"What are the major side effects of ACE inhibitors?":
"Dry cough, hyperkalemia, angioedema, hypotension"
},
reversible=True, # Create reverse cards too
tags=["Pharmacology", "Antibiotics"]
)
Card Types:
3. Image Occlusion Cards
Create visual learning cards from diagrams:
# Image occlusion for anatomy
cards = creator.create_image_occlusion(
image_path="brachial_plexus.png",
occlude_regions=[
{"label": "Musculocutaneous nerve", "coords": (120, 200, 200, 240)},
{"label": "Median nerve", "coords": (300, 250, 380, 290)},
{"label": "Ulnar nerve", "coords": (400, 280, 480, 320)}
],
card_type="one_by_one" # or "all_at_once"
)
Occlusion Types:
4. Smart Tagging and Organization
Automatically organize cards into logical hierarchies:
# Auto-tag based on content
cards = creator.process_textbook_chapter(
chapter_text=pathoma_chapter,
source="Pathoma - Hematopoiesis",
auto_tag=True,
tag_hierarchy=[
"Pathoma",
"{{chapter_name}}",
"{{section_name}}"
]
)Results in tags like:
Pathoma::Hematopoiesis::Red_Cell_Disorders
Pathoma::Hematopoiesis::White_Cell_Disorders
Tagging Strategies:
Common Patterns
Pattern 1: Textbook Chapter Conversion
Scenario: Convert entire First Aid chapter to Anki deck.
# Extract and convert chapter
python scripts/main.py \
--input first_aid_cardiology.pdf \
--chapter "Ischemic Heart Disease" \
--card-type cloze \
--n-cards-per-page 3 \
--tags "First_Aid::Cardiology::IHD" \
--output ischemic_heart_disease.apkgImport directly to Anki
File ready for import with media included
Workflow: 1. Read chapter for understanding first 2. Run conversion tool 3. Review generated cards for accuracy 4. Import to Anki 5. Study with standard spaced repetition
Pattern 2: Drug Cards with Images
Scenario: Create comprehensive pharmacology cards.
# Generate drug cards with mechanisms
drugs = [
{
"name": "Metformin",
"class": "Biguanide",
"mechanism": "Activates AMPK, decreases hepatic gluconeogenesis",
"indications": "Type 2 diabetes, PCOS",
"side_effects": "GI upset, lactic acidosis (rare), B12 deficiency",
"image": "metformin_structure.png"
}
]cards = creator.create_drug_cards(
drugs=drugs,
include_structures=True,
include_mechanism_diagrams=True,
tags=["Pharmacology", "Diabetes", "First_Line"]
)
Card Format:
Front: Metformin - Class?
Back: Biguanide
Tags: Pharmacology::Diabetes::First_LineFront: Metformin - Mechanism?
Back: Activates AMPK β decreases hepatic gluconeogenesis
Image: [mechanism diagram]
Tags: Pharmacology::Diabetes::Mechanism
Front: Metformin - Side effects?
Back: GI upset, lactic acidosis (rare), B12 deficiency
Tags: Pharmacology::Diabetes::Side_Effects
Pattern 3: Pathology Differential Cards
Scenario: Create cards for differential diagnosis practice.
# Differential diagnosis cards
cards = creator.create_differential_cards(
condition="Cough with hemoptysis",
differentials=[
{"diagnosis": "Lung cancer", "key_features": "Smoker, weight loss, mass on CT"},
{"diagnosis": "TB", "key_features": "Immigrant, night sweats, cavitary lesion"},
{"diagnosis": "PE", "key_features": "Sudden onset, tachypnea, D-dimer elevated"},
{"diagnosis": "Bronchiectasis", "key_features": "Chronic cough, purulent sputum, dilated airways"}
],
card_type="compare_contrast"
)
Card Types:
Pattern 4: Lecture Notes to Cards
Scenario: Convert professor's lecture slides to study cards.
# Process lecture PDF
python scripts/main.py \
--input lecture_slides.pdf \
--source "Dr_Smith_Cardiology_Lecture_5" \
--card-type mixed \
--extract-images \
--auto-tag \
--output cardiology_lecture_5.apkgReview and edit in Anki
Delete low-yield cards
Add personal mnemonics
Post-Processing Tips:
Complete Workflow Example
Building comprehensive USMLE Step 1 deck:
# Step 1: Process multiple sources
python scripts/main.py \
--input first_aid_pathology.pdf \
--source "First_Aid_2024" \
--card-type cloze \
--tags "First_Aid::Pathology" \
--output fa_pathology.apkgpython scripts/main.py \
--input sketchy_pharm.pdf \
--source "Sketchy_Pharm" \
--card-type basic \
--include-images \
--tags "Sketchy::Pharm" \
--output sketchy_pharm.apkg
Step 2: Merge decks
python scripts/main.py \
--merge fa_pathology.apkg sketchy_pharm.apkg \
--output usmle_step1_master.apkgStep 3: Add leech tags for difficult cards
python scripts/main.py \
--input usmle_step1_master.apkg \
--tag-leeches \
--leech-threshold 8 \
--output usmle_step1_tagged.apkg
Python API:
from scripts.card_creator import AnkiCardCreator
from scripts.importers import PDFImporterInitialize
creator = AnkiCardCreator()
importer = PDFImporter()Import and process textbook
content = importer.import_pdf(
path="robbins_pathologic_basis_of_disease.pdf",
pages="150-200", # Inflammation chapter
extract_images=True
)Create cloze cards
cards = creator.create_cloze_cards(
text=content.text,
images=content.images,
n_cards=50,
difficulty="advanced",
tags=["Robbins", "General_Pathology", "Inflammation"]
)Add image occlusion for diagrams
for diagram in content.diagrams:
occlusion_cards = creator.create_image_occlusion(
image=diagram,
auto_detect_labels=True
)
cards.extend(occlusion_cards)Export Anki package
creator.export_apkg(
cards=cards,
deck_name="Robbins_Inflammation",
output_path="robbins_inflammation.apkg"
)print(f"Created {len(cards)} cards ready for Anki import")
Quality Checklist
Card Quality:
Educational Value:
Technical Quality:
Before Study:
Common Pitfalls
Content Issues:
Card Design Issues:
Study Strategy Issues:
References
Available in references/ directory:
anki_format_spec.md - Anki .apkg file format specificationsspaced_repetition_principles.md - Evidence-based SRS guidelinescard_design_best_practices.md - Effective flashcard designusmle_high_yield_facts.md - High-yield content for boardsimage_sources.md - Open-access medical imagestagging_conventions.md - Standardized tag hierarchiesScripts
Located in scripts/ directory:
main.py - CLI interface for card creationcard_creator.py - Core card generation enginecloze_generator.py - Cloze deletion algorithmsimage_occlusion.py - Visual card creationpdf_importer.py - Textbook and slide importtag_manager.py - Automated tagging systemmedia_handler.py - Image download and optimizationanki_exporter.py - .apkg file generationLimitations
Parameters
| Parameter | Type | Default | Required | Description |
|-----------|------|---------|----------|-------------|
| --input, -i | string | - | No | Input text file with Q&A pairs |
| --output, -o | string | anki_cards.txt | No | Output file (Anki TSV format) |
| --drug | flag | - | No | Create drug information card |
| --anatomy | flag | - | No | Create anatomy card |
| --name | string | - | No | Drug or structure name |
| --mechanism | string | - | No | Mechanism of action (for drug cards) |
| --indications | string | - | No | Clinical indications (for drug cards) |
| --side-effects | string | - | No | Side effects (for drug cards) |
| --location | string | - | No | Anatomical location (for anatomy cards) |
| --function | string | - | No | Function (for anatomy cards) |
Usage
Basic Usage
# Create drug card
python scripts/main.py --drug --name "Metformin" --mechanism "Decreases hepatic glucose production" --indications "Type 2 diabetes" --output metformin.txtCreate anatomy card
python scripts/main.py --anatomy --name "Coronary arteries" --location "Surface of heart" --function "Supply oxygenated blood to myocardium" --output coronary.txtParse Q&A file
python scripts/main.py --input questions.txt --output deck.txt
Input File Format
Q: What is the mechanism of action of Metformin?
A: Decreases hepatic glucose production, increases insulin sensitivityQ: Which artery supplies the left ventricle?
A: Left anterior descending artery (LAD)
Risk Assessment
| Risk Indicator | Assessment | Level | |----------------|------------|-------| | Code Execution | Python script executed locally | Low | | Network Access | No external API calls | Low | | File System Access | Read input file, write to output file | Low | | Instruction Tampering | Standard prompt guidelines | Low | | Data Exposure | Output saved only to specified location | Low |
Security Checklist
Prerequisites
# Python 3.7+
No additional packages required (uses standard library)
Evaluation Criteria
Success Metrics
Test Cases
1. Drug Card: Create Metformin card β Valid TSV output with formatted front/back 2. Anatomy Card: Create coronary artery card β Valid TSV with location and function 3. File Parse: Parse Q&A text file β Multiple cards generatedLifecycle Status
π§ Study Tip: The best flashcard is one you'll actually review. Create cards for material you genuinely need to memorize, and keep the daily review load sustainable. Quality over quantityβbetter to deeply learn 1000 cards than superficially memorize 5000.
β‘ When to Use
π‘ Examples
Basic Usage
# Create drug card
python scripts/main.py --drug --name "Metformin" --mechanism "Decreases hepatic glucose production" --indications "Type 2 diabetes" --output metformin.txtCreate anatomy card
python scripts/main.py --anatomy --name "Coronary arteries" --location "Surface of heart" --function "Supply oxygenated blood to myocardium" --output coronary.txtParse Q&A file
python scripts/main.py --input questions.txt --output deck.txt
Input File Format
Q: What is the mechanism of action of Metformin?
A: Decreases hepatic glucose production, increases insulin sensitivityQ: Which artery supplies the left ventricle?
A: Left anterior descending artery (LAD)
βοΈ Configuration
# Python 3.7+
No additional packages required (uses standard library)