Single-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-architect thinking 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, and detailed_summary_en directly 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.id in 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-cli
sf-cli from PATH
- If the checkout is newer than the chosen binary, rebuild before use.
- Do not prefer legacy
./bin/sf-cli snapshots for storage-format-sensitive writes.
- Verify CLI availability:
- 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:
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/en via article-summary-architect reasoning.
- 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/en must 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_en
detailed_summary_zh
detailed_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
Step 4. Write back to LanceDB
- Update only:
articles.content_en
articles.detailed_summary (JSON with zh and en)
- Never mutate unrelated fields (
title, content, tags, category, date, etc.).
Step 5. Verify after write-back
- Re-read the target article.
- Confirm:
content_en is non-empty and render-safe
detailed_summary.zh/en exists 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.json
source_zh.md
old_content_en.md
old_detailed_summary_raw.txt
content_en.md
detailed_summary_zh.md
detailed_summary_en.md
after_update.json
Output Report Requirements
Always report:
- Target article id.
- Whether
content_en was regenerated.
- Whether
detailed_summary.zh/en was 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
tmp artifacts 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.
1---2name: article-bilingual-translation-publisher3description: >-4 Translate one Chinese article into high-quality English Markdown,5 regenerate bilingual detailed summaries, and write back only6 `articles.content_en` + `articles.detailed_summary` to LanceDB.7 Default workflow is context-first and LLM-native generation.8metadata:9 source: https://skillmd.com/skills/zero-yx/article-bilingual-translation-publisher10---1112# Single-Article Bilingual Translation and LanceDB Write-back1314## When To Use15Use this skill when the user asks to:161. Translate one Chinese article into high-quality English (`content_en`).172. Regenerate bilingual detailed summaries (`detailed_summary.zh/en`).183. Fix broken Markdown structure in translated content/summaries (especially tables).194. Overwrite and write the result back to LanceDB.2021## Required Context221. Required: `../article-summary-architect/SKILL.md`232. Recommended: `../staticflow-cli-publisher/SKILL.md`2425Notes:26- Summary generation must follow `article-summary-architect` thinking order27 (classify type first, then produce structured compression).28- Summaries must not paste raw table markdown into bullets.2930## Default Mode (Mandatory): LLM-native Direct Generation31Use this mode unless the user explicitly asks for another approach.32331. Read source article from current context first.342. Generate final `content_en`, `detailed_summary_zh`, and `detailed_summary_en` directly in one pass.353. Run lightweight structure checks.364. Write back via `sf-cli`.3738Hard rule:39- Do not call external model APIs, proxy model scripts, or sub-agent model commands for generation.40- Do not split translation into mechanical line-by-line scripts unless recovery is required.41- Tool/CLI usage is limited to source fetch, write-back, and essential validation.4243## Inputs44At least one is required:451. Article `id` (`articles.id` in LanceDB), or462. Markdown file path.4748If only `id` is provided, read source markdown from LanceDB `articles.content`.4950## Resolve CLI and Query Source Article51Reuse the same query path as `staticflow-cli-publisher` only when source is not already in context.52531. Resolve CLI binary in this order:54 - `./target/release/sf-cli`55 - `./target/debug/sf-cli`56 - `sf-cli` from `PATH`572. If the checkout is newer than the chosen binary, rebuild before use.583. Do not prefer legacy `./bin/sf-cli` snapshots for storage-format-sensitive writes.594. Verify CLI availability:60 - `<cli> --help`615. Preferred query path (API-style):62 - `<cli> api --db-path <db_path> get-article <article_id>`636. Fallback query path (DB-style projection):64 - `<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`657. Source-of-truth field for translation input:66 - `articles.content`6768## Hard Constraints69### English body (`content_en`)701. Translate the full article as a coherent whole (not fragmented line-by-line output).712. Preserve render-safe Markdown structure:72 - heading hierarchy73 - list nesting74 - code fence boundaries75 - inline code syntax76 - links/images syntax77 - table syntax (row/column structure)783. Do not change executable code logic.794. It is allowed (and recommended) to translate comments inside code blocks into English.805. Do not change link/image target URLs.816. Keep headings, list levels, tables, and fenced blocks structurally equivalent to the source.827. Keep formulas and technical symbols intact.8384### Bilingual summary (`detailed_summary`)851. Produce `zh/en` via `article-summary-architect` reasoning.862. Each language must contain:87 - one natural opening sentence88 - 3-5 `###` sections89 - 2-4 concise bullets per section903. Do not paste raw table markdown into summary bullets.914. `zh/en` must be semantically aligned and evidence-grounded (no fabricated claims).925. Keep summaries scannable and content-specific; avoid empty template phrases.9394## Recommended Workflow (Single Article)95### Step 1. Prepare minimal workspace96- Resolve target article id/file.97- Create `tmp/article_translate/<article_id>/`.98- Back up current row and key fields before overwrite.99100### Step 2. Generate content directly101- Produce in one coherent pass:102 - `content_en`103 - `detailed_summary_zh`104 - `detailed_summary_en`105- Prefer article-level translation, not sentence-by-sentence conversion.106107### Step 3. Lightweight structure checks108- Source vs translation:109 - same fenced-code block count110 - same Mermaid block count (if present)111 - same table block count and compatible column shape112 - same link/image target URLs113- Summary checks:114 - both languages include opening sentence + `###` sections + bullets115 - no table-markdown pollution in bullets116117### Step 4. Write back to LanceDB118- Update only:119 - `articles.content_en`120 - `articles.detailed_summary` (JSON with `zh` and `en`)121- Never mutate unrelated fields (`title`, `content`, `tags`, `category`, `date`, etc.).122123### Step 5. Verify after write-back124- Re-read the target article.125- Confirm:126 - `content_en` is non-empty and render-safe127 - `detailed_summary.zh/en` exists and is valid JSON structure128129## LanceDB Write-back Example (`sf-cli`)130Use the built-in CLI command to update one article from files:131132```bash133<cli> db --db-path <db_path> update-article-bilingual \134 --id <article_id> \135 --content-en-file tmp/content_en.md \136 --summary-zh-file tmp/detailed_summary_zh.md \137 --summary-en-file tmp/detailed_summary_en.md138```139140You can also update only one side:141142```bash143# only content_en144<cli> db --db-path <db_path> update-article-bilingual \145 --id <article_id> \146 --content-en-file tmp/content_en.md147148# only detailed_summary.zh/en149<cli> db --db-path <db_path> update-article-bilingual \150 --id <article_id> \151 --summary-zh-file tmp/detailed_summary_zh.md \152 --summary-en-file tmp/detailed_summary_en.md153```154155## Suggested tmp Layout156Use `tmp/article_translate/<article_id>/` and keep artifacts local:157- `row_backup.json`158- `source_zh.md`159- `old_content_en.md`160- `old_detailed_summary_raw.txt`161- `content_en.md`162- `detailed_summary_zh.md`163- `detailed_summary_en.md`164- `after_update.json`165166## Output Report Requirements167Always report:1681. Target article id.1692. Whether `content_en` was regenerated.1703. Whether `detailed_summary.zh/en` was regenerated.1714. Structure validation result (tables/code fences/links).1725. Write-back status and version (if available).1736. Backup artifact paths under `tmp/`.1747. Whether generation followed LLM-native direct mode.175176## Failure and Rollback1771. If structure checks fail: do not write back; fix first.1782. If write-back fails: keep `tmp` artifacts and output reproducible commands.1793. If post-write quality is unsatisfactory: restore from backups via the same workflow.1804. If source content is missing from context and DB lookup fails, stop and request a resolvable article id/path.