Skill: chndranndr/japanese-tutor (version 1.0.2)

--- name: japanese-tutor description: Interactive Japanese learning assistant. Supports vocabulary, grammar, quizzes, roleplay, PDF/DOCX material parsing for study/homework help, and OCR translation. --- # Japanese Tutor ## Overview This skill transforms the agent into a helpful, relaxed Japanese tutor. It helps the user learn Japanese through vocabulary building, grammar explanations, quizzes, conversation practice, and handling course materials (PDF/DOCX). ## Core Capabilities ### 1. Vocabulary Practice - **Teach New Words**: Introduce 3-5 related words at a time. - **Word of the Day**: Provide a single interesting word with meaning, reading, and example. - **Reference**: See `references/vocab.md`. ### 2. Grammar Explanations - **Simplify Rules**: Explain grammar points clearly. - **Examples**: Always provide 2-3 example sentences. - **Reference**: See `references/grammar.md`. ### 3. Study Helper (PDF/DOCX) - **Material Ingestion**: 1. Parse PDF materials using `scripts/parse_pdf_gemini.py` (uses Gemini Vision for OCR/layout analysis). 2. Extract new vocabulary and grammar points. 3. **Persist Knowledge (Critical)**: - Append new vocabulary to `references/vocab.md` (Format: `- **Word**: Meaning`). - Append new grammar to `references/grammar.md` (Format: `## Rule \n Explanation...`). - If the material is a specific lesson, create/update `references/lesson_X.md` to keep it organized. 4. Explain the content to the user and confirm it has been saved to references. - **Homework Assistance**: 1. Parse homework files (PDF via `scripts/parse_pdf_gemini.py` or DOCX via `scripts/parse_docx.py`). 2. Identify the tasks/questions. 3. **Do not just give answers.** Explain the concept, provide a similar example, and guide the user to the solution. 4. **Save Learnings**: If new concepts appear, save them to the references files as above. ### 4. OCR & Translation - **Image Translation**: If user uploads an image (kanji/text), use native vision to read it, then provide: - Transcription (Kana/Kanji). - Reading (Romaji/Furigana). - Meaning (Translation). - **Text Translation**: Translate typed Japanese/English text with nuance explanations. ### 5. Quiz Mode - **Vocab/Grammar Quiz**: Test user on known or newly ingested material. ## Usage Guidelines - **Tone**: Encouraging, patient, fun. (Jaksel/Relaxed style if requested). - **Homework Ethics**: Guide, don't just solve. Explain the *why*. - **Parsing**: Use the provided scripts for file handling. ## Quick Actions - **"Parsin ini dong"**: Use scripts to read attached PDF/DOCX. - **"Bantuin PR ini"**: Read file, explain concepts, guide user. - **"Artinya apa ini?"**: Translate text or attached image. ## Resources - `references/vocab.md`: N5 Level Vocabulary lists. - `references/grammar.md`: Basic Grammar rules. - `scripts/greet.py`: Time-appropriate greeting. - `scripts/parse_pdf.py`: Extract text from PDF files. - `scripts/parse_docx.py`: Extract text from DOCX files.

path: references/grammar.md
content: # Japanese Grammar - Beginner Level

## Sentence Structure
Japanese uses **Subject - Object - Verb (SOV)** structure.
*   English: I eat an apple. (S-V-O)
*   Japanese: I apple eat. (S-O-V) -> *Watashi wa ringo o tabemasu.*

## Particles (Josh)
Particles are small suffixes that indicate the function of a word in a sentence.

### Wa (は) - Topic Marker
Marks the topic of the sentence. Pronounced "wa" but written as "ha".
*   *Watashi **wa** Tanaka desu.* (As for me, I am Tanaka.)

### Ga (が) - Subject Marker
Marks the grammatical subject. Often used with specific verbs (likes/dislikes, ability) or for new information.
*   *Neko **ga** imasu.* (There is a cat.)
*   *Watashi wa sushi **ga** suki desu.* (I like sushi.)

### O (を) - Object Marker
Marks the direct object of an action. Pronounced "o" (sometimes "wo").
*   *Mizu **o** nomimasu.* (Drink water.)

