B

baoyu-translate

Verified

by JimLiu · Updated Apr 16, 2026

opus
5.0Kin30.8Kout
$2.8111m 1s

Translates articles and documents between languages with three modes - quick (direct), normal (analyze then translate), and refined (analyze, translate, review, polish). Supports custom glossaries and terminology consistency via EXTEND.md. Use when user asks to "translate", "翻译", "精翻", "translate article", "translate to Chinese/English", "改成中文", "改成英文", "convert to Chinese", "localize", "本地化", or needs any document translation. Also triggers for "refined translation", "精细翻译", "proofread translation", "快速翻译", "快翻", "这篇文章翻译一下", or when a URL or file is provided with translation intent.

translationlocalizationmarkdowndocument-processingbunglossary

See It In Action

1 turns·claude
The project codebase is in your current working directory. Explore the files to understand the code before making changes. got a long markdown API spec from our Taiwan partner—need a polished simplified chinese version for this afternoon’s review, keep the glossary terms consistent

Let me find the markdown file and check the translation skill setup.

The spec is ~900 lines of English with a solid EN→ZH-CN glossary already in place. I'll use the translation skill in refined mode for the best quality output.

Let me check for EXTEND.md and estimate the document size.

No EXTEND.md found. Given your clear requirements (refined mode, EN→ZH-CN, technical API doc), I'll create one with matching settings and proceed.

Preferences saved to .baoyu-skills/baoyu-translate/EXTEND.md. Now proceeding with the refined workflow.

Now writing the content analysis.

Now assembling the translation prompt.

Now drafting the translation. The document is ~4000 words — I'll split it across parallel subagents for speed: sections 1-3, sections 4-6, sections 7-9, and sections 10-11 + appendices.

All 4 chunks complete. Now merging into the draft, then proceeding with critical review.

Draft merged. Now performing the critical review.

6 fixes identified — no accuracy errors, all minor polish. Applying revisions now.

All 6 revisions applied. Now producing the final polished version.

Let me do a final verification pass — spot-checking the output and confirming line counts match.

