skills/book-translation-guide/SKILL.md
Workflow for translating entire books using AI agents. Split markdown books into chapters, batch translate 5 at a time, and verify completeness. Works with any language pair.
npx skillsauth add madeyexz/ian-skills-agents book-translation-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
IMPORTANT: This skill only works if the book has already been parsed to Markdown format. The source file must be a .md file with proper heading structure using # symbols.
If the book is in PDF, EPUB, or other formats, it must first be converted to Markdown before using this translation workflow.
Use this starter prompt when your input is a ZIP file containing a book PDF and asset files:
Translate this book to Traditional Chinese using:
- skills/book-translation-guide/SKILL.md
- agents/markdown-zh-tw-translator.md
https://github.com/madeyexz/ian-skills-agents
Input ZIP:
/path/to/book-package.zip
Requirements:
1. Unzip into a working folder.
2. If the source is PDF, convert it to markdown first (chaptered `.md` files).
3. Preserve markdown image attachments by keeping/copying asset folders and not changing image link targets.
4. Split oversized markdown chapters to ~40-60KB each.
5. Translate with sub-agents in batches of 5 files.
6. Merge translated parts and verify completeness with tail checks.
7. Output import-ready folders:
- Book-Chapters/
- Book-Chapters-ZH-TW/ (translated markdown + assets)
This guide provides a systematic approach to translating entire books between any language pair using Claude Code translator agents.
Supported translations include:
The workflow is language-agnostic; you simply need a translator agent configured for your target language.
First, understand the book's structure:
# Check file size and line count
wc -l "book.md" && ls -la "book.md"
# Find all chapter headings (lines starting with #)
grep "^# " "book.md"
This reveals:
mkdir -p "Book-Chapters" # For original chapter files
mkdir -p "Book-Chapters-Translated" # For translated chapter files
You can name the translated folder based on your target language:
Book-Chapters-ZH-TW (Traditional Chinese)Book-Chapters-JA (Japanese)Book-Chapters-ES (Spanish)Use sed to extract chapters by line numbers:
sed -n 'START,ENDp' "book.md" > "Book-Chapters/00-Chapter-Name.md"
Example for a typical book:
sed -n '1,55p' "book.md" > "Book-Chapters/00-Front-Matter.md"
sed -n '56,593p' "book.md" > "Book-Chapters/01-Chapter-One.md"
sed -n '594,841p' "book.md" > "Book-Chapters/02-Chapter-Two.md"
# Continue for all chapters...
CRITICAL: Keep each file under 50-60KB to avoid token limits.
If a chapter exceeds 60KB, split it further:
# Check chapter structure
grep "^# " "07-Large-Chapter.md"
# Split into parts at a logical section break
sed -n '1,231p' "07-Large-Chapter.md" > "07a-Part1.md"
sed -n '232,471p' "07-Large-Chapter.md" > "07b-Part2.md"
After translation, merge the parts:
cat "Book-Translated/07a-Part1.md" "Book-Translated/07b-Part2.md" > "Book-Translated/07-Large-Chapter.md"
rm "Book-Translated/07a-Part1.md" "Book-Translated/07b-Part2.md"
Translate 5 chapters at a time, waiting for completion before proceeding:
Batch 1: Chapters 00-04 → Wait for completion
Batch 2: Chapters 05-09 → Wait for completion
Batch 3: Chapters 10-14 → Wait for completion
...continue until done
Benefits:
For each chapter, call the appropriate translation agent based on your target language:
Task(
subagent_type: "markdown-zh-tw-translator",
description: "Translate Chapter X to ZH-TW",
prompt: "Translate the markdown file at /path/to/Book-Chapters/XX-Chapter.md
from English to Traditional Chinese (繁體中文).
Save the translated file to /path/to/Book-Chapters-ZH-TW/XX-Chapter.md
Use your translation guidelines to ensure high quality translation
while preserving markdown formatting."
)
Task(
subagent_type: "markdown-ja-translator",
description: "Translate Chapter X to Japanese",
prompt: "Translate the markdown file at /path/to/Book-Chapters/XX-Chapter.md
from English to Japanese (日本語).
Save the translated file to /path/to/Book-Chapters-JA/XX-Chapter.md
Use your translation guidelines to ensure high quality translation
while preserving markdown formatting."
)
Task(
subagent_type: "markdown-en-translator",
description: "Translate Chapter X to English",
prompt: "Translate the markdown file at /path/to/Book-Chapters/XX-Chapter.md
from French to English.
Save the translated file to /path/to/Book-Chapters-EN/XX-Chapter.md
Use your translation guidelines to ensure high quality translation
while preserving markdown formatting."
)
Run 5 agents in parallel for each batch.
After all chapters are translated, perform side-by-side verification comparing the last 10 lines of each chapter between original and translated versions.
For each chapter, compare original and translated endings in parallel:
echo "=== 01-Chapter ===" && \
echo "-- Original --" && \
tail -10 "Book-Chapters/01-Chapter.md" && \
echo -e "\n-- Translated --" && \
tail -10 "Book-Chapters-Translated/01-Chapter.md"
Run this for all chapters in parallel to verify:
for chapter in Book-Chapters/*.md; do
name=$(basename "$chapter")
echo "=== $name ==="
echo "-- Original --"
tail -10 "$chapter"
echo -e "\n-- Translated --"
tail -10 "Book-Chapters-Translated/$name"
echo -e "\n"
done
| Element | Verification |
|---------|--------------|
| Content completeness | Last sentences match in meaning |
| Reference links | URLs preserved unchanged |
| Section numbers | [1a], [2b3] etc. preserved |
| Proper nouns | Names unchanged in both versions |
| Technical terms | Bilingual format present: 中文 (English) |
| Markdown formatting | Headers, links, emphasis intact |
# Compare original ending
tail -5 "Book-Chapters/01-Chapter.md"
# Compare translated ending
tail -5 "Book-Chapters-Translated/01-Chapter.md"
General principles that apply to all languages:
| Element | Handling | |---------|----------| | Personal names | Keep original (with exceptions based on target language conventions) | | Technical terms | Bilingual format recommended: 翻訳 (Translation) | | Markdown formatting | Preserve all: headers, images, links, footnotes | | Code blocks | Never translate code | | LaTeX/Math | Keep original notation |
Traditional Chinese (Taiwan):
Japanese:
Spanish:
German:
Original File (book.md)
↓
[1] Analyze Structure (grep chapter headings)
↓
[2] Create Directories
↓
[3] Split into Chapters (sed by line numbers)
↓
[4] Check File Sizes (split if >60KB)
↓
[5] Batch Translate (5 chapters per batch)
↓
[6] Merge Split Chapters (if any)
↓
[7] Verify Completeness (tail comparison)
↓
[8] Done - All chapters translated
| Book | Source | Target | Size | Chapters | |------|--------|--------|------|----------| | 21 Lessons for the 21st Century | EN | ZH-TW | 714 KB | 25 | | Homo Deus | EN | ZH-TW | 960 KB | 16 | | Augmenting Human Intellect (Engelbart, 1962) | EN | ZH-TW | 322 KB | 9 |
# heading structuretools
Add before/after comparison screenshots to a PR using browser automation. Captures UI on the base branch and the PR branch, saves to docs/screenshot/, and updates the PR body with a side-by-side comparison table using GitHub CDN URLs.
development
Design principles from Bret Victor's "Magic Ink" for building information software. Use when designing dashboards, search results, calendars, finance apps, or any interface where users seek answers rather than manipulate objects. Ask "what can the user learn?" not "what can the user do?"
testing
Create, edit, improve, or audit AgentSkills. Use when creating a new skill from scratch or when asked to improve, review, audit, tidy up, or clean up an existing skill or SKILL.md file. Also use when editing or restructuring a skill directory (moving files to references/ or scripts/, removing stale content, validating against the AgentSkills spec). Triggers on phrases like "create a skill", "author a skill", "tidy up a skill", "improve this skill", "review the skill", "clean up the skill", "audit the skill".
testing
Host security hardening and risk-tolerance configuration for OpenClaw deployments. Use when a user asks for security audits, firewall/SSH/update hardening, risk posture, exposure review, OpenClaw cron scheduling for periodic checks, or version status checks on a machine running OpenClaw (laptop, workstation, Pi, VPS).