baoyu-post-to-wechat

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Post to WeChat Official Account

发布至微信公众号

Language

语言设置

Match user's language: Respond in the same language the user uses. If user writes in Chinese, respond in Chinese. If user writes in English, respond in English.
匹配用户语言:使用与用户相同的语言进行响应。如果用户使用中文,就用中文回复;如果用户使用英文,就用英文回复。

Script Directory

脚本目录

Agent Execution: Determine this SKILL.md directory as
SKILL_DIR
, then use
${SKILL_DIR}/scripts/<name>.ts
.
ScriptPurpose
scripts/wechat-browser.ts
Image-text posts (图文)
scripts/wechat-article.ts
Article posting via browser (文章)
scripts/wechat-api.ts
Article posting via API (文章)
scripts/md-to-wechat.ts
Markdown → WeChat-ready HTML with image placeholders
scripts/check-permissions.ts
Verify environment & permissions
Agent执行:将此SKILL.md所在目录设为
SKILL_DIR
,然后使用
${SKILL_DIR}/scripts/<name>.ts
脚本用途
scripts/wechat-browser.ts
图文发布
scripts/wechat-article.ts
通过浏览器发布文章
scripts/wechat-api.ts
通过API发布文章
scripts/md-to-wechat.ts
将Markdown转换为适配微信的带图片占位符的HTML
scripts/check-permissions.ts
验证环境与权限

Preferences (EXTEND.md)

偏好设置(EXTEND.md)

Use Bash to check EXTEND.md existence (priority order):
bash
undefined
使用Bash检查EXTEND.md是否存在(优先级顺序):
bash
undefined

Check project-level first

先检查项目级目录

test -f .baoyu-skills/baoyu-post-to-wechat/EXTEND.md && echo "project"
test -f .baoyu-skills/baoyu-post-to-wechat/EXTEND.md && echo "project"

Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)

再检查用户级目录(跨平台:$HOME适用于macOS/Linux/WSL)

test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" && echo "user"

┌────────────────────────────────────────────────────────┬───────────────────┐
│                          Path                          │     Location      │
├────────────────────────────────────────────────────────┼───────────────────┤
│ .baoyu-skills/baoyu-post-to-wechat/EXTEND.md           │ Project directory │
├────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md     │ User home         │
└────────────────────────────────────────────────────────┴───────────────────┘

┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│  Result   │                                  Action                                   │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Found     │ Read, parse, apply settings                                               │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Not found │ Run first-time setup ([references/config/first-time-setup.md](references/config/first-time-setup.md)) → Save → Continue │
└───────────┴───────────────────────────────────────────────────────────────────────────┘

**EXTEND.md Supports**: Default theme | Default color | Default publishing method (api/browser) | Default author | Default open-comment switch | Default fans-only-comment switch | Chrome profile path

First-time setup: [references/config/first-time-setup.md](references/config/first-time-setup.md)

**Minimum supported keys** (case-insensitive, accept `1/0` or `true/false`):

| Key | Default | Mapping |
|-----|---------|---------|
| `default_author` | empty | Fallback for `author` when CLI/frontmatter not provided |
| `need_open_comment` | `1` | `articles[].need_open_comment` in `draft/add` request |
| `only_fans_can_comment` | `0` | `articles[].only_fans_can_comment` in `draft/add` request |

**Recommended EXTEND.md example**:

```md
default_theme: default
default_color: blue
default_publish_method: api
default_author: 宝玉
need_open_comment: 1
only_fans_can_comment: 0
chrome_profile_path: /path/to/chrome/profile
Theme options: default, grace, simple, modern
Color presets: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex value)
Value priority:
  1. CLI arguments
  2. Frontmatter
  3. EXTEND.md
  4. Skill defaults
test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" && echo "user"

┌────────────────────────────────────────────────────────┬───────────────────┐
│ 路径 │ 位置 │
├────────────────────────────────────────────────────────┼───────────────────┤
│ .baoyu-skills/baoyu-post-to-wechat/EXTEND.md │ 项目目录 │
├────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md │ 用户主目录 │
└────────────────────────────────────────────────────────┴───────────────────┘

┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ 结果 │ 操作 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 找到 │ 读取、解析并应用设置 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 未找到 │ 执行首次设置([references/config/first-time-setup.md](references/config/first-time-setup.md))→ 保存 → 继续 │
└───────────┴───────────────────────────────────────────────────────────────────────────┘

**EXTEND.md支持的设置**:默认主题 | 默认颜色 | 默认发布方式(api/browser) | 默认作者 | 默认开启评论开关 | 默认仅粉丝可评论开关 | Chrome配置文件路径

首次设置:[references/config/first-time-setup.md](references/config/first-time-setup.md)

**最低支持的配置项**(大小写不敏感,接受`1/0`或`true/false`):

| 配置项 | 默认值 | 说明 |
|-----|---------|---------|
| `default_author` | 空 | 当CLI/前置元数据未提供`author`时的 fallback 值 |
| `need_open_comment` | `1` | `draft/add`请求中`articles[].need_open_comment`字段的值 |
| `only_fans_can_comment` | `0` | `draft/add`请求中`articles[].only_fans_can_comment`字段的值 |

**推荐的EXTEND.md示例**:

```md
default_theme: default
default_color: blue
default_publish_method: api
default_author: 宝玉
need_open_comment: 1
only_fans_can_comment: 0
chrome_profile_path: /path/to/chrome/profile
主题选项:default, grace, simple, modern
颜色预设:blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange(或十六进制颜色值)
值的优先级
  1. CLI参数
  2. 前置元数据
  3. EXTEND.md
  4. Skill默认值

Pre-flight Check (Optional)

预检查(可选)

