360 Secure SkillHub
360 安全技能中心

blog-polish-en-astro-cn

核心功能:接收技术博客Markdown草稿,润色生成1000-1200字、4-5小节的英文稿,再翻译为简体中文稿,同时将英文稿转为带标准前端元数据的Astro兼容格式,全程保留技术术语与代码块。典型场景:需润色博客、翻译为中文或适配Astro框架时使用,输入为草稿路径和输出目录,输出三个成品文件路径。

j3ffyang
j3ffyang
热度 38.52
最近更新 2026-05-18 12:31:44
分类:效率依赖:代码执行 / 读写文件 / 内部调用大模型应用场景:博客写作 / 翻译 / 校对润色 / 文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add blog-polish-en-astro-cn
Metadata
name
blog-polish-en-astro-cn
description
Polish and translate a technical blog draft into a 1000–1200 word, 4-5 section Markdown article in English and Simplified Chinese (zh-CN), preserving technical terms and code blocks. Then convert the English edition into Astro markdown compatible
author
Jeff Yang
version
1.0.12
tags
["openclaw","clawhub","blog","polish","translate","linux","markdown"]
metadata
{"openclaw":{"requires":["jq"],"platforms":["linux","darwin"]},"entrypoint":"skill"}
inputSchema
{"type":"object","properties":{"draftPath":{"type":"string","description":"Path to the draft markdown file.","default":"~/.openclaw/workspace/contentDraft/latestDraft.md"},"outputDir":{"type":"string","description":"Directory where polished file is saved.","default":"~/.openclaw/workspace/contentPolished/"}},"required":["draftPath","outputDir"]}
outputSchema
{"type":"object","properties":{"outputPath":{"type":"string","description":"Path to the final polished markdown file."}},"required":["outputPath"]}
workflow
[{"name":"init","description":"Set defaults and create timestamp","run":"draftPath=${draftPath:-~/.openclaw/workspace/contentDraft/latestDraft.md}\noutputDir=${outputDir:-~/.openclaw/workspace/contentPolished/}\noutputDir=$(eval echo \"$outputDir\")\nts=$(date +\"%y%m%d%H%M\")\nsave_state ts \"$ts\"\nsave_state draftPath \"$draftPath\"\nsave_state outputDir \"$outputDir\"\n"},{"name":"verify_input","description":"Check if draftPath exists","run":"if [ ! -f \"$draftPath\" ]; then\n echo \"Error: Draft not found at $draftPath\" >&2\n exit 1\nfi\n"},{"name":"generate-slug","description":"Create Astro-compatible slug from filename or title","run":"# Default: use input filename without extension\nslug=$(basename \"$draftPath\" .md | sed 's/^[0-9]\\{10\\}-//' | tr '[:upper:]' '[:lower:]' | tr -s '-' | sed 's/[^a-z0-9-]//g')\n# Better: extract title from first H1 header\ntitle=$(sed -n 's/# \\(.*\\)/\\1/p' \"$draftPath\" | head -1 | tr '[:upper:]' '[:lower:]' | tr -s ' ' '-' | sed 's/[^a-z0-9-]//g' | sed 's/--*/-/g')\n# Use title if available, else filename\nslug=\"${title:-$slug}\"\n# Fallback: timestamp\nslug=\"${slug:-$(date +%y%m%d%H%M)}\"\nsave_state slug \"$slug\"\nsave_state title \"$title\"\n"},{"name":"prepare_output","description":"Define output filename variable","run":"ts=$(load_state ts)\nslug=$(load_state slug)\noutputDir=$(load_state outputDir)\noutputPath=\"${outputDir}/${ts}-${slug}_eng.md\"\nsave_state outputPath \"$outputPath\"\n"},{"name":"read_draft","inputs":["draftPath"],"outputs":["draftText"]},{"name":"polish","description":"LLM: Polish grammar in English → Save to ${outputDir}/${ts}-${slug}_eng.md","inputs":["draftText","ts","outputDir"],"outputs":["outputPath"],"llm":true,"set_output":"engOutputPath","post":"save_state engOutputPath \"$outputPath\"\n"},{"name":"translate","description":"LLM: Polish grammar in Simplified Chinese > Translate in Simplified → Save to ${outputDir}/${ts}-${slug}_chn.md","inputs":["outputPath","ts","outputDir"],"outputs":["outputPath"],"llm":true,"set_output":"chnOutputPath","post":"save_state chnOutputPath \"$outputPath\"\n"},{"name":"add-astro-frontmatter","description":"Inject standard Astro YAML header into polished file","run":"slug=$(load_state slug)\ntitle=$(load_state title)\nts=$(load_state ts)\npolishedFile=$(load_state engOutputPath)\noutputDir=$(load_state outputDir)\noutputFile=\"${outputDir}/${ts}-${slug}_astro.md\"\ntagsYAML='[\"linux\",\"ai\",\"opensource\",\"openclaw\"]'\n\ncat > \"$outputFile\" << EOF\n"}]

title: "${title:-Generated by OpenClaw}" date: $(date -Iseconds) tags: ${tagsYAML} image: ./hero.png

$(cat "$polishedFile") EOF

  mkdir -p "${outputDir}/${ts}-${slug}/images/"
  save_state outputPath "$outputFile"
  • name: finalize description: Emit polished path only run: |

outputPath=$(load_state outputPath)

jq -n --arg outputPath "$outputPath" '{ outputPath: $outputPath }'

    engOutputPath=$(load_state engOutputPath)
    chnOutputPath=$(load_state chnOutputPath)
    outputPath=$(load_state outputPath)
    jq -n \
      --arg engOutputPath "$engOutputPath" \
      --arg chnOutputPath "$chnOutputPath" \
      --arg astroPath "$outputPath" \
      '{ engOutputPath: $engOutputPath, chnOutputPath: $chnOutputPath, astroPath: $astroPath }'

Blog Polish (en-US and zh-CN)

This skill polishes a technical blog draft and translates it to English and then Simplified Chinese while preserving technical accuracy.

When to Use

Use when the user asks to polish/translate a technical blog draft to zh-CN without images. Triggers: "polish my draft", "translate blog to Chinese", "enhance latestDraft.md".

Defaults

  • draftPath: ~/.openclaw/workspace/contentDraft/latestDraft.md
  • outputDir: ~/.openclaw/workspace/contentPolished/
  • Output filename: ${ts}-polished.md or ${ts}-${subject}.md

Workflow Summary

Draft → Check → Polish (EN) → Translate (ZH) → Convert EN to Astro format → Emit path JSON.

  1. Resolve paths + create timestamp (date +"%y%m%d%H%M")
  2. Read draft from draftPath
  3. Polish English: Fix grammar/spelling, improve clarity, structure into 4-5 sections, target 1000-1200 words
  4. Translate to zh-CN: Preserve code blocks, inline code, technical terms (openclaw, skill, cli)
  5. Save polished markdown to ${outputDir}/${ts}-polished.md
  6. Return: { outputPath: "/full/path/to/file.md" }

Output

Example

Input: ~/.openclaw/workspace/contentDraft/latestDraft.md
{ "outputPath": "~/.openclaw/workspace/contentPolished/2603142134-openclaw-skills.md" }