### Ni (に) - Target/Time/Location Marker
Indicates movement toward a place, a specific time, or location of existence.
*   *Gakkou **ni** ikimasu.* (Go **to** school.)
*   *Rokuji **ni** okimasu.* (Wake up **at** 6 o'clock.)

### De (で) - Context/Means Marker
Indicates where an action takes place or by what means.
*   *Basu **de** ikimasu.* (Go **by** bus.)
*   *Resutoran **de** tabemasu.* (Eat **at** a restaurant.)

### No (の) - Possession Marker
Indicates possession or modifies nouns. Works like "'s" in English.
*   *Watashi **no** hon.* (My book.)

### Ka (か) - Question Marker
Added to the end of a sentence to turn it into a question.
*   *Genki desu **ka**?* (Are you well?)

## Basic Verb Conjugation

### Desu (To be)
- Present Affirmative: **Desu** (It is)
- Present Negative: **Ja arimasen** (It is not)
- Past Affirmative: **Deshita** (It was)
- Past Negative: **Ja arimasen deshita** (It was not)

### Masu Form (Polite Verbs)
- Present Affirmative: **-masu** (Tabemasu - eat)
- Present Negative: **-masen** (Tabemasen - don't eat)
- Past Affirmative: **-mashita** (Tabemashita - ate)
- Past Negative: **-masen deshita** (Tabemasen deshita - didn't eat)


path: references/grammar_lesson2.md
content: # Lesson 2 Grammar (From PDF)

## Demonstratives (Ko-So-A-Do System)

### 1. Kore, Sore, Are (Pronouns)
Stand alone as nouns.
- **Kore (これ)**: Ini (dekat pembicara)
- **Sore (それ)**: Itu (dekat lawan bicara)
- **Are (あれ)**: Itu (jauh dari keduanya)
- **Dore (どれ)**: Yang mana?

*Example:*
- *Kore wa hon desu.* (Ini buku.)
- *Sore wa kaban desu.* (Itu tas.)

### 2. Kono, Sono, Ano (Determiners)
Must be followed by a noun. Cannot stand alone.
- **Kono (この) + Noun**: Benda ini...
- **Sono (その) + Noun**: Benda itu...
- **Ano (あの) + Noun**: Benda itu (sana)...
- **Dono (どの) + Noun**: Benda yang mana?

*Example:*
- *Kono hon wa watashi no desu.* (Buku ini milik saya.)
- *Ano hito wa dare desu ka?* (Orang itu siapa?)

## Particle No (の)
Indicates possession, origin, or content.
- **Structure**: Noun1 **no** Noun2 (Noun2 of Noun1)

1. **Possession**: *Watashi **no** hon* (Buku saya).
2. **Origin/Maker**: *Nihon **no** kuruma* (Mobil buatan Jepang).
3. **Content**: *Eigo **no** zasshi* (Majalah Bahasa Inggris).

## Particle Ka (か) for Choice
Used to present alternatives.
- **Structure**: [A] desu **ka**, [B] desu **ka**? (Is it A or B?)

*Example:*
- *Kore wa "shi" desu ka, "tsu" desu ka?* (Ini huruf "shi" atau "tsu"?)
- *Kōhī desu ka, ocha desu ka?* (Kopi atau teh?)

## Question Words (Gimonshi)
- **Nan / Nani (何)**: Apa?
- **Dare / Donata (だれ / どなた)**: Siapa? (Donata is more polite)
- **Doko (どこ)**: Di mana?
- **Itsu (いつ)**: Kapan?


path: references/lesson_1.md
content: # Pelajaran 1: Kalimat Dasar & Kosakata Profesi

## 1. Kosakata (Kotoba)

### Profesi (Shokugyou)
- **Sensei (先生)**: Guru
- **Gakusei (学生)**: Siswa / Mahasiswa
- **Isha (医者)**: Dokter
- **Kaishain (会社員)**: Karyawan Perusahaan
- **Kenkyuusha (研究者)**: Peneliti
- **Puroguramaa (プログラマー)**: Programmer
- **Ginkouin (銀行員)**: Pegawai Bank

### Keluarga (Kazoku)
- **Sofu (祖父)**: Kakek
- **Sobo (祖母)**: Nenek
- **Chichi (父)**: Ayah
- **Haha (母)**: Ibu
- **Ani (兄)**: Kakak Laki-laki
- **Ane (姉)**: Kakak Perempuan
- **Otouto (弟)**: Adik Laki-laki
- **Imouto (妹)**: Adik Perempuan

### Kewarganegaraan
- **Nihonjin (日本人)**: Orang Jepang
- **Amerikajin (アメリカ人)**: Orang Amerika
- **Igirisujin (イギリス人)**: Orang Inggris
- **Indoneshiajin (インドネシア人)**: Orang Indonesia

## 2. Tata Bahasa (Bunpou)

### A. Kalimat Positif (～は～です)
Pola: **[Topik/Subjek] wa [Predikat] desu.**
- Digunakan untuk menyatakan identitas, profesi, atau sifat.
- **Contoh:**
  - *Watashi wa Gojou desu.* (Saya adalah Gojo.)
  - *Gojou-san wa sensei desu.* (Gojo-san adalah guru.)

### B. Kalimat Tanya (～は～ですか)
Pola: **[Topik] wa [Predikat] desu ka?**
- Partikel **ka** di akhir kalimat berfungsi sebagai tanda tanya.
- **Contoh:**
  - *Anata wa Gojou-san desu ka?* (Apakah Anda Gojo?)
  - *Gojou-san wa sensei desu ka?* (Apakah Gojo adalah guru?)

### C. Partikel "Juga" (～も)
Pola: **[Topik] mo [Predikat] desu.**
- Partikel **mo** menggantikan **wa** ketika predikatnya sama dengan pernyataan sebelumnya.
- **Contoh:**
  - *Watashi mo gakusei desu.* (Saya juga siswa.)
  - *Fushiguro-san mo otoko desu.* (Fushiguro juga laki-laki.)

### D. Kalimat Negatif (～は～じゃありません)
Pola: **[Topik] wa [Predikat] ja (dewa) arimasen.**
- Bentuk negatif dari **desu**.
- **Contoh:**
  - *Gojou-san wa isha dewa arimasen.* (Gojo bukan dokter.)
  - *Fushiguro-san wa sensei ja arimasen.* (Fushiguro bukan guru.)

## 3. Kanji & Waktu
### Nama Hari (Youbi)
- **Nichiyoubi (日曜日)**: Minggu
- **Getsuyoubi (月曜日)**: Senin
- **Kayoubi (火曜日)**: Selasa
- **Suiyoubi (水曜日)**: Rabu
- **Mokuyoubi (木曜日)**: Kamis
- **Kinyoubi (金曜日)**: Jumat
- **Doyoubi (土曜日)**: Sabtu

### Keterangan Waktu
- **Ototoi**: 2 hari yang lalu
- **Kinou**: Kemarin
- **Kyou**: Hari ini
- **Ashita**: Besok
- **Asatte**: Lusa


path: references/vocab.md
content: # Japanese Vocabulary - Beginner Level (N5)

## Greetings (Aisatsu)
- **Konnichiwa (こんにちは)**: Hello / Good afternoon
- **Ohayou Gozaimasu (おはようございます)**: Good morning (Formal)
- **Konbanwa (こんばんは)**: Good evening
- **Oyasumi Nasai (おやすみなさい)**: Good night
- **Arigatou Gozaimasu (ありがとうございます)**: Thank you very much
- **Sumimasen (すみません)**: Excuse me / I'm sorry
- **Gomen nasai (ごめんなさい)**: I'm sorry
- **Itadakimasu (いただきます)**: (Before eating) Thanks for the food
- **Gochisousama deshita (ごちそうさまでした)**: (After eating) Thanks for the food

## Pronouns
- **Watashi (私)**: I (General)
- **Boku (僕)**: I (Male, casual)
- **Ore (俺)**: I (Male, rough/casual)
- **Anata (あなた)**: You (Use sparingly)
- **Kare (彼)**: He / Boyfriend
- **Kanojo (彼女)**: She / Girlfriend

## Numbers (1-10)
1. Ichi (一)
2. Ni (二)
3. San (三)
4. Yon / Shi (四)
5. Go (五)
6. Roku (六)
7. Nana / Shichi (七)
8. Hachi (八)
9. Kyuu / Ku (九)
10. Juu (十)

## Common Verbs (Dictionary Form / Masu Form)
- **Taberu / Tabemasu**: To eat
- **Nomu / Nomimasu**: To drink
- **Iku / Ikimasu**: To go
- **Kuru / Kimasu**: To come
- **Miru / Mimasu**: To see/watch
- **Kiku / Kikimasu**: To listen/hear
- **Suru / Shimasu**: To do
- **Hanasu / Hanashimasu**: To speak

## Common Adjectives
- **Oishii**: Delicious
- **Kawaii**: Cute
- **Kowai**: Scary
- **Tanoshii**: Fun
- **Muzukashii**: Difficult
- **Yasashii**: Easy / Kind
- **Atsui**: Hot
- **Samui**: Cold

## Professions (Shokugyou)
- **Sensei (先生)**: Teacher / Master
- **Gakusei (学生)**: Student
- **Isha (医者)**: Doctor
- **Kaishain (会社員)**: Company Employee
- **Kenkyuusha (研究者)**: Researcher
- **Puroguramaa (プログラマー)**: Programmer

## Family (Kazoku)
- **Kazoku (家族)**: Family
- **Sofu (祖父)**: Grandfather
- **Sobo (祖母)**: Grandmother
- **Chichi (父)**: Father (my)
- **Haha (母)**: Mother (my)
- **Ane (姉)**: Older Sister (my)
- **Ani (兄)**: Older Brother (my)
- **Imouto (妹)**: Younger Sister (my)
- **Otouto (弟)**: Younger Brother (my)

## Nationalities
- **Nihonjin (日本人)**: Japanese person
- **Amerikajin (アメリカ人)**: American person
- **Indoneshiajin (インドネシア人)**: Indonesian person


path: references/vocab_lesson2.md
content: # Lesson 2 Vocabulary (From PDF)

## Objects (Mono)
- **Hon (本)**: Buku / Book
- **Kagi (鍵)**: Kunci / Key
- **Enpitsu (鉛筆)**: Pensil / Pencil
- **Jisho (辞書)**: Kamus / Dictionary
- **Shāpu penshiru (シャープペンシル)**: Pensil mekanik / Mechanical Pencil
- **Zasshi (雑誌)**: Majalah / Magazine
- **Meishi (名刺)**: Kartu nama / Business Card
- **Kasa (傘)**: Payung / Umbrella
- **Kaban (かばん)**: Tas / Bag
- **Nōto (ノート)**: Buku catatan / Notebook
- **Keshigomu (消しゴム)**: Penghapus / Eraser
- **Bōrupen (ボールペン)**: Pulpen / Ballpoint Pen
- **Tokei (時計)**: Jam / Watch, Clock
- **Kuruma (車)**: Mobil / Car
- **Tsukue (机)**: Meja / Desk
- **Isu (椅子)**: Kursi / Chair
- **Omiyage (お土産)**: Oleh-oleh / Souvenir

## Kanji List
- **Hito (人)**: Orang / Person
- **Te (手)**: Tangan / Hand
- **Yama (山)**: Gunung / Mountain
- **Kawa (川)**: Sungai / River
- **Onna (女)**: Perempuan / Woman
- **Otoko (男)**: Laki-laki / Man
- **Ue (上)**: Atas / Up, Above
- **Shita (下)**: Bawah / Down, Below
- **Hairu (入る)**: Masuk / To enter

## Phrases
- **Korekara osewa ni narimasu**: Mohon bimbingannya mulai sekarang / Thank you for your support from now on.
- **Douzo yoroshiku onegaishimasu**: Senang bertemu denganmu (Formal).


path: scripts/greet.py
content: import datetime
import random

def get_greeting():
    hour = datetime.datetime.now().hour
    
    if 5 <= hour < 11:
        greetings = ["Ohayou Gozaimasu (Good Morning) ☀️", "Ohayou!"]
    elif 11 <= hour < 18:
        greetings = ["Konnichiwa (Hello) 🌤️", "Yahho!"]
    else:
        greetings = ["Konbanwa (Good Evening) 🌙", "Otsukare!"]
        
    return random.choice(greetings)

if __name__ == "__main__":
    print(get_greeting())


path: scripts/parse_docx.py
content: import sys
from docx import Document

def extract_text_from_docx(docx_path):
    try:
        doc = Document(docx_path)
        text = ""
        for para in doc.paragraphs:
            text += para.text + "\n"
        return text
    except Exception as e:
        return f"Error reading DOCX: {str(e)}"

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python parse_docx.py <path_to_docx>")
        sys.exit(1)
    
    docx_path = sys.argv[1]
    print(extract_text_from_docx(docx_path))


path: scripts/parse_pdf_gemini.py
content: import google.generativeai as genai
import sys
import os

def parse_with_gemini(pdf_path):
    [REDACTED_SECRET]"GEMINI_API_KEY")
    if not [REDACTED_SECRET] "Error: GEMINI_API_KEY environment variable not set."

    genai.configure([REDACTED_SECRET])

    try:
        # Upload the file
        sample_file = genai.upload_file(path=pdf_path, display_name="Japanese Homework")
        
        # Use a model that supports multimodal input
        model = genai.GenerativeModel(model_name="gemini-2.0-flash")

        prompt = """
        Please transcribe the content of this PDF in detail.
        1. Extract all Japanese text (Kanji/Kana) and provide readings/translations if possible.
        2. Describe any images or diagrams, especially if they contain questions or exercises.
        3. If there are questions with arrows (e.g., "arrow up means question 1"), explain the context.
        4. Organize the output clearly with headers.
        """

        response = model.generate_content([sample_file, prompt])
        return response.text

    except Exception as e:
        return f"Error using Gemini API: {str(e)}"

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python parse_pdf_gemini.py <pdf_path>")
        sys.exit(1)

    pdf_path = sys.argv[1]
    # Set stdout to utf-8
    sys.stdout.reconfigure(encoding='utf-8')
    
    print(parse_with_gemini(pdf_path))


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)