baoyu-translate

安装量: 4.9K
排名: #597

安装

npx skills add https://github.com/jimliu/baoyu-skills --skill baoyu-translate

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. Script Purpose scripts/chunk.ts Split markdown into chunks by AST blocks (sections, headings, paragraphs), with line/word fallback for oversized blocks. Use --output-dir

to write chunks into /chunks/ instead of /chunks/ 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"
}
Path
Location
.baoyu-skills/baoyu-translate/EXTEND.md
Project directory
$HOME/.baoyu-skills/baoyu-translate/EXTEND.md
User home
Result
Action
Found
Read, 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 found
MUST
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.
Setting
Default
EXTEND.md key
CLI flag
Description
Target language
zh-CN
target_language
--to
Translation target language
Mode
normal
default_mode
--mode
Translation mode
Audience
general
audience
--audience
Target reader profile
Style
storytelling
style
--style
Translation style preference
Chunk threshold
4000
chunk_threshold
Word count to trigger chunked translation
Chunk max words
5000
chunk_max_words
Max words per chunk
Modes
Mode
Flag
Steps
When to Use
Quick
--mode quick
Translate
Short texts, informal content, quick tasks
Normal
--mode normal
(default)
Analyze → Translate
Articles, blog posts, general content
Refined
--mode refined
Analyze → Translate → Review → Polish
Publication-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):
Value
Description
Effect
storytelling
Engaging narrative flow (default)
Draws readers in, smooth transitions, vivid phrasing
formal
Professional, structured
Neutral tone, clear organization, no colloquialisms
technical
Precise, documentation-style
Concise, terminology-heavy, minimal embellishment
literal
Close to original structure
Minimal restructuring, preserves source sentence patterns
academic
Scholarly, rigorous
Formal register, complex clauses OK, citation-aware
business
Concise, results-focused
Action-oriented, executive-friendly, bullet-point mindset
humorous
Preserves and adapts humor
Witty, playful, recreates comedic effect in target language
conversational
Casual, spoken-like
Friendly, approachable, as if explaining to a friend
elegant
Literary, polished prose
Aesthetically 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 ] [--to ] [--audience ] [--style