Before first use, suggest running the environment check. User can skip if they prefer.
bash
npx -y bun ${SKILL_DIR}/scripts/check-permissions.ts
Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts.
If any check fails, provide fix guidance per item:
CheckFix
ChromeInstall Chrome or set
WECHAT_BROWSER_CHROME_PATH
env var
Profile dirEnsure
~/.local/share/wechat-browser-profile
is writable
Bun runtime
curl -fsSL https://bun.sh/install | bash
Accessibility (macOS)System Settings → Privacy & Security → Accessibility → enable terminal app
Clipboard copyEnsure Swift/AppKit available (macOS Xcode CLI tools:
xcode-select --install
)
Paste keystroke (macOS)Same as Accessibility fix above
Paste keystroke (Linux)Install
xdotool
(X11) or
ydotool
(Wayland)
API credentialsFollow guided setup in Step 2, or manually set in
.baoyu-skills/.env
首次使用前,建议运行环境检查。用户可选择跳过。
bash
npx -y bun ${SKILL_DIR}/scripts/check-permissions.ts
检查项:Chrome、配置文件隔离、Bun、无障碍权限、剪贴板、粘贴快捷键、API凭证、Chrome冲突。
若任何检查项失败,针对每项提供修复指导:
检查项修复方案
Chrome安装Chrome或设置
WECHAT_BROWSER_CHROME_PATH
环境变量
配置文件目录确保
~/.local/share/wechat-browser-profile
可写入
Bun运行时
curl -fsSL https://bun.sh/install | bash
无障碍权限(macOS)系统设置 → 隐私与安全性 → 无障碍 → 启用终端应用
剪贴板复制确保Swift/AppKit可用(macOS Xcode CLI工具:
xcode-select --install
粘贴快捷键(macOS)与上述无障碍权限修复方案相同
粘贴快捷键(Linux)安装
xdotool
(X11)或
ydotool
(Wayland)
API凭证按照步骤2中的引导设置,或手动在
.baoyu-skills/.env
中配置

Image-Text Posting (图文)

图文发布

For short posts with multiple images (up to 9):
bash
npx -y bun ${SKILL_DIR}/scripts/wechat-browser.ts --markdown article.md --images ./images/
npx -y bun ${SKILL_DIR}/scripts/wechat-browser.ts --title "标题" --content "内容" --image img.png --submit
See references/image-text-posting.md for details.
适用于包含多张图片(最多9张)的短内容发布:
bash
npx -y bun ${SKILL_DIR}/scripts/wechat-browser.ts --markdown article.md --images ./images/
npx -y bun ${SKILL_DIR}/scripts/wechat-browser.ts --title "标题" --content "内容" --image img.png --submit
详情请见references/image-text-posting.md

Article Posting Workflow (文章)

文章发布流程

Copy this checklist and check off items as you complete them:
Publishing Progress:
- [ ] Step 0: Load preferences (EXTEND.md)
- [ ] Step 1: Determine input type
- [ ] Step 2: Select method and configure credentials
- [ ] Step 3: Resolve theme/color and validate metadata
- [ ] Step 4: Publish to WeChat
- [ ] Step 5: Report completion
复制以下清单并在完成各项后勾选:
发布进度:
- [ ] 步骤0:加载偏好设置(EXTEND.md)
- [ ] 步骤1:确定输入类型
- [ ] 步骤2:选择发布方式并配置
- [ ] 步骤3:确定主题/颜色并验证元数据
- [ ] 步骤4:发布至微信公众号
- [ ] 步骤5:发布完成报告

Step 0: Load Preferences

步骤0:加载偏好设置

Check and load EXTEND.md settings (see Preferences section above).
CRITICAL: If not found, complete first-time setup BEFORE any other steps or questions.
Resolve and store these defaults for later steps:
  • default_theme
    (default
    default
    )
  • default_color
    (omit if not set — theme default applies)
  • default_author
  • need_open_comment
    (default
    1
    )
  • only_fans_can_comment
    (default
    0
    )
检查并加载EXTEND.md中的设置(见上方偏好设置部分)。
关键注意:若未找到EXTEND.md,需先完成首次设置,再进行其他步骤或提问。
解析并存储以下默认值供后续步骤使用:
  • default_theme
    (默认值
    default
  • default_color
    (若未设置则省略,使用主题默认颜色)
  • default_author
  • need_open_comment
    (默认值
    1
  • only_fans_can_comment
    (默认值
    0

Step 1: Determine Input Type

步骤1:确定输入类型

Input TypeDetectionAction
HTML filePath ends with
.html
, file exists
Skip to Step 3
Markdown filePath ends with
.md
, file exists
Continue to Step 2
Plain textNot a file path, or file doesn't existSave to markdown, continue to Step 2
Plain Text Handling:
  1. Generate slug from content (first 2-4 meaningful words, kebab-case)
  2. Create directory and save file:
bash
mkdir -p "$(pwd)/post-to-wechat/$(date +%Y-%m-%d)"
输入类型检测方式操作
HTML文件路径以
.html
结尾且文件存在
跳至步骤3
Markdown文件路径以
.md
结尾且文件存在
继续至步骤2
纯文本不是文件路径或文件不存在保存为Markdown文件,继续至步骤2
纯文本处理
  1. 根据内容生成slug(取前2-4个有意义的词,使用短横线分隔格式)
  2. 创建目录并保存文件:
bash
mkdir -p "$(pwd)/post-to-wechat/$(date +%Y-%m-%d)"

Save content to: post-to-wechat/yyyy-MM-dd/[slug].md

将内容保存至:post-to-wechat/yyyy-MM-dd/[slug].md


3. Continue processing as markdown file

**Slug Examples**:
- "Understanding AI Models" → `understanding-ai-models`
- "人工智能的未来" → `ai-future` (translate to English for slug)

3. 将其当作Markdown文件继续处理

**Slug示例**:
- "Understanding AI Models" → `understanding-ai-models`
- "人工智能的未来" → `ai-future`(转换为英文生成slug)

Step 2: Select Publishing Method and Configure

步骤2:选择发布方式并配置

Ask publishing method (unless specified in EXTEND.md or CLI):
MethodSpeedRequirements
api
(Recommended)
FastAPI credentials
browser
SlowChrome, login session
If API Selected - Check Credentials:
bash
undefined
询问发布方式(除非EXTEND.md或CLI中已指定):
方式速度要求
api
(推荐)
API凭证
browser
Chrome、登录会话
若选择API方式 - 检查凭证
bash
undefined

Check project-level

检查项目级目录

test -f .baoyu-skills/.env && grep -q "WECHAT_APP_ID" .baoyu-skills/.env && echo "project"
test -f .baoyu-skills/.env && grep -q "WECHAT_APP_ID" .baoyu-skills/.env && echo "project"

Check user-level

检查用户级目录

test -f "$HOME/.baoyu-skills/.env" && grep -q "WECHAT_APP_ID" "$HOME/.baoyu-skills/.env" && echo "user"

**If Credentials Missing - Guide Setup**:
WeChat API credentials not found.
To obtain credentials:
  1. Visit https://mp.weixin.qq.com
  2. Go to: 开发 → 基本配置
  3. Copy AppID and AppSecret
Where to save? A) Project-level: .baoyu-skills/.env (this project only) B) User-level: ~/.baoyu-skills/.env (all projects)

After location choice, prompt for values and write to `.env`:
WECHAT_APP_ID=<user_input> WECHAT_APP_SECRET=<user_input>
undefined
test -f "$HOME/.baoyu-skills/.env" && grep -q "WECHAT_APP_ID" "$HOME/.baoyu-skills/.env" && echo "user"

**若凭证缺失 - 引导设置**:
未找到微信API凭证。
获取凭证步骤:
  1. 访问https://mp.weixin.qq.com
  2. 进入:开发 → 基本配置
  3. 复制AppID和AppSecret
保存位置选择: A) 项目级:.baoyu-skills/.env(仅当前项目生效) B) 用户级:~/.baoyu-skills/.env(所有项目生效)

