article-bilingual-translation-publisher
Translate one Chinese article into high-quality English Markdown, regenerate bilingual detailed summaries, and write back only `articles.content_en` + `articles.detailed_summary` to LanceDB. Default w
SKILL.mdskills/article-bilingual-translation-publisher/SKILL.md
GitHubSingle-Article Bilingual Translation and LanceDB Write-back
When To Use
Use this skill when the user asks to:
- Translate one Chinese article into high-quality English (
content_en). - Regenerate bilingual detailed summaries (
detailed_summary.zh/en). - Fix broken Markdown structure in translated content/summaries (especially tables).
- Overwrite and write the result back to LanceDB.
Required Context
- Required:
../article-summary-architect/SKILL.md - Recommended:
../staticflow-cli-publisher/SKILL.md
Notes:
- Summary generation must follow
article-summary-architectthinking order (classify type first, then produce structured compression). - Summaries must not paste raw table markdown into bullets.
Default Mode (Mandatory): LLM-native Direct Generation
Use this mode unless the user explicitly asks for another approach.
- Read source article from current context first.
- Generate final
content_en,detailed_summary_zh, anddetailed_summary_endirectly in one pass. - Run lightweight structure checks.
- Write back via
sf-cli.
Hard rule:
- Do not call external model APIs, proxy model scripts, or sub-agent model commands for generation.
- Do not split translation into mechanical line-by-line scripts unless recovery is required.
- Tool/CLI usage is limited to source fetch, write-back, and essential validation.
Inputs
At least one is required:
- Article
id(articles.idin LanceDB), or - Markdown file path.
If only id is provided, read source markdown from LanceDB articles.content.
Resolve CLI and Query Source Article
Reuse the same query path as staticflow-cli-publisher only when source is not already in context.
- Resolve CLI binary in this order:
./target/release/sf-cli./target/debug/sf-clisf-clifromPATH
- If the checkout is newer than the chosen binary, rebuild before use.
- Do not prefer legacy
./bin/sf-clisnapshots for storage-format-sensitive writes. - Verify CLI availability:
<cli> --help
- Preferred query path (API-style):
<cli> api --db-path <db_path> get-article <article_id>
- Fallback query path (DB-style projection):
<cli> db --db-path <db_path> query-rows articles --where "id='<article_id>'" --columns id,title,date,content,content_en,detailed_summary --limit 1 --format vertical
- Source-of-truth field for translation input:
articles.content
Hard Constraints
English body (content_en)
- Translate the full article as a coherent whole (not fragmented line-by-line output).
- Preserve render-safe Markdown structure:
- heading hierarchy
- list nesting
- code fence boundaries
- inline code syntax
- links/images syntax
- table syntax (row/column structure)
- Do not change executable code logic.
- It is allowed (and recommended) to translate comments inside code blocks into English.
- Do not change link/image target URLs.
- Keep headings, list levels, tables, and fenced blocks structurally equivalent to the source.
- Keep formulas and technical symbols intact.
Bilingual summary (detailed_summary)
- Produce
zh/enviaarticle-summary-architectreasoning. - Each language must contain:
- one natural opening sentence
- 3-5
###sections - 2-4 concise bullets per section
- Do not paste raw table markdown into summary bullets.
zh/enmust be semantically aligned and evidence-grounded (no fabricated claims).- Keep summaries scannable and content-specific; avoid empty template phrases.
Recommended Workflow (Single Article)
Step 1. Prepare minimal workspace
- Resolve target article id/file.
- Create
tmp/article_translate/<article_id>/. - Back up current row and key fields before overwrite.
Step 2. Generate content directly
- Produce in one coherent pass:
content_endetailed_summary_zhdetailed_summary_en
- Prefer article-level translation, not sentence-by-sentence conversion.
Step 3. Lightweight structure checks
- Source vs translation:
- same fenced-code block count
- same Mermaid block count (if present)
- same table block count and compatible column shape
- same link/image target URLs
- Summary checks:
- both languages include opening sentence +
###sections + bullets - no table-markdown pollution in bullets
- both languages include opening sentence +
Step 4. Write back to LanceDB
- Update only:
articles.content_enarticles.detailed_summary(JSON withzhanden)
- Never mutate unrelated fields (
title,content,tags,category,date, etc.).
Step 5. Verify after write-back
- Re-read the target article.
- Confirm:
content_enis non-empty and render-safedetailed_summary.zh/enexists and is valid JSON structure
LanceDB Write-back Example (sf-cli)
Use the built-in CLI command to update one article from files:
<cli> db --db-path <db_path> update-article-bilingual \
--id <article_id> \
--content-en-file tmp/content_en.md \
--summary-zh-file tmp/detailed_summary_zh.md \
--summary-en-file tmp/detailed_summary_en.md
You can also update only one side:
# only content_en
<cli> db --db-path <db_path> update-article-bilingual \
--id <article_id> \
--content-en-file tmp/content_en.md
# only detailed_summary.zh/en
<cli> db --db-path <db_path> update-article-bilingual \
--id <article_id> \
--summary-zh-file tmp/detailed_summary_zh.md \
--summary-en-file tmp/detailed_summary_en.md
Suggested tmp Layout
Use tmp/article_translate/<article_id>/ and keep artifacts local:
row_backup.jsonsource_zh.mdold_content_en.mdold_detailed_summary_raw.txtcontent_en.mddetailed_summary_zh.mddetailed_summary_en.mdafter_update.json
Output Report Requirements
Always report:
- Target article id.
- Whether
content_enwas regenerated. - Whether
detailed_summary.zh/enwas regenerated. - Structure validation result (tables/code fences/links).
- Write-back status and version (if available).
- Backup artifact paths under
tmp/. - Whether generation followed LLM-native direct mode.
Failure and Rollback
- If structure checks fail: do not write back; fix first.
- If write-back fails: keep
tmpartifacts and output reproducible commands. - If post-write quality is unsatisfactory: restore from backups via the same workflow.
- If source content is missing from context and DB lookup fails, stop and request a resolvable article id/path.