# english-enforcer > This skill should be used when the user inputs text in Vietnamese or incorrect English grammar. It automatically detects language, translates if needed, corrects grammar, and requires the user to re-type correctly to practice English. - Author: Ngoc - Repository: Vegarnom/mega-team-v4 - Version: 20260202115326 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/Vegarnom/mega-team-v4 - Web: https://mule.run/skillshub/@@Vegarnom/mega-team-v4~english-enforcer:20260202115326 --- # English Enforcer Skill v1.0 This skill should be used when the user inputs text in Vietnamese or incorrect English grammar. It automatically detects language, translates if needed, corrects grammar, and requires the user to re-type correctly to practice English. --- ## ACTIVATION This skill is **automatically activated** via hooks for ALL user inputs. It runs as a pre-processing step before any other skill. --- ## CONFIGURATION Load from: `~/.claude/config/english-learning.json` ```json { "input_enforcement": { "enabled": true, "mode": "strict|medium|easy" } } ``` --- ## DETECTION FLOW ``` ┌─────────────────────────────────────────────────────────────────┐ │ INPUT PROCESSING FLOW │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ User Input │ │ │ │ │ ▼ │ │ ┌─────────────────┐ │ │ │ Detect Language │ │ │ └────────┬────────┘ │ │ │ │ │ ┌─────┴─────┬─────────────┐ │ │ ▼ ▼ ▼ │ │ Vietnamese English OK English Error │ │ │ │ │ │ │ ▼ ▼ ▼ │ │ TRANSLATE PROCESS CORRECT │ │ to English ✓ Grammar │ │ │ │ │ │ ▼ ▼ │ │ ASK RE-TYPE ASK RE-TYPE │ │ │ │ │ │ └────────────┬───────────┘ │ │ ▼ │ │ User types correctly │ │ │ │ │ ▼ │ │ UPDATE PROGRESS │ │ │ │ │ ▼ │ │ PROCESS ✓ │ └─────────────────────────────────────────────────────────────────┘ ``` --- ## STEP 1: Detect Language Use language detection to identify if input is: - **Vietnamese**: Contains Vietnamese characters (ă, â, đ, ê, ô, ơ, ư, diacritics) - **English**: ASCII characters only - **Mixed**: Contains both ```typescript // Detection patterns const vietnamesePattern = /[àáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđ]/i; const isVietnamese = vietnamesePattern.test(input); ``` --- ## STEP 2: Handle Vietnamese Input When Vietnamese is detected: ```markdown ┌─────────────────────────────────────────────────────────────────┐ │ 🇻🇳 Vietnamese detected! Let me help you say it in English: │ │ │ │ ✏️ Your input (VI): │ │ "{user_input_vietnamese}" │ │ │ │ ✅ In English: │ │ "{translated_english}" │ │ │ │ 📝 Key vocabulary: │ │ • {word1_en} ({word1_vi}) │ │ • {word2_en} ({word2_vi}) │ │ • {word3_en} ({word3_vi}) │ │ │ │ 👉 Please type the English version to continue: │ │ (Hãy gõ lại bằng tiếng Anh để tiếp tục) │ └─────────────────────────────────────────────────────────────────┘ ``` **Use AskUserQuestion tool:** ```typescript { "questions": [{ "question": "Please type the correct English version to continue:", "header": "English", "options": [ { "label": "{correct_english}", "description": "Type this exactly" } ], "multiSelect": false }] } ``` --- ## STEP 3: Handle Grammar Errors When English with grammar errors is detected: ```markdown ┌─────────────────────────────────────────────────────────────────┐ │ 🔤 Grammar check needed! │ │ │ │ ❌ Your input: │ │ "{user_input_with_errors}" │ │ │ │ ✅ Correct version: │ │ "{corrected_english}" │ │ │ │ 📚 Grammar notes: │ │ • "{error1}" → "{fix1}" │ │ Rule: {rule_explanation} │ │ (Quy tắc: {rule_vietnamese}) │ │ │ │ 👉 Please re-type correctly to continue: │ │ (Hãy gõ lại đúng để tiếp tục) │ └─────────────────────────────────────────────────────────────────┘ ``` --- ## STEP 4: Validate Re-typed Input ### Strict Mode - Must match 100% exactly - Case-sensitive for proper nouns - Allow 3 attempts, show hint after 2 ```markdown # Attempt 1 - Wrong ❌ Not quite right. Try again: Your: "fix the login bugs" Expected: "Fix the login bug" Hint: Check capitalization and singular/plural # Attempt 2 - Wrong ❌ Almost there! One more try: Showing: "Fix the login bug" Just type it exactly as shown above. # Attempt 3 - Correct ✅ Perfect! Well done! 🎉 +10 points | Streak: 3 ``` ### Medium Mode - Allow minor typos (Levenshtein distance ≤ 2) - Allow skip option ### Easy Mode - Only check key words are present - Always allow skip --- ## STEP 5: Update Progress After successful input: ```typescript // Update progress.json { "input_stats": { "total_english_inputs": "+1", "correct_first_try": "+1 if first try", "correct_after_hint": "+1 if after hint" }, "user_stats": { "total_points": "+10 or +5" } } // Update vocabulary.json if new words learned { "recently_learned": ["new_word1", "new_word2"] } // Update grammar-mistakes.json if correction made { "user_mistakes": [{ "input": "original", "correction": "fixed", "rule": "rule_id", "date": "today" }] } ``` --- ## STEP 6: Proceed with Original Request After validation passes, continue processing the user's actual request. --- ## OUTPUT EXAMPLES ### Example 1: Vietnamese to English ``` User: sửa lỗi authentication không hoạt động ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🇻🇳 Vietnamese detected! Let me help you say it in English: ✏️ Your input (VI): "sửa lỗi authentication không hoạt động" ✅ In English: "Fix the authentication bug that is not working" 📝 Key vocabulary: • fix (sửa) • authentication (xác thực) • bug (lỗi) • not working (không hoạt động) 👉 Please type the English version to continue: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ``` ### Example 2: Grammar Correction ``` User: i want fix the bug login it not work ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔤 Grammar check needed! ❌ Your input: "i want fix the bug login it not work" ✅ Correct version: "I want to fix the login bug. It is not working." 📚 Grammar notes: • "i" → "I" Rule: Always capitalize the pronoun 'I' (Quy tắc: Luôn viết hoa đại từ 'I') • "want fix" → "want to fix" Rule: Use 'to' before infinitive after 'want' (Quy tắc: Dùng 'to' trước động từ sau 'want') • "bug login" → "login bug" Rule: Modifier noun comes before main noun (Quy tắc: Danh từ bổ nghĩa đứng trước danh từ chính) • "it not work" → "It is not working" Rule: Use 'is + verb-ing' for current state (Quy tắc: Dùng 'is + verb-ing' cho trạng thái hiện tại) 👉 Please re-type correctly to continue: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ``` ### Example 3: Perfect Input ``` User: Fix the login bug. It is not working. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Perfect English! Processing your request... 🎯 I understand you want to: Fix the login bug that is not working Let me analyze the issue... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ``` --- ## GAMIFICATION Display after successful re-type: ```markdown ✅ Correct! 🎉 ┌────────────────────────────┐ │ +10 points │ │ 🔥 Streak: 5 inputs │ │ 📚 Today: 3/10 goal │ │ ⭐ Level: 2 (Elementary) │ └────────────────────────────┘ ``` --- ## CONFIGURATION OPTIONS Users can adjust in `~/.claude/config/english-learning.json`: | Option | Values | Default | |--------|--------|---------| | `enabled` | true/false | true | | `mode` | strict/medium/easy | strict | | `current_level` | 1-5 | 2 | --- ## SKIP COMMANDS If user really needs to skip (emergencies): - Type `/skip` - Skip this one time - Type `/english off` - Temporarily disable (for session) - Type `/english easy` - Switch to easy mode ```markdown ⚠️ Skipped this time. Remember: Practice makes perfect! (Bỏ qua lần này. Nhớ rằng: Luyện tập tạo nên hoàn hảo!) ``` --- ## EXECUTION RULES 1. **ALWAYS DETECT** - Check every user input 2. **BE ENCOURAGING** - Positive feedback, not criticism 3. **TEACH, DON'T JUST CORRECT** - Explain the rules 4. **TRACK PROGRESS** - Update stats after each interaction 5. **BILINGUAL SUPPORT** - Show Vietnamese explanation alongside English 6. **RESPECT USER TIME** - Allow skip in medium/easy modes