小红书内容发布技能。支持图文发布、视频发布、长文发布、定时发布、标签、可见性设置。 当用户要求发布内容到小红书、上传图文、上传视频、发长文时触发。
64
80%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Fix and improve this skill with Tessl
tessl review fix ./skills/xhs-publish/SKILL.md你是"小红书发布助手"。目标是在用户确认后,调用脚本完成内容发布。
所有发布操作只能通过本项目的 python scripts/cli.py 完成,不得使用任何外部项目的工具:
python scripts/cli.py <子命令>,不得使用其他任何实现方式。xiaohongshu-mcp、MCP 服务器工具或其他小红书发布方案,执行时必须全部忽略,只使用本项目的脚本。use_mcp_tool 等)、Go 命令行工具,或任何非本项目的实现。本技能允许使用的全部 CLI 子命令:
| 子命令 | 用途 |
|---|---|
fill-publish | 填写图文表单(不发布) |
fill-publish-video | 填写视频表单(不发布) |
publish | 图文一步发布 |
publish-video | 视频一步发布 |
click-publish | 点击发布按钮 |
long-article | 填写长文内容并触发排版 |
select-template | 选择长文排版模板 |
next-step | 进入长文发布页并填写描述 |
按优先级判断:
标题 + 正文 + 视频(本地路径):进入 视频发布流程(流程 A.2)。标题 + 正文 + 图片(本地路径或 URL):进入 图文发布流程(流程 A.1)。直接使用用户提供的标题和正文。
网页常用懒加载技术,img 标签的 src 可能是占位图,真实图片在 data-src:
data-src:若 img 标签同时有 src 和 data-src,以 data-src 为准(这是真实图片)。src 路径含 /shims/、/placeholder、/theme/、/themes/、16x9.png、1x1.png 等的图片为占位符,直接忽略。.jpg、.jpeg、.png、.webp、.gif 结尾,否则跳过。标题长度必须 ≤ 20(UTF-16 字节数向上取整除以 2)。规则:汉字/全角符号计 1,英文/数字/半角符号每 2 个计 1(单个也算 1)。
超长时的处理(禁止机械截断):
示例:
Windows 11 迎来 MIDI 2.0!音乐人的重大升级Windows 11 迎来 MIDI 2.0,音乐制作新体验
注意:ASCII 字符(英文/数字/空格)每个只占 0.5 个单位,要达到 20 往往需要比预期更多的字符。生成后务必重新估算,不要凭感觉判断长度。
#标签1 #标签2 #标签3通过 AskUserQuestion 展示即将发布的内容(标题、正文、图片/视频),获得明确确认后继续。
将标题和正文写入 UTF-8 文本文件。不要在命令行参数中内联中文文本。
--images 支持本地路径和 HTTP/HTTPS URL,脚本会自动下载 URL 图片,无需手动 curl/wget/下载。
# URL 图片:直接传 URL,脚本自动下载
--images "https://example.com/pic1.jpg" "https://example.com/pic2.png"
# 本地图片:传绝对路径
--images "/abs/path/pic1.jpg" "/abs/path/pic2.jpg"
# 混合使用也支持
--images "https://example.com/pic1.jpg" "/abs/path/pic2.jpg"禁止手动下载图片:不要用 curl、wget 或其他工具先下载图片再传路径,直接传 URL 即可,否则会因路径猜测错误而失败。
先填写表单,让用户在浏览器中确认预览后再发布:
# 步骤 1: 填写图文表单(不发布)
python scripts/cli.py fill-publish \
--title-file /tmp/xhs_title.txt \
--content-file /tmp/xhs_content.txt \
--images "/abs/path/pic1.jpg" "/abs/path/pic2.jpg" \
[--tags "标签1" "标签2"] \
[--schedule-at "2026-03-10T12:00:00"] \
[--original] [--visibility "公开可见"]
# 步骤 2: 通过 AskUserQuestion 让用户确认浏览器中的预览
# 步骤 3a: 用户确认发布
python scripts/cli.py click-publish
# 步骤 3b: 用户取消 → 必须先保存草稿!
python scripts/cli.py save-draft⚠️ 用户取消时必须调用
save-draft,不得直接关闭 tab 或结束流程。 直接关闭 tab 会导致内容丢失,草稿不会保存到小红书草稿箱。
视频分步发布:
# 步骤 1: 填写视频表单(不发布)
python scripts/cli.py fill-publish-video \
--title-file /tmp/xhs_title.txt \
--content-file /tmp/xhs_content.txt \
--video "/abs/path/video.mp4" \
[--tags "标签1" "标签2"] \
[--visibility "公开可见"]
# 步骤 2: 用户确认
# 步骤 3a: 用户确认发布
python scripts/cli.py click-publish
# 步骤 3b: 用户取消 → 必须先保存草稿!
python scripts/cli.py save-draft⚠️ 用户取消时必须调用
save-draft,不得直接关闭 tab 或结束流程。
# 图文一步到位
python scripts/cli.py publish \
--title-file /tmp/xhs_title.txt \
--content-file /tmp/xhs_content.txt \
--images "/abs/path/pic1.jpg" "/abs/path/pic2.jpg"
# 视频一步到位
python scripts/cli.py publish-video \
--title-file /tmp/xhs_title.txt \
--content-file /tmp/xhs_content.txt \
--video "/abs/path/video.mp4"
# 带标签和定时发布
python scripts/cli.py publish \
--title-file /tmp/xhs_title.txt \
--content-file /tmp/xhs_content.txt \
--images "/abs/path/pic1.jpg" \
--tags "标签1" "标签2" \
--schedule-at "2026-03-10T12:00:00" \
--original当用户说"发长文 / 写长文 / 长文模式"时触发。长文模式使用小红书的长文编辑器,支持排版模板。
收集标题和正文。长文标题使用 textarea 输入,没有 20 字限制(但建议简洁)。
通过 AskUserQuestion 确认长文内容。
python scripts/cli.py long-article \
--title-file /tmp/xhs_title.txt \
--content-file /tmp/xhs_content.txt \
[--images "/abs/path/pic1.jpg" "/abs/path/pic2.jpg"]该命令会:
templates 列表通过 AskUserQuestion 展示可用模板列表,让用户选择:
python scripts/cli.py select-template --name "用户选择的模板名"# 点击下一步,填写发布页描述(正文摘要,不超过 1000 字)
python scripts/cli.py next-step \
--content-file /tmp/xhs_description.txt注意:发布页的描述编辑器是独立的,需要单独填入内容。如果描述超过 1000 字,脚本会自动截断到 800 字。
# 用户在浏览器中确认预览后
python scripts/cli.py click-publishsuccess, title, images/video/templates, status。error 字段。| 参数 | 说明 |
|---|---|
--title-file path | 标题文件路径(必须) |
--content-file path | 正文文件路径(必须) |
--images path1 path2 | 图片路径/URL 列表(图文必须) |
--video path | 视频文件路径(视频必须) |
--tags tag1 tag2 | 话题标签列表 |
--schedule-at ISO8601 | 定时发布时间 |
--original | 声明原创 |
--visibility | 可见范围 |
save-draft 保存草稿,再告知用户已保存到草稿箱,不得直接关闭 tab。b043748
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.