跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

translate-explanation

Translate existing code-explanation docs into another language, Chinese by default. Translates a whole `CODE_EXPLANATION/` folder into a parallel `CODE_EXPLANATION_<LANG>` copy (e.g. `CODE_EXPLANATION_ZH`), or a single file — either bilingually in place (English + translation interleaved) for small files or as a `<name>_<lang>.<ext>` sidecar copy for larger ones. Keeps filenames, code, identifiers, file paths, and technical terms in English — only the explanatory prose is translated. Use this skill whenever the user wants to translate, localize, or produce a non-English version of code-explanation / codebase documentation: phrases like "translate-explanation", "translate the code explanation", "translate the CODE_EXPLANATION folder", "localize these docs to Chinese", "make a Chinese version of the explanation", or naming any target language for the explanation files. Default to Chinese (ZH) when no language is specified.

Leanmcp · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add Leanmcp/gateway-skills --skill translate-explanation

技能说明


name: translate-explanation description: >- Translate existing code-explanation docs into another language, Chinese by default. Translates a whole CODE_EXPLANATION/ folder into a parallel CODE_EXPLANATION_<LANG> copy (e.g. CODE_EXPLANATION_ZH), or a single file — either bilingually in place (English + translation interleaved) for small files or as a <name>_<lang>.<ext> sidecar copy for larger ones. Keeps filenames, code, identifiers, file paths, and technical terms in English — only the explanatory prose is translated. Use this skill whenever the user wants to translate, localize, or produce a non-English version of code-explanation / codebase documentation: phrases like "translate-explanation", "translate the code explanation", "translate the CODE_EXPLANATION folder", "localize these docs to Chinese", "make a Chinese version of the explanation", or naming any target language for the explanation files. Default to Chinese (ZH) when no language is specified.

Translate Explanation

Translate generated code-explanation docs (the kind produced by the code-explanation skill) into another language. The prose is translated but everything technical stays in English so the docs remain accurate and usable by engineers.

Default language is Chinese (ZH). If the user names another language, use its code instead (see the table below).

Translation modes

First decide what's being translated — a whole folder or a single file — because the output shape differs.

Folder mode (default). The target is a CODE_EXPLANATION/ folder (or any folder of docs). Produce a parallel folder named <FOLDER>_<LANG> (e.g. CODE_EXPLANATION_ZH) with the same files. See Folder mode below.

Single-file mode. The target is one file. Choose between two output styles based on the file's length, because what's pleasant to read differs by size:

  • Bilingual / interleaved (small files, < 50 lines). Update the file in place so each prose line is immediately followed by its translation — English line, then Chinese line. For short files this keeps original and translation together and is easy to scan. See Single-file mode → Bilingual.
  • Sidecar file (larger files, ≥ 50 lines). Don't clutter a long file with interleaving. Instead create a fully-translated copy named <name>_<lang>.<ext> (e.g. notes_zh.md) in the same folder, leaving the original untouched. See Single-file mode → Sidecar.

Use the line count of the source file to pick the style; if the user explicitly asks for one style, honor that regardless of size.

In every mode, the rules in What to translate vs. keep as-is apply.

Folder mode

1. Locate the source folder

Find the explanation folder to translate. By default this is CODE_EXPLANATION/ at the repo root. If it isn't there, search for it (find . -type d -name 'CODE_EXPLANATION' -not -path '*/node_modules/*') and confirm with the user if there are multiple candidates. List its files so you know exactly what to translate — typically OVERVIEW.md and numbered files like 01_architecture.md, 02_models.md, etc.

2. Resolve the target language and output folder

Map the requested language to a short uppercase code and create the output folder CODE_EXPLANATION_<CODE> as a sibling of the source folder.

LanguageCodeOutput folder
ChineseZHCODE_EXPLANATION_ZH
SpanishESCODE_EXPLANATION_ES
FrenchFRCODE_EXPLANATION_FR
GermanDECODE_EXPLANATION_DE
JapaneseJACODE_EXPLANATION_JA
KoreanKOCODE_EXPLANATION_KO
HindiHICODE_EXPLANATION_HI
PortuguesePTCODE_EXPLANATION_PT

If no language is given, default to Chinese (ZH). For a language not in the table, use its common two-letter ISO 639-1 code, uppercased.

3. Translate each file, one by one

For every file in the source folder, create a file with the exact same name in the output folder. Filenames never change — 01_architecture.md stays 01_architecture.md, not 01_架构.md. This keeps the two folders aligned side by side so a reader can compare them file-for-file.

Translate the prose into the target language while keeping everything technical in English. Read each source file, translate its content, and write the result. Don't translate by guesswork from filenames — translate the actual content.

Single-file mode

When the target is a single file (not a folder), first count its lines to choose the output style, then resolve the language code (Chinese/ZH by default).

Bilingual / interleaved (small files, < 50 lines)

Edit the file in place. After each translatable prose line, insert its translation on the next line, so the file alternates English then the target language. This keeps a short file readable as a single bilingual document.

  • Leave code blocks verbatim and unduplicated — never interleave inside a fenced block; just keep it once.
  • For a heading, put the original heading, then the translated heading on the next line (both as headings).
  • Blank lines and structure stay intact.

Example (English file → bilingual):

# Architecture
# 架构

The handler authenticates the caller, then renders a response.
该 handler 会对调用方进行认证,然后渲染出一个 response。

Sidecar file (larger files, ≥ 50 lines)

Don't interleave a long file — it becomes hard to read. Instead create a new file in the same folder named <name>_<lang>.<ext>: take the original filename, insert _<lang> before the extension (lowercase code), e.g. design.md → design_zh.md, README.txt → README_zh.txt. Write a complete translation there following the standard rules, and leave the original file unchanged.

What to translate vs. keep as-is

The guiding idea: an engineer reading the translated docs

阅读完整来源 ↗