Michael Guard

How My Anki Flashcard Generator Works

May 12, 2026

My wife and I love France and wanted to get better at the language, so we started lessons with Bill Savage. (He’s excellent, by the way.)

For memorization, I love Anki flashcards, but they’re a pain to make, so I vibe-coded a CLI tool that automates the most annoying parts. Here’s how it works:

  1. During lessons, Bill sends WhatsApp photos of the whiteboard notes.

Photos from tutor

  1. After the lesson, I drop those photos into a Claude Project that’s set up to spit out a markdown file with one term per line.

Photos dropped into Claude Project

Claude Project instructions

Markdown file output

  1. I run a CLI script that loops through each term and calls the Anthropic API. Claude returns structured JSON for each word: gender, pronunciation, French/English explanations, and 3–5 example sentences (line-matched across both languages).

Python script

  1. The script validates every flashcard for missing fields, wrong example counts, and malformed data before showing me anything.

  2. Flashcards print to the terminal so I can scan them. Anything broken gets flagged.

  3. After I confirm the output, the script sends the flashcards to Anki via the AnkiConnect plugin. It auto-skips any duplicate terms.

Created Anki flashcard

  1. Every batch gets logged to card_log.jsonl with note IDs. If a batch turns out bad, --rollback deletes the last import.

  2. I hit Sync in Anki to push to AnkiWeb.

  3. Study Anki flashcards!

Study Anki flashcards

The full stack is Python, Anthropic SDK, and AnkiConnect. Runs me about $1.40/month in API costs for ~20 flashcards/week. You could argue that creating flashcards manually is better for learning but in practice the manual effort caused me to 1) make fewer flashcards 2) the flashcards I did make were less useful (e.g. no pronunciation or example sentences).