agentleFS
SuperJJ007SuperJJ007/agent-document-skills/skills/md-translate/SKILL.md

md-translate

Skill3 starsChanged 3 months agoMITView on GitHub

Translate Markdown documents, especially MinerU PDF output, to Simplified Chinese with a glossary-driven, chunked, resumable workflow using the host agent by default or an optional OpenAI Chat Completions, OpenAI Responses, or Anthropic Messages endpoint. Preserve Markdown, formulas, code, image paths, citations, and an English References section. Use when a user asks to translate a Markdown file, OCR output, paper, book, or technical document into Chinese.

  • Reads credentials
  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. tomwangowa/agent-skills★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Default to host: use the current agent's own model capability.

    line 12
  2. Very specific:

    Only use an external runtime when the user explicitly requests it or has already configured LLM_PROTOCOL to one of:

    line 14
  3. Distinctive:

    If the document may be confidential, contain personal data, or the user's authorization is unclear, obtain confirmation before sending it.

    line 28
  4. Distinctive:

    Never ask the user to paste an API key into chat.

    line 29
  5. Distinctive:

    Read enough of the source to identify:

    line 33
  6. Distinctive:

    document type, domain, authorial voice, target reader, and desired style.

    line 35
  7. Distinctive:

    Do not read or send more content than needed before the user authorizes the API call.

    line 39
  8. Distinctive:

    Do not claim that a model is currently available without checking the endpoint response or current provider documentation.

    line 58
  9. Very specific:

    Use --dry-run to inspect chunking without requiring a key or calling an API.

    line 59
  10. Distinctive:

    Delete only the specific failed translated chunk when retrying a local quality problem.

    line 114

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Markdown Translation

Translate a Markdown source file to Simplified Chinese without modifying the source. Write translation.md, resumable source/translation chunks, and a filled translation prompt beside the source unless the user chooses another output name.

Choose the runtime

Default to host: use the current agent's own model capability. Do not ask for a separate LLM API key and do not make an external LLM request.

Only use an external runtime when the user explicitly requests it or has already configured LLM_PROTOCOL to one of:

  • openai-chat
  • openai-responses
  • anthropic-messages

These names describe HTTP wire protocols, not providers. Do not maintain a provider catalog or assume that a compatible endpoint supports every model or field.

Privacy and authorization gate for external APIs

Host mode does not need this LLM API gate. Before the first external LLM network call for each source document:

  1. State that Markdown text chunks will be sent to the configured endpoint host.
  2. State the source path, approximate word count, protocol, model, endpoint host, and output path.
  3. If the document may be confidential, contain personal data, or the user's authorization is unclear, obtain confirmation before sending it. A request that explicitly names the external endpoint and the exact document can count as confirmation when no sensitivity is apparent.
  4. Never ask the user to paste an API key into chat. Never print, log, or write the key into the workspace.

Analyze the source

Read enough of the source to identify:

  • document type, domain, authorial voice, target reader, and desired style;
  • 10-30 recurring terms requiring consistent Chinese translations;
  • References headings, formulas, tables, images, code, and OCR artifacts.

Do not read or send more content than needed before the user authorizes the API call.

Build the translation prompt

Copy assets/prompt-template.md to <source-directory>/.translate-prompt.md and fill:

  • {{SOURCE_DESCRIPTION}}
  • {{AUDIENCE_AND_STYLE}}
  • {{GLOSSARY}}
  • {{SPECIAL_NOTES}}

Use a Markdown glossary table. Preserve commands, identifiers, API names, URLs, DOI values, citations, formulas, code, and image paths. Keep References entries in their original language unless the user explicitly requests otherwise. The script recognizes References headings at Markdown levels 1 through 6, translates the heading to 参考文献 at the same level, and appends the original entries without sending them for translation.

Preflight

  1. Locate scripts relative to this skill directory; do not assume a platform-specific install root.
  2. Require Python 3.9+. Host mode uses only the standard library.
  3. For an external runtime, prefer uv run: the entry script declares httpx with PEP 723, so uv creates an isolated cached environment automatically. If uv is unavailable, install requirements.txt only with the user's approval.
  4. In external mode, require LLM_API_KEY and LLM_MODEL. LLM_BASE_URL is optional for official OpenAI and Anthropic endpoints and required for other compatible endpoints.
  5. Do not claim that a model is currently available without checking the endpoint response or current provider documentation.
  6. Use --dry-run to inspect chunking without requiring a key or calling an API.

Run translation

From the skill root, prepare the host-mode chunks:

python3 scripts/translate.py \
  --input <source.md> \
  --prompt <source-directory>/.translate-prompt.md

When the script prints HOST MODE, read each listed chunk-NNN.md, apply the filled prompt, and write only the translated Markdown to the matching chunk-NNN-zh.md. Do not add commentary or code fences. Process a bounded number of chunks at a time when context is limited. Then rerun the same command; when no chunks remain, the script merges translation.md.

For an explicitly authorized external runtime, automatically resolve httpx in an isolated environment:

uv run scripts/translate.py \
  --input <source.md> \
  --prompt <source-directory>/.translate-prompt.md \
  --protocol openai-responses

Fallback when uv is unavailable and the user authorizes installing into their selected Python environment:

python3 -m pip install -r requirements.txt
python3 scripts/translate.py <same-options>

Useful options:

--protocol <runtime>     default: host
--model <model>          external API model; otherwise LLM_MODEL
--max-words 1200        approximate English words per chunk
--parallel 6            concurrent API requests
--output <filename>     default: translation.md
--no-refs-split         translate the References section too
--dry-run               show the plan without an API call
--reset-cache           replace an incompatible translated-chunk cache

Successful translated chunks are cached in chunks/ and skipped on rerun. If the source, prompt, runtime, model, endpoint host, or chunking settings change, do not silently reuse incompatible cached translations; follow the script's cache-mismatch instructions.

Quality check

Inspect the beginning, middle, and end of translation.md. Verify:

  • heading hierarchy and Markdown structure;
  • glossary consistency and natural Chinese prose;
  • formulas, code, variables, citations, numbers, dates, DOI values, URLs, and image paths;
  • English References when split mode is active;
  • absence of model preambles and chunk boundary markers.

Delete only the specific failed translated chunk when retrying a local quality problem. Do not delete the entire cache without explaining the consequence to the user.

Report

Report output path, runtime, source/body/reference word counts, total/successful/failed chunks, resume behavior, and quality-check findings. In external mode also report protocol, model, and endpoint host. Never report an API call as successful when it was not run.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.