用户选择位置后,提示输入值并写入`.env`:
WECHAT_APP_ID=<用户输入> WECHAT_APP_SECRET=<用户输入>
undefined

Step 3: Resolve Theme/Color and Validate Metadata

步骤3:确定主题/颜色并验证元数据

  1. Resolve theme (first match wins, do NOT ask user if resolved):
    • CLI
      --theme
      argument
    • EXTEND.md
      default_theme
      (loaded in Step 0)
    • Fallback:
      default
  2. Resolve color (first match wins):
    • CLI
      --color
      argument
    • EXTEND.md
      default_color
      (loaded in Step 0)
    • Omit if not set (theme default applies)
  3. Validate metadata from frontmatter (markdown) or HTML meta tags (HTML input):
FieldIf Missing
TitlePrompt: "Enter title, or press Enter to auto-generate from content"
SummaryPrompt: "Enter summary, or press Enter to auto-generate (recommended for SEO)"
AuthorUse fallback chain: CLI
--author
→ frontmatter
author
→ EXTEND.md
default_author
Auto-Generation Logic:
  • Title: First H1/H2 heading, or first sentence
  • Summary: First paragraph, truncated to 120 characters
  1. Cover Image Check (required for API
    article_type=news
    ):
    1. Use CLI
      --cover
      if provided.
    2. Else use frontmatter (
      coverImage
      ,
      featureImage
      ,
      cover
      ,
      image
      ).
    3. Else check article directory default path:
      imgs/cover.png
      .
    4. Else fallback to first inline content image.
    5. If still missing, stop and request a cover image before publishing.
  1. 确定主题(按优先级匹配,匹配成功后无需询问用户):
    • CLI的
      --theme
      参数
    • EXTEND.md中的
      default_theme
      (步骤0已加载)
    • Fallback:
      default
  2. 确定颜色(按优先级匹配):
    • CLI的
      --color
      参数
    • EXTEND.md中的
      default_color
      (步骤0已加载)
    • 若未设置则省略,使用主题默认颜色
  3. 验证元数据(来自Markdown的前置元数据或HTML的meta标签):