All 11 sections + 2 appendices present (13 ## headings matching the source). Line count is 920 vs 918 original — near-perfect structural parity.

Translation complete (refined mode)

Sourcepartner-api-spec.md
LanguagesEN → ZH-CN
Output dirpartner-api-spec-zh-cn/
Final filepartner-api-spec-zh-cn.md (also at partner-api-spec-zh-cn/translation.md)
Glossary terms applied45+

Workflow artifacts in partner-api-spec-zh-cn/:

  • 01-analysis.md — domain/tone/terminology analysis
  • 02-prompt.md — assembled translation prompt with merged glossary
  • 03-draft.md — initial draft from parallel subagents
  • 04-critique.md — critical review (6 issues found, 0 accuracy errors)
  • 05-revision.md — revised version with all fixes applied
  • translation.md — final polished output

Key decisions: "灰度发布" for gradual rollout, "服务等级" for tier, all code/JSON/URLs preserved in English, RFC modals mapped consistently (must→必须, should→应该, may→可以), first-occurrence annotations for 15+ specialized terms with no duplicates.

Claude Sonnet 4.6

External Tools

ToolType
bunbinary
npxbinary

Permissions

ScopeDescription
filesystem:read
filesystem:write
process:spawn

SKILL.md

Translator

Three-mode translation skill: quick for direct translation, normal for analysis-informed translation, refined for full publication-quality workflow with review and polish.

Script Directory

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.

ScriptPurpose
scripts/main.tsCLI entry point. Default action splits markdown into chunks; also supports explicit chunk subcommand
scripts/chunk.tsMarkdown chunking implementation used by main.ts and kept compatible for direct invocation

Preferences (EXTEND.md)

Check EXTEND.md existence (priority order):

# macOS, Linux, WSL, Git Bash
test -f .baoyu-skills/baoyu-translate/EXTEND.md && echo "project"
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-translate/EXTEND.md" && echo "xdg"
test -f "$HOME/.baoyu-skills/baoyu-translate/EXTEND.md" && echo "user"
# PowerShell (Windows)
if (Test-Path .baoyu-skills/baoyu-translate/EXTEND.md) { "project" }
$xdg = if ($env:XDG_CONFIG_HOME) { $env:XDG_CONFIG_HOME } else { "$HOME/.config" }
if (Test-Path "$xdg/baoyu-skills/baoyu-translate/EXTEND.md") { "xdg" }
if (Test-Path "$HOME/.baoyu-skills/baoyu-translate/EXTEND.md") { "user" }
PathLocation
.baoyu-skills/baoyu-translate/EXTEND.mdProject directory
$HOME/.baoyu-skills/baoyu-translate/EXTEND.mdUser home
ResultAction
FoundRead, parse, apply settings. On first use in session, briefly remind: "Using preferences from [path]. You can edit EXTEND.md to customize glossary, audience, etc."
Not foundMUST run first-time setup (see below) — do NOT silently use defaults

EXTEND.md Supports: Default target language | Default mode | Target audience | Custom glossaries (inline or file path) | Translation style | Chunk settings

Schema: references/config/extend-schema.md

First-Time Setup (BLOCKING)

CRITICAL: When EXTEND.md is not found, you MUST run the first-time setup before ANY translation. This is a BLOCKING operation.

Full reference: references/config/first-time-setup.md

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.

Defaults

All configurable values in one place. EXTEND.md overrides these; CLI flags override EXTEND.md.

SettingDefaultEXTEND.md keyCLI flagDescription
Target languagezh-CNtarget_language--toTranslation target language
Modenormaldefault_mode--modeTranslation mode
Audiencegeneralaudience--audienceTarget reader profile
Stylestorytellingstyle--styleTranslation style preference
Chunk threshold4000chunk_thresholdWord count to trigger chunked translation
Chunk max words5000chunk_max_wordsMax words per chunk

Modes

ModeFlagStepsWhen to Use
Quick--mode quickTranslateShort texts, informal content, quick tasks
Normal--mode normal (default)Analyze → TranslateArticles, blog posts, general content
Refined--mode refinedAnalyze → Translate → Review → PolishPublication-quality, important documents

Default mode: Normal (can be overridden in EXTEND.md default_mode setting).

Style presets — control the voice and tone of the translation (independent of audience):

ValueDescriptionEffect
storytellingEngaging narrative flow (default)Draws readers in, smooth transitions, vivid phrasing
formalProfessional, structuredNeutral tone, clear organization, no colloquialisms
technicalPrecise, documentation-styleConcise, terminology-heavy, minimal embellishment
literalClose to original structureMinimal restructuring, preserves source sentence patterns
academicScholarly, rigorousFormal register, complex clauses OK, citation-aware
businessConcise, results-focusedAction-oriented, executive-friendly, bullet-point mindset
humorousPreserves and adapts humorWitty, playful, recreates comedic effect in target language
conversationalCasual, spoken-likeFriendly, approachable, as if explaining to a friend
elegantLiterary, polished proseAesthetically refined, rhythmic, carefully crafted word choices

Custom style descriptions are also accepted, e.g., --style "poetic and lyrical".

Auto-detection:

  • "快翻", "quick", "直接翻译" → quick mode
  • "精翻", "refined", "publication quality", "proofread" → refined mode
  • Otherwise → default mode (normal)

Upgrade prompt: After normal mode completes, display:

Translation saved. To further review and polish, reply "继续润色" or "refine".

If user responds, continue with review → polish steps (same as refined mode Steps 4-6 in refined-workflow.md) on the existing output.

Usage

/translate [--mode quick|normal|refined] [--from <lang>] [--to <lang>] [--audience <audience>] [--style <style>] [--glossary <file>] <source>
  • <source>: File path, URL, or inline text
  • --from: Source language (auto-detect if omitted)
  • --to: Target language (from EXTEND.md or default zh-CN)
  • --audience: Target reader profile (from EXTEND.md or default general)
  • --style: Translation style (from EXTEND.md or default storytelling)
  • --glossary: Additional glossary file to merge with EXTEND.md glossary

Audience presets:

ValueDescriptionEffect
generalGeneral readers (default)Plain language, more translator's notes for jargon
technicalDevelopers / engineersLess annotation on common tech terms
academicResearchers / scholarsFormal register, precise terminology
businessBusiness professionalsBusiness-friendly tone, explain tech concepts

Custom audience descriptions are also accepted, e.g., --audience "AI感兴趣的普通读者".

Workflow

Step 1: Load Preferences

1.1 Check EXTEND.md (see Preferences section above)

1.2 Load built-in glossary for the language pair if available:

1.3 Merge glossaries: EXTEND.md glossary (inline) + EXTEND.md glossary_files (external files, paths relative to EXTEND.md location) + built-in glossary + --glossary file (CLI overrides all)

Step 2: Materialize Source & Create Output Directory

Materialize source (file as-is, inline text/URL → save to translate/{slug}.md), then create output directory: {source-dir}/{source-basename}-{target-lang}/. Detect source language if --from not specified.

Full details: references/workflow-mechanics.md

Output directory contents (all intermediate and final files go here):

FileModeDescription
translation.mdAllFinal translation (always this name)
01-analysis.mdNormal, RefinedContent analysis (domain, tone, terminology)
02-prompt.mdNormal, RefinedAssembled translation prompt
03-draft.mdRefinedInitial draft before review
04-critique.mdRefinedCritical review findings (diagnosis only)
05-revision.mdRefinedRevised translation based on critique
chunks/ChunkedSource chunks + translated chunks

Step 3: Assess Content Length

Quick mode does not chunk — translate directly regardless of length. Before translating, estimate word count. If content exceeds chunk threshold (default 4000 words), proactively warn: "This article is ~{N} words. Quick mode translates in one pass without chunking — for long content, --mode normal produces better results with terminology consistency." Then proceed if user doesn't switch.

For normal and refined modes:

ContentAction
< chunk thresholdTranslate as single unit
>= chunk thresholdChunk translation (see Step 3.1)

3.1 Long Content Preparation (normal/refined modes, >= chunk threshold only)

Before translating chunks:

  1. Extract terminology: Scan entire document for proper nouns, technical terms, recurring phrases
  2. Build session glossary: Merge extracted terms with loaded glossaries, establish consistent translations
  3. Split into chunks: Use ${BUN_X} {baseDir}/scripts/main.ts <file> [--max-words <chunk_max_words>] [--output-dir <output-dir>]
    • Parses markdown blocks (headings, paragraphs, lists, code blocks, tables, etc.)
    • Splits at markdown block boundaries to preserve structure
    • If a single block exceeds the threshold, falls back to line splitting, then word splitting
  4. Assemble translation prompt:
    • Main agent reads 01-analysis.md (if exists) and assembles shared context using Part 1 of references/subagent-prompt-template.md — inlining: target style, content background, merged glossary, and translation challenges
    • Save as 02-prompt.md in the output directory (shared context only, no task instructions)
  5. Draft translation via subagents (if Agent tool available):
    • Spawn one subagent per chunk, all in parallel (Part 2 of the template)
    • Each subagent reads 02-prompt.md for shared context, receives chunk position info (chunk N of M + brief context of where it sits in the argument), translates its chunk, saves to chunks/chunk-NN-draft.md
    • Consistency is guaranteed by the shared 02-prompt.md (glossary, figurative language mapping, comprehension challenges, source voice, and translation challenges from analysis)
    • If no chunks (content under threshold): spawn one subagent for the entire source file
    • If Agent tool is unavailable, translate chunks sequentially inline using 02-prompt.md
  6. Merge: Once all subagents complete, combine translated chunks in order. If chunks/frontmatter.md exists, prepend it. Save as 03-draft.md (refined) or translation.md (normal)
  7. All intermediate files (source chunks + translated chunks) are preserved in chunks/

After chunked draft is merged, return control to main agent for critical review, revision, and polish (Step 4).

Step 4: Translate & Refine

Translation principles (apply to all modes):

  • Rewrite, not translate: Rewrite content into natural, engaging target language as if a skilled native writer composed it from scratch. Quality test: "Does this read like it was originally written in the target language?"
  • Accuracy first: Facts, data, and logic must match the original exactly
  • Natural flow: Use idiomatic target language word order. Break long source sentences into shorter, natural ones. Interpret metaphors and idioms by intended meaning, not word-for-word
  • Terminology: Use standard translations consistently. First occurrence of specialized terms: annotate with original in parentheses
  • Preserve format: Keep all markdown formatting (headings, bold, italic, images, links, code blocks)
  • Proactive interpretation: For jargon or concepts the target audience may lack context for, add concise explanations in bold parentheses (**解释**). Keep annotations few — only where genuinely needed for comprehension
  • Frontmatter: If source has YAML frontmatter, rename source-metadata fields with source prefix (camelCase: urlsourceUrl, titlesourceTitle, etc.), add translated values as new top-level fields (skip title if body has H1), keep other fields as-is

Quick Mode

Translate directly → save to translation.md. Apply all translation principles above.

Normal Mode

  1. Analyze01-analysis.md (domain, tone, terminology, translation challenges)
  2. Assemble prompt02-prompt.md (translation instructions with context, glossary, challenges)
  3. Translate (following 02-prompt.md) → translation.md

After completion, prompt user: "Translation saved. To further review and polish, reply 继续润色 or refine."

If user continues, proceed with critical review → revision → polish (same as refined mode Steps 4-6 below), saving 03-draft.md (rename current translation.md), 04-critique.md, 05-revision.md, and updated translation.md.

Refined Mode

Full workflow for publication quality. See references/refined-workflow.md for detailed guidelines per step.

The subagent (if used in Step 3.1) only handles the initial draft. All subsequent steps (critical review, revision, polish) are handled by the main agent, which may delegate to subagents at its discretion.

Steps and saved files (all in output directory):

  1. Analyze01-analysis.md (domain, tone, terminology, translation challenges)
  2. Assemble prompt02-prompt.md (translation instructions with inlined context)
  3. Draft03-draft.md (initial translation with translator's notes; from subagent if chunked)
  4. Critical review04-critique.md (diagnosis only: accuracy, Europeanized language, strategy execution, expression issues)
  5. Revision05-revision.md (apply all critique findings to produce revised translation)
  6. Polishtranslation.md (final publication-quality translation)

Each step reads the previous step's file and builds on it.

Step 5: Output

Final translation is always at translation.md in the output directory.

After the final translation is written, do a lightweight image-language pass:

  1. Collect image references from the translated article
  2. Identify likely text-heavy images such as covers, screenshots, diagrams, charts, frameworks, and infographics
  3. If any image likely contains a main text language that does not match the translated article language, proactively remind the user
  4. The reminder must be a list only. Do not automatically localize those images unless the user asks

Reminder format (use whatever image syntax the article already uses — standard markdown or wikilink):

Possible image localization needed:
- ![example cover](attachments/example-cover.png): likely still contains source-language text while the article is now in target language
- ![example diagram](attachments/example-diagram.png): likely text-heavy framework graphic, check whether labels need translation

Display summary:

**Translation complete** ({mode} mode)

Source: {source-path}
Languages: {from} → {to}
Output dir: {output-dir}/
Final: {output-dir}/translation.md
Glossary terms applied: {count}

If mismatched image-language candidates were found, append a short note after the summary telling the user that some embedded images may still need image-text localization, followed by the candidate list.

Extension Support

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.

FAQ

What does baoyu-translate do?

Translates articles and documents between languages with three modes - quick (direct), normal (analyze then translate), and refined (analyze, translate, review, polish). Supports custom glossaries and terminology consistency via EXTEND.md. Use when user asks to "translate", "翻译", "精翻", "translate article", "translate to Chinese/English", "改成中文", "改成英文", "convert to Chinese", "localize", "本地化", or needs any document translation. Also triggers for "refined translation", "精细翻译", "proofread translation", "快速翻译", "快翻", "这篇文章翻译一下", or when a URL or file is provided with translation intent.

When should I use baoyu-translate?

Use it when you need a repeatable workflow that produces text report.

What does baoyu-translate output?

In the evaluated run it produced text report.

How do I install or invoke baoyu-translate?

Ask the agent to use this skill when the task matches its documented workflow.

Which agents does baoyu-translate support?

Agent support is inferred from the source, but not explicitly declared.

What tools, channels, or permissions does baoyu-translate need?

It uses bun, npx; channels commonly include text; permissions include filesystem:read, filesystem:write, process:spawn.

Is baoyu-translate safe to install?

Static analysis marked this skill as medium risk; review side effects and permissions before enabling it.

How is baoyu-translate different from an MCP or plugin?

A skill packages instructions and workflow conventions; tools, MCP servers, and plugins are dependencies the skill may call during execution.

Does baoyu-translate outperform not using a skill?

About baoyu-translate

When to use baoyu-translate

When you need to translate a file, URL-derived document, or inline text into another language. When you want terminology consistency via glossaries and saved translation preferences. When translating long markdown articles that benefit from chunking and multi-step refinement.

When baoyu-translate is not the right choice

When you only need a brief explanation or summary rather than a translation. When you cannot allow the agent to write files or save translation preferences locally.

What it produces

Produces text report.