Translate content

From pjt222/agent-almanac · View interactive version

Translate content is an AI agent skill from the GitHub repository pjt222/agent-almanac. Translate agent-almanac content (skills, agents, teams, guides) into a target locale while preserving code blocks, IDs, and technical structure. Covers scaffolding, frontmatter setup, prose translation, code preservation, and freshness tracking. Use when localizing content for a new language, updati

How to use this skill

Skill file

Translate Content

Translate English source content into a target locale, preserving technical accuracy and structural integrity.

When to Use

Inputs

Procedure

Step 1: Read the English source

1.1. Determine the source file path:

1.2. Read the entire source file to understand context, structure, and content.

1.3. Identify sections that must stay in English:

Got: Full understanding of source content with clear mental separation of translatable prose vs preserved technical content.

If fail: If source file is not found, verify the ID exists in the registry. Check for typos in the content type or ID.

Step 2: Scaffold the translation file

2.1. Run the scaffolding script:

npm run translate:scaffold -- <content-type> <id> <locale>

2.2. If the file already exists, read it to check whether it needs updating (stale) or is already current.

2.3. Verify the scaffolded file has translation frontmatter fields:

Got: Scaffolded file at i18n/<locale>/<content-type>/<id>/SKILL.md (or .md for other types) with correct frontmatter.

If fail: If the scaffold script fails, create the directory manually with mkdir -p and copy the source file. Add frontmatter fields manually.

Step 3: Translate the description

3.1. Translate the description field in the YAML frontmatter into the target locale.

3.2. For skills, the description is inside the top-level frontmatter. For agents/teams/guides, it is also in the top-level frontmatter.

3.3. Keep the translation concise — match the length and style of the original.

Got: Description field contains an idiomatic translation that accurately conveys the original meaning.

If fail: If the description is ambiguous, keep it closer to literal translation rather than risk misinterpretation.

Step 4: Translate prose sections

4.1. Translate all prose content section by section:

4.2. Preserve these elements exactly as-is:

4.3. For skills, translate the standardized section names:

4.4. For agents, translate:

4.5. For teams, translate:

4.6. For guides, translate:

Got: All prose sections translated idiomatically. Code blocks identical to English source. Cross-references use English IDs.

If fail: If uncertain about a technical term, keep the English term with a parenthetical translation. Example: "Staging-Bereich (Staging Area)" in German.

Step 5: Verify structural integrity

5.1. Confirm the translated file has the same number of sections as the source.

5.2. For skills, verify all required sections are present:

5.3. Verify code blocks are identical to the English source (diff the fenced blocks).

5.4. Check line count: skills must be ≤ 500 lines.

5.5. Verify name field matches the English source exactly (it is the ID, never translated).

Got: Structurally valid translated file that passes validation.

If fail: Compare section-by-section with the English source. Restore any missing sections.

Step 5.5: Verify prose is translated

5.5.1. Sample 3 prose paragraphs from the body of the translated file. Choose paragraphs from different sections — not headings, not code blocks, not frontmatter.

5.5.2. Confirm each sampled paragraph is written in the target language, not English.

5.5.3. If any sampled paragraph is still in English, the translation is incomplete. Return to Step 4 and translate the remaining English prose before proceeding.

Got: All 3 sampled prose paragraphs are in the target language, confirming the body text has been translated — not just headings and frontmatter.

If fail: Identify which sections still contain English prose. Translate them before continuing to Step 6.

Step 6: Write the translated file

6.1. Write the complete translated content to the target path using the Write or Edit tool.

6.2. Verify the file exists at the expected path:

Got: Translated file written to disk at the correct path.

If fail: Check directory exists. Create with mkdir -p if needed.

Validation

Pitfalls

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.