Muyi Translate
When to use
- Translate articles, documents, blog posts, README files, URLs, or inline text.
- Localize Markdown content while preserving structure, links, and code blocks.
- Handle long documents where chunking and terminology consistency matter.
- Produce either a fast draft or a refined publication-quality translation.
Resource map
references/config/extend-schema.md: EXTEND.md fields and glossary schema
references/config/first-time-setup.md: first-run question set and EXTEND.md template
references/workflow-mechanics.md: source materialization, output directory, conflict handling
references/refined-workflow.md: analysis, critique, revision, and polish guidance
references/subagent-prompt-template.md: shared-context template for chunked translation
references/glossary-en-zh.md: built-in EN -> ZH glossary
Runtime
- Prefer the bundled CLI at
scripts/main.bundle.js for chunking so runtime translation does not depend on installing node_modules.
- Resolve script paths relative to this skill directory, never relative to the task cwd.
- Prefer
bun to run the bundled CLI.
- If
bun is unavailable but npx exists, npx -y bun can run the bundled CLI as a fallback, but it may require network access on first use.
- If the bundle is missing and you are maintaining the skill, run
bun install and bun run build inside scripts/, then use the bundled CLI.
- If neither is available, explain that automated chunking is unavailable and either install Bun or chunk manually.
Preference lookup
Check for EXTEND.md in this exact order and stop at the first match:
.muyi-skills/muyi-translate/EXTEND.md
${XDG_CONFIG_HOME:-$HOME/.config}/muyi-skills/muyi-translate/EXTEND.md
$HOME/.muyi-skills/muyi-translate/EXTEND.md
If a file is found, read it and apply it. On first use in a session, briefly tell the user which file is active.
If no file exists, do not silently assume a persistent profile. Before translating, ask once for target language, mode, audience, style, and save location, then create EXTEND.md. If the user explicitly says to skip setup, proceed with built-in defaults for this run only and state that no preferences were saved.
Defaults
target_language: zh-CN
default_mode: normal
audience: general
style: storytelling
chunk_threshold: 4000
chunk_max_words: 5000
Workflow
- Load preferences and merge glossary sources.
- Load the built-in language-pair glossary when available.
- Merge
EXTEND.md inline glossary.
- Merge
EXTEND.md glossary_files, resolved relative to the EXTEND.md file.
- Merge any glossary override provided for the current run.
- Read
references/config/extend-schema.md only if field details are needed.
- Materialize the source.
- File path: use as-is.
- URL or inline text: save it to
translate/{slug}.md first.
- Create the output directory as
{source-dir}/{source-basename}-{target-lang}/.
- Follow
references/workflow-mechanics.md for naming and conflict handling.
- Select the mode.
- Quick: translate directly.
- Normal: analyze, assemble context, then translate.
- Refined: analyze, draft, critique, revise, then polish.
- If the user says
快翻 or quick, use quick mode.
- If the user says
精翻, refined, publication quality, or asks to continue polishing, use refined mode.
- Otherwise use the configured default.
- Assess content length.
- Quick mode never chunks.
- Normal and refined modes translate as a single unit below
chunk_threshold.
- At or above the threshold, extract terminology first, then chunk the Markdown.
- Chunk long Markdown with the bundled CLI
scripts/main.bundle.js.
Resolve the script path relative to the directory containing this SKILL.md, not relative to the current task directory.
SKILL_DIR="<absolute-path-to-muyi-translate>"
bun "$SKILL_DIR/scripts/main.bundle.js" <file> --max-words <n> --output-dir <output-dir>
If only npx is available:
SKILL_DIR="<absolute-path-to-muyi-translate>"
npx -y bun "$SKILL_DIR/scripts/main.bundle.js" <file> --max-words <n> --output-dir <output-dir>
This writes chunk files under <output-dir>/chunks/.
- For chunked translation, create shared context in
02-prompt.md using references/subagent-prompt-template.md.
- Translate chunks sequentially by default.
- Only use worker agents in parallel if the user explicitly asked for delegation or sub-agents and the chunks are independent.
- Merge translated chunks in order.
- If
chunks/frontmatter.md exists, prepend it before saving the merged result.
- Apply these translation principles.
- Preserve meaning, facts, Markdown structure, links, and code blocks.
- Translate for natural target-language flow, not literal word order.
- Keep terminology consistent and annotate first occurrences only when useful.
- Preserve figurative meaning and emotional tone, even if wording must change.
- Add concise translator's notes only when the target audience truly needs them.
- If YAML frontmatter exists, rename source metadata fields with a
source prefix and add translated top-level text fields where appropriate.
- Save outputs with stable filenames.
- Quick:
translation.md
- Normal:
01-analysis.md, 02-prompt.md, translation.md
- Refined:
01-analysis.md, 02-prompt.md, 03-draft.md, 04-critique.md, 05-revision.md, translation.md
- After the final translation, do a lightweight image-language check.
- If a referenced image likely still contains source-language text, tell the user as a plain list.
- Do not localize images unless the user asks.
Mode details
Quick
Translate directly to translation.md. Use this for short or disposable content.
Normal
Create 01-analysis.md and 02-prompt.md, then write translation.md.
If the user later asks to continue polishing, rename the current translation.md to 03-draft.md and continue with critique, revision, and polish using references/refined-workflow.md.
Refined
Follow the review loop in references/refined-workflow.md.
Use the main agent for critique, revision, and polish even if the initial draft was chunked.
Validation
- Ensure the final output preserves Markdown structure and stable file naming.
- Re-read the translation for terminology drift, broken links, code block corruption, and inconsistent annotation depth.
- If
EXTEND.md creation or chunk automation was skipped because tooling was missing, state that explicitly.
1---2name: muyi-translate3description: Use when the user asks to translate or localize an article, document, URL, Markdown file, or inline text between languages, especially when terminology consistency, long-document chunking, or publication-quality refinement matters. Supports quick, normal, and refined modes plus EXTEND.md preferences and glossary loading.4---56# Muyi Translate78## When to use9- Translate articles, documents, blog posts, README files, URLs, or inline text.10- Localize Markdown content while preserving structure, links, and code blocks.11- Handle long documents where chunking and terminology consistency matter.12- Produce either a fast draft or a refined publication-quality translation.1314## Resource map15- `references/config/extend-schema.md`: EXTEND.md fields and glossary schema16- `references/config/first-time-setup.md`: first-run question set and EXTEND.md template17- `references/workflow-mechanics.md`: source materialization, output directory, conflict handling18- `references/refined-workflow.md`: analysis, critique, revision, and polish guidance19- `references/subagent-prompt-template.md`: shared-context template for chunked translation20- `references/glossary-en-zh.md`: built-in EN -> ZH glossary2122## Runtime23- Prefer the bundled CLI at `scripts/main.bundle.js` for chunking so runtime translation does not depend on installing `node_modules`.24- Resolve script paths relative to this skill directory, never relative to the task cwd.25- Prefer `bun` to run the bundled CLI.26- If `bun` is unavailable but `npx` exists, `npx -y bun` can run the bundled CLI as a fallback, but it may require network access on first use.27- If the bundle is missing and you are maintaining the skill, run `bun install` and `bun run build` inside `scripts/`, then use the bundled CLI.28- If neither is available, explain that automated chunking is unavailable and either install Bun or chunk manually.2930## Preference lookup31Check for `EXTEND.md` in this exact order and stop at the first match:32331. `.muyi-skills/muyi-translate/EXTEND.md`342. `${XDG_CONFIG_HOME:-$HOME/.config}/muyi-skills/muyi-translate/EXTEND.md`353. `$HOME/.muyi-skills/muyi-translate/EXTEND.md`3637If a file is found, read it and apply it. On first use in a session, briefly tell the user which file is active.3839If no file exists, do not silently assume a persistent profile. Before translating, ask once for target language, mode, audience, style, and save location, then create `EXTEND.md`. If the user explicitly says to skip setup, proceed with built-in defaults for this run only and state that no preferences were saved.4041## Defaults42- `target_language`: `zh-CN`43- `default_mode`: `normal`44- `audience`: `general`45- `style`: `storytelling`46- `chunk_threshold`: `4000`47- `chunk_max_words`: `5000`4849## Workflow501. Load preferences and merge glossary sources.51 - Load the built-in language-pair glossary when available.52 - Merge `EXTEND.md` inline `glossary`.53 - Merge `EXTEND.md` `glossary_files`, resolved relative to the `EXTEND.md` file.54 - Merge any glossary override provided for the current run.55 - Read `references/config/extend-schema.md` only if field details are needed.562. Materialize the source.57 - File path: use as-is.58 - URL or inline text: save it to `translate/{slug}.md` first.59 - Create the output directory as `{source-dir}/{source-basename}-{target-lang}/`.60 - Follow `references/workflow-mechanics.md` for naming and conflict handling.613. Select the mode.62 - Quick: translate directly.63 - Normal: analyze, assemble context, then translate.64 - Refined: analyze, draft, critique, revise, then polish.65 - If the user says `快翻` or `quick`, use quick mode.66 - If the user says `精翻`, `refined`, `publication quality`, or asks to continue polishing, use refined mode.67 - Otherwise use the configured default.684. Assess content length.69 - Quick mode never chunks.70 - Normal and refined modes translate as a single unit below `chunk_threshold`.71 - At or above the threshold, extract terminology first, then chunk the Markdown.725. Chunk long Markdown with the bundled CLI `scripts/main.bundle.js`.7374Resolve the script path relative to the directory containing this `SKILL.md`, not relative to the current task directory.7576```bash77SKILL_DIR="<absolute-path-to-muyi-translate>"78bun "$SKILL_DIR/scripts/main.bundle.js" <file> --max-words <n> --output-dir <output-dir>79```8081If only `npx` is available:8283```bash84SKILL_DIR="<absolute-path-to-muyi-translate>"85npx -y bun "$SKILL_DIR/scripts/main.bundle.js" <file> --max-words <n> --output-dir <output-dir>86```8788This writes chunk files under `<output-dir>/chunks/`.89906. For chunked translation, create shared context in `02-prompt.md` using `references/subagent-prompt-template.md`.91 - Translate chunks sequentially by default.92 - Only use worker agents in parallel if the user explicitly asked for delegation or sub-agents and the chunks are independent.93 - Merge translated chunks in order.94 - If `chunks/frontmatter.md` exists, prepend it before saving the merged result.957. Apply these translation principles.96 - Preserve meaning, facts, Markdown structure, links, and code blocks.97 - Translate for natural target-language flow, not literal word order.98 - Keep terminology consistent and annotate first occurrences only when useful.99 - Preserve figurative meaning and emotional tone, even if wording must change.100 - Add concise translator's notes only when the target audience truly needs them.101 - If YAML frontmatter exists, rename source metadata fields with a `source` prefix and add translated top-level text fields where appropriate.1028. Save outputs with stable filenames.103 - Quick: `translation.md`104 - Normal: `01-analysis.md`, `02-prompt.md`, `translation.md`105 - Refined: `01-analysis.md`, `02-prompt.md`, `03-draft.md`, `04-critique.md`, `05-revision.md`, `translation.md`1069. After the final translation, do a lightweight image-language check.107 - If a referenced image likely still contains source-language text, tell the user as a plain list.108 - Do not localize images unless the user asks.109110## Mode details111### Quick112Translate directly to `translation.md`. Use this for short or disposable content.113114### Normal115Create `01-analysis.md` and `02-prompt.md`, then write `translation.md`.116117If the user later asks to continue polishing, rename the current `translation.md` to `03-draft.md` and continue with critique, revision, and polish using `references/refined-workflow.md`.118119### Refined120Follow the review loop in `references/refined-workflow.md`.121122Use the main agent for critique, revision, and polish even if the initial draft was chunked.123124## Validation125- Ensure the final output preserves Markdown structure and stable file naming.126- Re-read the translation for terminology drift, broken links, code block corruption, and inconsistent annotation depth.127- If `EXTEND.md` creation or chunk automation was skipped because tooling was missing, state that explicitly.