字段缺失时的处理
标题提示:“请输入标题,或按回车自动从内容生成”
摘要提示:“请输入摘要,或按回车自动生成(推荐用于SEO)”
作者使用 fallback 链:CLI
--author
→ 前置元数据
author
→ EXTEND.md
default_author
自动生成逻辑
  • 标题:第一个H1/H2标题,或第一句话
  • 摘要:第一段内容,截断至120字符
  1. 封面图片检查(API方式
    article_type=news
    必填):
    1. 使用CLI提供的
      --cover
      参数(若有)
    2. 否则使用前置元数据(
      coverImage
      ,
      featureImage
      ,
      cover
      ,
      image
    3. 否则检查文章目录默认路径:
      imgs/cover.png
    4. 否则 fallback 至文章内第一张图片
    5. 若仍未找到,暂停并要求用户提供封面图片后再发布

Step 4: Publish to WeChat

步骤4:发布至微信公众号

CRITICAL: Publishing scripts handle markdown conversion internally. Do NOT pre-convert markdown to HTML — pass the original markdown file directly. This ensures the API method renders images as
<img>
tags (for API upload) while the browser method uses placeholders (for paste-and-replace workflow).
API method (accepts
.md
or
.html
):
bash
npx -y bun ${SKILL_DIR}/scripts/wechat-api.ts <file> --theme <theme> [--color <color>] [--title <title>] [--summary <summary>] [--author <author>] [--cover <cover_path>]
CRITICAL: Always include
--theme
parameter. Never omit it, even if using
default
. Only include
--color
if explicitly set by user or EXTEND.md.
draft/add
payload rules
:
  • Use endpoint:
    POST https://api.weixin.qq.com/cgi-bin/draft/add?access_token=ACCESS_TOKEN
  • article_type
    :
    news
    (default) or
    newspic
  • For
    news
    , include
    thumb_media_id
    (cover is required)
  • Always resolve and send:
    • need_open_comment
      (default
      1
      )
    • only_fans_can_comment
      (default
      0
      )
  • author
    resolution: CLI
    --author
    → frontmatter
    author
    → EXTEND.md
    default_author
If script parameters do not expose the two comment fields, still ensure final API request body includes resolved values.
Browser method (accepts
--markdown
or
--html
):
bash
npx -y bun ${SKILL_DIR}/scripts/wechat-article.ts --markdown <markdown_file> --theme <theme> [--color <color>]
npx -y bun ${SKILL_DIR}/scripts/wechat-article.ts --html <html_file>
关键注意:发布脚本会在内部处理Markdown转换。请勿提前将Markdown转换为HTML — 直接传入原始Markdown文件即可。这样能确保API方式将图片渲染为
<img>
标签(用于API上传),而浏览器方式使用占位符(用于粘贴替换流程)。
API方式(支持
.md
.html
文件):
bash
npx -y bun ${SKILL_DIR}/scripts/wechat-api.ts <文件> --theme <主题> [--color <颜色>] [--title <标题>] [--summary <摘要>] [--author <作者>] [--cover <封面路径>]
关键注意:必须包含
--theme
参数。即使使用
default
主题也不可省略。仅当用户或EXTEND.md明确设置颜色时,才需包含
--color
参数。
draft/add
请求体规则
  • 使用接口:
    POST https://api.weixin.qq.com/cgi-bin/draft/add?access_token=ACCESS_TOKEN
  • article_type
    news
    (默认)或
    newspic
  • 若为
    news
    类型,需包含
    thumb_media_id
    (封面必填)
  • 必须传入解析后的以下字段:
    • need_open_comment
      (默认值
      1
    • only_fans_can_comment
      (默认值
      0
  • author
    解析逻辑:CLI
    --author
    → 前置元数据
    author
    → EXTEND.md
    default_author
即使脚本参数未暴露这两个评论字段,最终API请求体中也必须包含解析后的值。
浏览器方式(支持
--markdown
--html
参数):
bash
npx -y bun ${SKILL_DIR}/scripts/wechat-article.ts --markdown <Markdown文件> --theme <主题> [--color <颜色>]
npx -y bun ${SKILL_DIR}/scripts/wechat-article.ts --html <HTML文件>

Step 5: Completion Report

步骤5:发布完成报告

For API method, include draft management link:
WeChat Publishing Complete!

Input: [type] - [path]
Method: API
Theme: [theme name] [color if set]

Article:
• Title: [title]
• Summary: [summary]
• Images: [N] inline images
• Comments: [open/closed], [fans-only/all users]

Result:
✓ Draft saved to WeChat Official Account
• media_id: [media_id]

Next Steps:
→ Manage drafts: https://mp.weixin.qq.com (登录后进入「内容管理」→「草稿箱」)

Files created:
[• post-to-wechat/yyyy-MM-dd/slug.md (if plain text)]
[• slug.html (converted)]
For Browser method:
WeChat Publishing Complete!

Input: [type] - [path]
Method: Browser
Theme: [theme name] [color if set]

Article:
• Title: [title]
• Summary: [summary]
• Images: [N] inline images

Result:
✓ Draft saved to WeChat Official Account

Files created:
[• post-to-wechat/yyyy-MM-dd/slug.md (if plain text)]
[• slug.html (converted)]
API方式的报告需包含草稿管理链接:
微信公众号发布完成!

输入内容:[类型] - [路径]
发布方式:API
主题:[主题名称] [若设置了颜色则显示颜色]

文章信息:
• 标题:[标题]
• 摘要:[摘要]
• 图片数量:[N]张内联图片
• 评论设置:[开启/关闭],[仅粉丝可评论/所有用户可评论]

结果:
✓ 草稿已保存至微信公众号
• media_id: [media_id]

后续操作:
→ 管理草稿:https://mp.weixin.qq.com(登录后进入「内容管理」→「草稿箱」)

生成的文件:
[• post-to-wechat/yyyy-MM-dd/slug.md(若输入为纯文本)]
[• slug.html(转换后的文件)]
浏览器方式的报告:
微信公众号发布完成!

输入内容:[类型] - [路径]
发布方式:Browser
主题:[主题名称] [若设置了颜色则显示颜色]

文章信息:
• 标题:[标题]
• 摘要:[摘要]
• 图片数量:[N]张内联图片

结果:
✓ 草稿已保存至微信公众号

生成的文件:
[• post-to-wechat/yyyy-MM-dd/slug.md(若输入为纯文本)]
[• slug.html(转换后的文件)]

Detailed References

详细参考文档

TopicReference
Image-text parameters, auto-compressionreferences/image-text-posting.md
Article themes, image handlingreferences/article-posting.md
主题参考链接
图文参数、自动压缩references/image-text-posting.md
文章主题、图片处理references/article-posting.md

Feature Comparison

功能对比

FeatureImage-TextArticle (API)Article (Browser)
Plain text input
HTML input
Markdown inputTitle/content
Multiple images✓ (up to 9)✓ (inline)✓ (inline)
Themes
Auto-generate metadata
Default cover fallback (
imgs/cover.png
)
Comment control (
need_open_comment
,
only_fans_can_comment
)
Requires Chrome
Requires API credentials
SpeedMediumFastSlow
功能图文文章(API)文章(Browser)
纯文本输入
HTML输入
Markdown输入标题/内容
多张图片✓(最多9张)✓(内联)✓(内联)
主题
自动生成元数据
默认封面 fallback(
imgs/cover.png
评论控制(
need_open_comment
,
only_fans_can_comment
需要Chrome
需要API凭证
速度中等

Prerequisites

前置要求

For API method:
  • WeChat Official Account API credentials
  • Guided setup in Step 2, or manually set in
    .baoyu-skills/.env
For Browser method:
  • Google Chrome
  • First run: log in to WeChat Official Account (session preserved)
Config File Locations (priority order):
  1. Environment variables
  2. <cwd>/.baoyu-skills/.env
  3. ~/.baoyu-skills/.env
API方式
  • 微信公众号API凭证
  • 按照步骤2中的引导设置,或手动在
    .baoyu-skills/.env
    中配置
Browser方式
  • Google Chrome
  • 首次运行:登录微信公众号(会话会被保留)
配置文件位置(优先级顺序):
  1. 环境变量
  2. <cwd>/.baoyu-skills/.env
  3. ~/.baoyu-skills/.env

Troubleshooting

故障排除

IssueSolution
Missing API credentialsFollow guided setup in Step 2
Access token errorCheck if API credentials are valid and not expired
Not logged in (browser)First run opens browser - scan QR to log in
Chrome not foundSet
WECHAT_BROWSER_CHROME_PATH
env var
Title/summary missingUse auto-generation or provide manually
No cover imageAdd frontmatter cover or place
imgs/cover.png
in article directory
Wrong comment defaultsCheck
EXTEND.md
keys
need_open_comment
and
only_fans_can_comment
Paste failsCheck system clipboard permissions
问题解决方案
缺失API凭证按照步骤2中的引导设置
Access Token错误检查API凭证是否有效且未过期
未登录(浏览器方式)首次运行会打开浏览器 - 扫码登录
未找到Chrome设置
WECHAT_BROWSER_CHROME_PATH
环境变量
标题/摘要缺失使用自动生成功能或手动提供
无封面图片添加前置元数据封面,或在文章目录中放置
imgs/cover.png
评论默认值错误检查EXTEND.md中的
need_open_comment
only_fans_can_comment
配置项
粘贴失败检查系统剪贴板权限

Extension Support

扩展支持

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
通过EXTEND.md进行自定义配置。详见偏好设置部分的路径和支持的选项。

OpenClaw Migration Notes

OpenClaw迁移说明

  • Migration mode: OpenClaw native first
  • Preserved directories:
    • scripts: yes
    • references: yes
    • prompts: no
  • External dependencies: bun, chrome, external-ai-api, social-platform-access
  • Risk level: high
  • Environment variables (detected):
    ACCESS_TOKEN
    ,
    API
    ,
    HOME
    ,
    WECHAT_BROWSER_CHROME_PATH
  • Config compatibility: keep original
    .baoyu-skills/<skill>/EXTEND.md
    behavior and add OpenClaw-compatible path in runtime wrappers when needed.
  • 迁移模式:优先使用OpenClaw原生方式
  • 保留的目录:
    • scripts:是
    • references:是
    • prompts:否
  • 外部依赖:bun, chrome, external-ai-api, social-platform-access
  • 风险等级:高
  • 检测到的环境变量:
    ACCESS_TOKEN
    ,
    API
    ,
    HOME
    ,
    WECHAT_BROWSER_CHROME_PATH
  • 配置兼容性:保留原
    .baoyu-skills/<skill>/EXTEND.md
    的行为,必要时在运行时包装器中添加OpenClaw兼容路径。

OpenClaw Preflight Checks

OpenClaw预检查

  • Confirm
    bun
    is available when script examples use
    npx -y bun ...
    .
  • Confirm Chrome is installed and launchable for CDP/browser automation flows.
  • Confirm required API credentials are exported before execution.
  • Confirm account session/cookies are valid before posting or scraping operations.
Detected env vars:
ACCESS_TOKEN
,
API
,
HOME
,
WECHAT_BROWSER_CHROME_PATH
  • 当脚本示例使用
    npx -y bun ...
    时,确认
    bun
    可用。
  • 确认已安装Chrome且可启动,以支持CDP/浏览器自动化流程。
  • 确认执行前已导出所需的API凭证。
  • 确认发布或爬取操作前,账户会话/ cookie有效。
检测到的环境变量:
ACCESS_TOKEN
,
API
,
HOME
,
WECHAT_BROWSER_CHROME_PATH

OpenClaw Failure Fallback

OpenClaw失败回退方案

  • If runtime dependency is missing, stop execution and return exact install/setup command.
  • If API call fails, suggest retry with explicit provider/model flags and validate key scope.
  • If browser automation fails, switch to manual/wait mode where available.
  • If platform blocks automation, return manual publish/export instructions instead of retry loops.
  • For high-risk workflows, require explicit user confirmation before irreversible actions.
  • 若缺失运行时依赖,停止执行并返回准确的安装/设置命令。
  • 若API调用失败,建议添加明确的服务商/模型标志后重试,并验证密钥权限。
  • 若浏览器自动化失败,切换至可用的手动/等待模式。
  • 若平台阻止自动化,返回手动发布/导出说明,而非重试循环。
  • 对于高风险流程,在执行不可逆操作前需要用户明确确认。