Content creation expert prod

From infometa/workbuddyskills · View interactive version

Content creation expert prod is an AI agent skill from the GitHub repository infometa/workbuddyskills. 汽车图文创作团队的配套工具 Skill,提供**文章质量验证**、**通用 Markdown → HTML 渲染**和**小红书风格 HTML 渲染**三个核心能力。

How to use this skill

Skill file

Skill: content-creation-expert-prod(生产版内容创作工具)

描述

汽车图文创作团队的配套工具 Skill,提供文章质量验证、通用 Markdown → HTML 渲染和小红书风格 HTML 渲染三个核心能力。

⚠️ 生产版说明:本 Skill 是精简版,只保留 validate-article、render-html 和 render-html-xhs 三个 action。

配图由 visual-director Agent 通过 WorkBuddy 内置 ImageGen 完成,不需要 Python 脚本调用。

触发条件

| 用户意图 | action | 说明 |

|:---|:---|:---|

| 质检/验证文章质量 | validate-article | 程序化检查文章(字数/链接/结构) |

| 渲染通用文章 HTML | render-html | Markdown → 通用单栏文章 HTML + COS 可选上传,适合公众号/懂车帝/知乎 |

| 渲染小红书风格 HTML | render-html-xhs | Markdown → 小红书 PC 端双栏 UI(左图轮播 + 右文 + 评论 + 互动栏),适合小红书图文 |

调用方式

python3 scripts/main.py '<JSON参数>'

Action 参数说明

1. validate-article — 文章质量验证

| 参数 | 类型 | 必填 | 默认值 | 说明 |

|:---|:---|:---|:---|:---|

| action | string | 是 | - | 固定为 "validate-article" |

| article_text | string | 是 | - | 待检文章全文(Markdown) |

| brief_file | string | 否 | "" | Creative Brief 文件路径 |

| phase | string | 否 | "pre-delivery" | 阶段:"pre-illustrate" / "pre-delivery" |

| min_links | number | 否 | 3 | 最少超链接数 |

| min_words | number | 否 | 800 | 最少字数 |

| max_words | number | 否 | 5000 | 最大字数 |

| expected_images | number | 否 | - | 预期配图数 |

输出:

{
  "status": "pass|fail",
  "score": 85,
  "fail_count": 0,
  "warn_count": 2,
  "issues": [{"severity": "FAIL|WARN", "category": "...", "detail": "..."}],
  "stats": {"word_count": 1500, "valid_links": 4, "actual_images": 6}
}

2. render-html — Markdown → HTML 渲染

| 参数 | 类型 | 必填 | 默认值 | 说明 |

|:---|:---|:---|:---|:---|

| action | string | 是 | - | 固定为 "render-html" |

| article_text | string | 是 | - | 图文混排 MD(图片已替换为 URL) |

| title | string | 否 | 自动提取 | 文章标题 |

| output_dir | string | 否 | 当前目录 | 本地保存目录 |

输出:

{
  "status": "success",
  "html_content": "<html>...</html>",
  "html_local_path": "/abs/path/preview.html",
  "md_local_path": "/abs/path/article.md"
}

图片处理双模式(自动选择):

3. render-html-xhs — 小红书风格 HTML 渲染

将图文混排 Markdown 渲染为小红书 PC 端双栏 UI:

| 参数 | 类型 | 必填 | 默认值 | 说明 |

|:---|:---|:---|:---|:---|

| action | string | 是 | - | 固定为 "render-html-xhs" |

| article_text | string | 是 | - | 图文混排 MD(图片已替换为 URL/本地路径) |

| title | string | 否 | 自动提取 | 文章标题 |

| output_dir | string | 否 | 当前目录 | 本地保存目录 |

| author_name | string | 否 | "图文创作者" | 作者栏名称 |

| author_tag | string | 否 | "小红书博主 · 已认证" | 作者栏副标 |

| author_emoji | string | 否 | "✨" | 作者头像 emoji |

| post_time_loc | string | 否 | "刚刚 北京" | 发布时间地点 |

| likes | string | 否 | "2.3w" | 点赞数(可带 w 等单位) |

| collects | string | 否 | "1.8w" | 收藏数 |

| comments | array | 否 | 默认伪数据 | 评论列表,元素 {avatar_emoji,name,time,content,likes,reply_count,author_reply?} |

输出:

{
  "status": "success",
  "platform": "xiaohongshu",
  "html_content": "<html>...</html>",
  "html_local_path": "/abs/path/preview.html",
  "md_local_path": "/abs/path/article.md",
  "image_count": 8
}

关键 UI 特征(小红书原生对齐):

图片处理:仅做 base64 内嵌(不走 COS),适合截图发布 / 离线预览。

COS 可选配置

COS 是可选功能,用于上传图片获取公网 URL。

判断逻辑:检查环境变量 COS_SECRET_ID(或 TENCENT_SECRET_ID)是否存在。

有 COS 配置时

无 COS 配置时

凭据配置

在 skill 目录创建 .env 文件(参考 .env.example):

# COS 凭据(可选,不填则只保存本地产物)
COS_SECRET_ID=
COS_SECRET_KEY=
COS_BUCKET=int-ai-1325126984
COS_REGION=ap-guangzhou
COS_PATH_PREFIX=expert-playground

使用示例

示例 1:配图前预检(只检查文字)

python3 scripts/main.py '{"action":"validate-article","article_text":"# 标题\n\n正文...","phase":"pre-illustrate","min_links":3}'

示例 2:交付前预检

python3 scripts/main.py '{"action":"validate-article","article_text":"# 标题\n\n正文...","brief_file":"/abs/brief.md","phase":"pre-delivery"}'

示例 3:渲染通用 HTML + 图片处理(COS 自动检测)

python3 scripts/main.py '{"action":"render-html","article_text":"# 标题\n\n![图1](https://img.url)\n\n正文...","title":"比亚迪汉EV评测","output_dir":"/abs/team-artifacts"}'

示例 4:渲染小红书风格 HTML

python3 scripts/main.py '{"action":"render-html-xhs","article_text":"# 标题\n\n> 一句话定位\n\n正文...\n\n![](/abs/img.png)\n\n#tag1 #tag2","title":"20万纯电SUV推荐","output_dir":"/abs/team-artifacts","author_name":"汽车博主","post_time_loc":"06-18 北京","likes":"2.3w","collects":"1.8w"}'

HTML 产物特性

Skill 包文件结构

content-creation-expert-prod/
├── SKILL.md                    # 本文件
├── .env.example                # COS 凭据模板(可选)
├── .gitignore
├── requirements.txt            # Python 依赖
├── references/
│   └── image-generation-guide.md  # AI 图片生成完整指南(7种场景策略)
├── templates/
│   └── article.html            # Jinja2 HTML 模板
└── scripts/
    ├── main.py                 # 路由入口
    ├── config.py               # 配置加载器
    ├── cos_client.py           # COS 客户端(图片上传)
    ├── html_renderer.py        # HTML 渲染器(含 base64 图片内嵌)
    ├── html_renderer_xhs.py    # 小红书 HTML 渲染器
    ├── utils.py                # 公共工具
    └── handlers/
        ├── validate_article.py # 质量验证
        ├── render_html.py      # HTML 渲染 + 图片双模式处理
        └── render_html_xhs.py  # 小红书风格 HTML 渲染
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.