$npx -y skills add JimLiu/baoyu-skills --skill baoyu-translateThis skill should be used when the user asks to "translate", "翻译", "精翻", "translate article", "translate to Chinese", "translate to English", "改成中文", "改成英文", "convert to Chinese", "localize", "本地化", "refined translation", "精细翻译", "proofread translation", "快速翻译", "快翻", "这篇文章翻译一下",
| 1 | # Translator |
| 2 | |
| 3 | Three-mode translation skill: **quick** for direct translation, **normal** for analysis-informed translation, **refined** for full publication-quality workflow with review and polish. |
| 4 | |
| 5 | ## User Input Tools |
| 6 | |
| 7 | When this skill prompts the user, follow this tool-selection rule (priority order): |
| 8 | |
| 9 | 1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. |
| 10 | 2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. |
| 11 | 3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order. |
| 12 | |
| 13 | Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. |
| 14 | |
| 15 | ## Script Directory |
| 16 | |
| 17 | Scripts in `scripts/` subdirectory. `{baseDir}` = this SKILL.md's directory path. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun. Replace `{baseDir}` and `${BUN_X}` with actual values. |
| 18 | |
| 19 | | Script | Purpose | |
| 20 | |--------|---------| |
| 21 | | `scripts/main.ts` | CLI entry point. Default action splits markdown into chunks; also supports explicit `chunk` subcommand | |
| 22 | | `scripts/chunk.ts` | Markdown chunking implementation used by `main.ts` and kept compatible for direct invocation | |
| 23 | |
| 24 | ## Preferences (EXTEND.md) |
| 25 | |
| 26 | Check EXTEND.md in priority order — the first one found wins: |
| 27 | |
| 28 | | Priority | Path | Scope | |
| 29 | |----------|------|-------| |
| 30 | | 1 | `.baoyu-skills/baoyu-translate/EXTEND.md` | Project | |
| 31 | | 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-translate/EXTEND.md` | XDG | |
| 32 | | 3 | `$HOME/.baoyu-skills/baoyu-translate/EXTEND.md` | User home | |
| 33 | |
| 34 | | Result | Action | |
| 35 | |--------|--------| |
| 36 | | Found | Read, parse, apply. On first use in session, briefly remind: "Using preferences from [path]. You can edit EXTEND.md to customize glossary, audience, etc." | |
| 37 | | Not found | **MUST** run first-time setup (see below) — do NOT silently use defaults | |
| 38 | |
| 39 | **EXTEND.md supports**: default target language, default mode, target audience, custom glossaries (inline or file path), translation style, chunk settings. |
| 40 | |
| 41 | Schema: [references/config/extend-schema.md](references/config/extend-schema.md). |
| 42 | |
| 43 | ### First-Time Setup (BLOCKING) |
| 44 | |
| 45 | **CRITICAL**: When EXTEND.md is not found, you **MUST** run the first-time setup before ANY translation. This is a **BLOCKING** operation. |
| 46 | |
| 47 | Full reference: [references/config/first-time-setup.md](references/config/first-time-setup.md) |
| 48 | |
| 49 | Use `AskUserQuestion` with all questions (target language, mode, audience, style, save location) in ONE call. After user answers, create EXTEND.md at the chosen location, confirm "Preferences saved to [path]", then continue. |
| 50 | |
| 51 | ## Defaults |
| 52 | |
| 53 | All configurable values in one place. EXTEND.md overrides these; CLI flags override EXTEND.md. |
| 54 | |
| 55 | | Setting | Default | EXTEND.md key | CLI flag | Description | |
| 56 | |---------|---------|---------------|----------|-------------| |
| 57 | | Target language | `zh-CN` | `target_language` | `--to` | Translation target language | |
| 58 | | Mode | `normal` | `default_mode` | `--mode` | Translation mode | |
| 59 | | Audience | `general` | `audience` | `--audience` | Target reader profile | |
| 60 | | Style | `storytelling` | `style` | `--style` | Translation style preference | |
| 61 | | Chunk threshold | `4000` | `chunk_threshold` | — | Word count to trigger chunked translation | |
| 62 | | Chunk max words | `5000` | `chunk_max_words` | — | Max words per chunk | |
| 63 | |
| 64 | ## Modes |
| 65 | |
| 66 | | Mode | Flag | Steps | When to Use | |
| 67 | |------|------|-------|-------------| |
| 68 | | Quick | `--mode quick` | Translate | Short texts, informal content, quick tasks | |
| 69 | | Normal | `--mode normal` (default) | Analyze → Translate | Articles, blog posts, general content | |
| 70 | | Refined | `--mode refined` | Analyze → Translate → Review → Polish | Publication-quality, important documents | |
| 71 | |
| 72 | **Default mode**: Normal (can be overridden in EXTEND.md `default_mode` setting). |
| 73 | |
| 74 | **Style presets** — control the voice and tone of the translation (independent of audience): |
| 75 | |
| 76 | | Value | Description | Effect | |
| 77 | |-------|-------------|--------| |
| 78 | | `storytelling` | Engaging narrative flow (default) | Draws readers in, smooth transitions, vivid phrasing | |
| 79 | | `formal` | Professional, s |