Japanese Anki
Overview
Use this skill when the user wants an end-to-end Codex workflow for turning one Japanese sentence into two Anki cards. Codex should generate the language content directly, ask for confirmation before writing anything, and then use the bundled script to add the notes through AnkiConnect.
Workflow
- Take one Japanese sentence from the user.
- Generate exactly these items in the chat:
- 2 natural Japanese rewrites
- 2 realistic usage scenarios in Chinese
- 1 short explanation in Chinese about nuance and usage
- Show the generated content clearly.
- Ask the user whether to add the cards to Anki.
- Only after the user confirms, call
scripts/add_anki_notes.pyto create the notes.
Output Requirements
Keep the generated content concise and natural.
- Rewrites: They should sound like something a native speaker would actually say in everyday context. Avoid stiff textbook phrasing unless the original sentence is formal.
- Scenarios in Chinese: They should describe realistic situations, not generic labels. Short is fine.
- Explanation in Chinese: Keep it brief and practical. Focus on tone, nuance, or where the sentence fits naturally.
Card Format
Create exactly two Anki notes using the configured deck and note type.
Card 1:
- Front: the two Chinese usage scenarios
- Back: the two Japanese rewrites
Card 2:
- Front: the original Japanese sentence
- Back: the Chinese explanation plus the two Japanese rewrites
The helper script expects this JSON shape:
{
"original_sentence": "今日は早めに失礼しよかと",
"rewrites": [
"今日は先に失礼しますね",
"今日はちょっと早めに帰ろうかな"
],
"scenarios_zh": [
"下班时对同事这样说",
"和朋友聊天时表示今天想早点走"
],
"explanation_zh": "这句话比较口语,带有一点试探和自言自语的感觉。"
}
Running The Helper
Use the bundled script:
Recommended flow:
- Write the JSON payload to a temporary file in
/tmp. - Run:
python3 /Users/dongdong/.codex/skills/japanese-anki/scripts/add_anki_notes.py /tmp/<payload>.json - Report success or any error returned by the script.
- Delete the temporary JSON payload from
/tmpafter the script returns.
Configuration
The helper script reads these optional environment variables:
ANKI_CONNECT_URLDefaults tohttp://localhost:8765ANKI_DECKDefaults toJapanese ReadingANKI_NOTE_TYPEDefaults toBasic
Assume Basic unless the user explicitly wants a different note type.
Failure Handling
If Anki is not open or AnkiConnect is unavailable, explain that clearly and do not pretend the notes were added.
If the note type is missing or incompatible with Front and Back, tell the user to switch to Basic or provide a compatible note type.
If the deck is missing, the helper script will try to create it first.
Always clean up the temporary payload file after execution, even if note creation fails.