小龙虾 (OpenClaw) 自动管理果子集文章 Skills 指南
本指南旨在帮助您将果子集网站的 OpenAPI 接口 封装成 OpenClaw 可以直接调用的 Skills (技能),从而实现 AI 自动化抓取、润色、发布和更新文章。
1. 核心工作流设计
为了让 OpenClaw 完全自主地管理您的网站内容,推荐的工作流如下:
- 查询可用栏目 (Space):AI 首先调用
查询空间列表 API,获取网站上所有可用的专栏及其space_id,以便决定将文章发布到哪里。 - AI 内容生成/润色:AI 抓取飞书内容或其他源材料,并进行加工、排版和润色。
- 执行发布 (Publish):AI 调用
发布文章 API,将加工好的内容连同选定的space_id推送到网站,完成新文章的发布。 - 执行修改 (Update):如果 AI 是在润色已有的网站文章,则调用
修改文章 API,根据node_token直接覆盖更新网站上的旧内容。
2. Skills 定义 (JSON Schema 格式)
注意:
- 请将下方的
https://你的域名替换为果子集网站的真实线上域名。 - OpenClaw 发起请求时,请务必在 Header 中配置鉴权:
Authorization: Bearer <你的OpenAPI_Key>。
在 OpenClaw 的 Skills 配置界面,您可以直接将以下 JSON Schema 导入,以定义 AI 可用的三个核心能力:
{
"openapi": "3.0.0",
"info": {
"title": "果子集网站管理 Skills",
"description": "允许 AI 自动查询、发布和更新果子集网站上的文章",
"version": "1.0.0"
},
"servers": [
{
"url": "https://你的域名/api/openapi"
}
],
"paths": {
"/spaces": {
"get": {
"operationId": "getKnowledgeSpaces",
"summary": "获取所有可用的知识空间(栏目)列表",
"description": "发布文章前,必须调用此接口获取目标栏目的 space_id。",
"responses": {
"200": {
"description": "成功返回空间列表",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": { "type": "boolean" },
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"space_id": { "type": "string" },
"name": { "type": "string" },
"description": { "type": "string" }
}
}
}
}
}
}
}
}
}
}
},
"/article/publish": {
"post": {
"operationId": "publishNewArticle",
"summary": "发布新文章到指定栏目",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"title": { "type": "string", "description": "文章标题" },
"content": { "type": "string", "description": "文章正文(支持HTML)" },
"space_id": { "type": "string", "description": "目标知识空间ID" },
"is_published": { "type": "boolean", "default": true },
"is_free": { "type": "boolean", "default": true }
},
"required": ["title", "content", "space_id"]
}
}
}
},
"responses": {
"201": { "description": "发布成功" }
}
}
},
"/article/update": {
"post": {
"operationId": "updateExistingArticle",
"summary": "修改/更新网站上已有的文章",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"node_token": { "type": "string", "description": "要修改的文章节点ID" },
"title": { "type": "string", "description": "新标题(选填)" },
"content": { "type": "string", "description": "新正文(选填)" }
},
"required": ["node_token"]
}
}
}
},
"responses": {
"200": { "description": "更新成功" }
}
}
}
}
}3. 给 OpenClaw (AI) 的系统提示词参考 (System Prompt)
您可以将以下内容作为 OpenClaw 的 System Prompt,让它明确知道如何配合上述 Skills 进行工作:
你是一个专业的网站内容管理助手,负责管理“果子集”网站的文章发布和润色工作。 你拥有三个核心能力 (Skills): 1. getKnowledgeSpaces:查询网站上有哪些专栏(知识空间)。 2. publishNewArticle:发布一篇全新的文章。 3. updateExistingArticle:更新或覆盖一篇已有的文章。 你的工作流程如下: - 当用户要求你“发布一篇新文章”时,如果用户没有指定栏目,你必须先调用 `getKnowledgeSpaces` 获取可用栏目列表,并询问用户要发到哪个栏目(或自行根据内容判断)。拿到 `space_id` 后,再调用 `publishNewArticle` 执行发布。 - 在编写或润色文章内容时,请务必使用清晰、美观的 HTML 标签(如 <h1>, <h2>, <p>, <strong>, <ul> 等)进行排版,因为目标网站支持渲染富文本。 - 当你完成操作后,请向用户汇报发布结果,并提供文章的前台访问链接或成功状态。
4. 测试与排错
- 确保您的
OPENAPI_KEY已经在网站后台配置,且 OpenClaw 的 Header 设置正确 (Authorization: Bearer <Key>)。 - 如果返回
404 Space not found,请让 AI 重新调用getKnowledgeSpaces刷新获取最新的space_id。