首页/数据 & AI/baoyu-translate
B

baoyu-translate

by @JimLiuv
4.4(248)

多语言翻译工具:快速/标准/精细三种模式,支持自定义术语表、受众画像、风格预设,多语言对支持。

Machine TranslationLocalizationTerminology ManagementMultilingual ContentAI TranslationGitHub
安装方式
npx skills add JimLiu/baoyu-skills --skill baoyu-translate
compare_arrows

Before / After 效果对比

1
使用前

传统翻译工具难以满足专业领域对术语、风格和受众的精细要求。翻译质量不稳定,需要大量人工校对和修改。

使用后

提供多种翻译模式,支持自定义术语表、受众画像和风格预设。显著提升翻译准确性和效率,满足各类专业翻译需求。

description 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 the resolved style preset (from --style flag, EXTEND.md style setting, or default storytelling), content background, merged glossary, and comprehension 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, translates its chunk, saves to chunks/chunk-NN-draft.md
    • Terminology consistency is guaranteed by the shared 02-prompt.md (glossary + comprehension 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):

  • Accuracy first: Facts, data, and logic must match the original exactly
  • Meaning over words: Translate what the author means, not just what the words say. When a literal translation sounds unnatural or fails to convey the intended effect, restructure freely to express the same meaning in idiomatic target language
  • Figurative language: Interpret metaphors, idioms, and figurative expressions by their intended meaning rather than translating them word-for-word. When a source-language image does not carry the same connotation in the target language, replace it with a natural expression that conveys the same idea and emotional effect
  • Emotional fidelity: Preserve the emotional connotations of word choices, not just their dictionary meanings. Words that carry subjective feelings (e.g., "alarming", "haunting") should be rendered to evoke the same response in target-language readers
  • Natural flow: Use idiomatic target language word order and sentence patterns; break or restructure sentences freely when the source structure doesn't work naturally in the target language
  • Terminology: Use standard translations; annotate with original term in parentheses on first occurrence
  • Preserve format: Keep all markdown formatting (headings, bold, italic, images, links, code blocks)
  • Image-language awareness: Preserve image references exactly during translation, but after the translation is complete, review referenced images and check whether their likely main text language still matches the translated article language
  • Frontmatter transformation: If the source has YAML frontmatter, preserve it in the translation with these changes: (1) Rename metadata fields that describe the source article — urlsourceUrl, titlesourceTitle, descriptionsourceDescription, authorsourceAuthor, datesourceDate, and any similar origin-metadata fields — by adding a source prefix (camelCase). (2) Translate the values of text fields (title, description, etc.) and add them as new top-level fields. (3) Keep other fields (tags, categories, custom fields) as-is, translating their values where appropriate
  • Respect original: Maintain original meaning and intent; do not add, remove, or editorialize — but sentence structure and imagery may be adapted freely to serve the meaning
  • Translator's notes: For terms, concepts, or cultural references that target readers may not understand — due to jargon, cultural gaps, or domain-specific knowledge — add a concise explanatory note in parentheses immediately after the term. The note should explain what it means in plain language, not just provide the English original. Format: 译文(English original,通俗解释). Calibrate annotation depth to the target audience: general readers need more notes than technical readers. For short texts (< 5 sentences), further reduce annotations — only annotate non-common terms that the target audience is unlikely to know; skip terms that are widely recognized or self-explanatory in context. Only add notes where genuinely needed; do not over-annotate obvious terms.

Quick Mode

Translate directly → save to translation.md. No analysis file, but still apply all translation principles above — especially: interpret figurative language by meaning (not word-for-word), preserve emotional connotations, and restructure sentences for natural target-language flow.

Normal Mode

  1. Analyze01-analysis.md (domain, tone, audience, terminology, reader comprehension challenges, figurative language & metaphor mapping)
  2. Assemble prompt02-prompt.md (translation instructions with inlined style preset, content background, glossary, and comprehension 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](referen

...

forum用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价

统计数据

安装量4.3K
评分4.4 / 5.0
版本
更新日期2026年4月29日
对比案例1 组

用户评分

4.4(248)
5
63%
4
26%
3
8%
2
3%
1
1%

为此 Skill 评分

0.0

兼容平台

🔧Claude Code
🔧OpenClaw
🔧OpenCode
🔧Codex
🔧Gemini CLI
🔧GitHub Copilot
🔧Amp
🔧Kimi CLI

时间线

创建2026年2月1日
最后更新2026年4月29日
🎁 Agent 知识卡片