Install
openclaw skills install @yangaiwu/blog-mini-kit-liufei管理博客系统(FastAPI)全部 32 个 API 端点:文章 CRUD/恢复/热门、标签管理、用户管理、 评论/留言/说说管理、文件上传、后台管理、前端页面、健康检查。无认证,curl+JSON 示例。
openclaw skills install @yangaiwu/blog-mini-kit-liufei通用约束(所有 skill 必含):
references/api-reference.md 为准:严禁根据经验/记忆/猜测自行拼写 API 路径。[blog-mini-kit-liufei] 开头> {用户评论}\n\n[blog-mini-kit-liufei] {回复}目标系统 API 地址必须在使用前确定。所有命令中的 {base_url} 替换为实际地址(格式 http://<host>:<port>)。
{base_url} 解析优先级:
.project-info/ 目录下 JSON 配置文件(config.BLOG_MINI_KIT_LIUFEI_BASE_URL)BLOG_MINI_KIT_LIUFEI_BASE_URLexport BLOG_MINI_KIT_LIUFEI_BASE_URL="http://<host>:<port>"
在项目根目录下创建 .project-info/ 目录,放入任意名称的 .json 文件:
{
"config": {
"BLOG_MINI_KIT_LIUFEI_BASE_URL": "http://<host>:<port>"
}
}
⚠️
.project-info/含敏感配置,不提交到 git 仓库(加入 .gitignore)。
Don't use for: 非本博客系统的操作 / 数据库直接操作 / 博客源码修改
{base_url}
All endpoints below are relative to this base. 无认证(公开 API),不需要 header。
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 1 | GET | /api/articles | list-articles | 分页查询文章列表(page/size/lid/keyword) |
| 2 | GET | /api/articles/{id} | get-article | 查询单篇文章详情(含评论) |
| 3 | POST | /api/articles | create-article | 发布新文章(ArticleCreate) |
| 4 | PUT | /api/articles/{id} | update-article | 更新文章(ArticleUpdate) |
| 5 | DELETE | /api/articles/{id} | delete-article | 删除文章(soft=true/false) |
| 6 | POST | /api/articles/{id}/restore | restore-article | 恢复软删除的文章 |
| 7 | GET | /api/articles/heat/top | top-articles | 获取热门文章 Top N(limit) |
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 8 | GET | /api/lables | list-lables | 获取所有标签 |
| 9 | POST | /api/lables | create-lable | 创建标签(LableCreate) |
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 10 | GET | /api/users | list-users | 获取用户列表 |
| 11 | POST | /api/users | create-user | 创建用户(UserCreate) |
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 12 | POST | /api/comments | create-comment | 发表评论(CommentCreate) |
| 13 | GET | /api/comments/{aid} | list-comments | 获取文章评论列表 |
| 14 | DELETE | /api/comments/{id} | delete-comment | 删除评论(软删除) |
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 15 | GET | /api/messages | list-messages | 获取留言列表(含回复) |
| 16 | POST | /api/messages | create-message | 发表留言(MessageCreate) |
| 17 | POST | /api/messages/reply | reply-message | 回复留言(Message2Create) |
| 18 | DELETE | /api/messages/{id} | delete-message | 删除留言(软删除) |
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 19 | GET | /api/moods | list-moods | 获取说说列表 |
| 20 | POST | /api/moods | create-mood | 发布说说(MoodCreate) |
| 21 | DELETE | /api/moods/{id} | delete-mood | 删除说说 |
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 22 | POST | /api/upload | upload-file | 上传单个文件(multipart -F) |
| 23 | POST | /api/upload/multiple | upload-files | 批量上传文件(multipart -F) |
| 24 | GET | /api/uploads/list | list-uploads | 列出所有已上传文件 |
| 25 | DELETE | /api/uploads/{filename} | delete-upload | 删除已上传文件 |
| # | Method | Path | 说明 |
|---|---|---|---|
| 26 | GET | / | 博客首页(page/lid/keyword) |
| 27 | GET | /article/{id} | 文章详情页 |
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 28 | GET | /admin | —(HTML) | 后台管理入口 |
| 29 | POST | /admin/login | admin-login | 后台登录获取 token(form-data) |
| 30 | GET | /admin/logout | —(重定向) | 退出登录 |
| 31 | POST | /admin/api/delete | admin-delete-articles | 批量删除文章(JSON) |
| # | Method | Path | 子命令 | 说明 |
|---|---|---|---|---|
| 32 | GET | /health | health-check | 健康检查 |
端点计数:7+2+2+3+4+3+4+2+4+1 = 32
/api/* 端点无需 header/tokenBLOG_MINI_KIT_LIUFEI_BASE_URLblog-mini-kit-liufei → BLOG_MINI_KIT_LIUFEI)| Schema | 必填字段 | 可选字段(含默认值) |
|---|---|---|
| ArticleCreate | title(str), content(str) | uid=1, lid=1, img=null, heat=0 |
| ArticleUpdate | (至少一个字段) | title, content, lid, img, heat(全可选) |
| LableCreate | lname(str) | — |
| UserCreate | uname(str) | phone="", pwd="", email="", img="img/moren.jpg" |
| CommentCreate | uid(int), aid(int), content(str) | — |
| MessageCreate | uid(int), content(str) | — |
| Message2Create | uid(int), mid(int), content(str) | — |
| MoodCreate | content(str) | title="", src="" |
完整字段说明见
references/api-reference.md
curl {base_url}/health 确认可达,检查 base_url 是否正确。/api/lables,子命令用正确拼写 create-lable 但内部请求用 /api/lables。soft=false(子命令用 --hard 标志)。-F "file=@path",不能用 -d JSON。admin-login 获取 token,再传给 admin-delete-articles --token。/api/articles/heat/top 优先于 /api/articles/{id},无需担心 ID 被解析为 "heat"。filename 为原始文件名,但 delete-upload 需要的是 UUID 生成的文件名(如 abc123def456.jpg)。删除文件前应先用 list-uploads 获取实际文件名。python3 scripts/blog-mini-kit-liufei.py health-check
Expected: {"status":"ok","service":"blog-api","version":"1.0.0"}
python3 scripts/blog-mini-kit-liufei.py list-articles --page 1 --size 10
Expected: {"code":200,"data":[...],"total":N,"page":1,"size":10}
python3 scripts/blog-mini-kit-liufei.py list-lables
Expected: {"code":200,"data":[{"id":1,"lname":"技术"},...]}
python3 scripts/blog-mini-kit-liufei.py list-users
Expected: {"code":200,"data":[{"id":1,"uname":"admin",...}]}
python3 scripts/blog-mini-kit-liufei.py create-article --title "测试文章" --content "内容"
Expected: {"code":200,"message":"文章发布成功","data":{"id":N}}
python3 scripts/blog-mini-kit-liufei.py update-article --article-id 1 --title "新标题" --heat 10
Expected: {"code":200,"message":"文章更新成功"}
python3 scripts/blog-mini-kit-liufei.py delete-article --article-id 1
Expected: {"code":200,"message":"文章已删除"}
python3 scripts/blog-mini-kit-liufei.py delete-article --article-id 1 --hard
Expected: {"code":200,"message":"文章已删除"}
python3 scripts/blog-mini-kit-liufei.py restore-article --article-id 1
Expected: {"code":200,"message":"文章已恢复"}
python3 scripts/blog-mini-kit-liufei.py top-articles --limit 5
Expected: {"code":200,"data":[{"id":N,"title":"...","heat":N},...]}
python3 scripts/blog-mini-kit-liufei.py create-lable --lname "新标签"
Expected: {"code":200,"data":{"id":N,"lname":"新标签"}}
python3 scripts/blog-mini-kit-liufei.py create-comment --uid 1 --aid 1 --content "好文章"
Expected: {"code":200,"data":{"id":N}}
python3 scripts/blog-mini-kit-liufei.py create-message --uid 1 --content "你好"
Expected: {"code":200,"data":{"id":N}}
python3 scripts/blog-mini-kit-liufei.py reply-message --uid 1 --mid 1 --content "谢谢"
Expected: {"code":200,"data":{"id":N}}
python3 scripts/blog-mini-kit-liufei.py create-mood --content "今天很好" --title "心情"
Expected: {"code":200,"data":{"id":N}}
python3 scripts/blog-mini-kit-liufei.py upload-file --filepath /path/to/image.jpg
Expected: {"code":200,"data":{"url":"/uploads/xxx.jpg","filename":"image.jpg","type":"image","size":N}}
python3 scripts/blog-mini-kit-liufei.py upload-files --filepaths /path/a.jpg /path/b.png
Expected: {"code":200,"data":[{...},{...}]}
python3 scripts/blog-mini-kit-liufei.py admin-login --username admin --password admin
Expected: {"code":200,"data":{"token":"xxx"}}
python3 scripts/blog-mini-kit-liufei.py admin-delete-articles --ids 1 2 --token "your_token"
Expected: {"code":200,"deleted":2,"message":"成功删除 2 篇文章"}
python3 scripts/blog-mini-kit-liufei.py capability-list
Expected: {"capability":"capability-list","skill":"blog-mini-kit-liufei","subcommand_count":28,...}
参数说明:
--format:输出格式 json/md,默认 json(所有子命令通用){"status":"ok"})--help 无语法错误capability-list 返回 28 个子命令--format md)cd skills/blog-mini-kit-liufei/ && python3 scripts/blog-mini-kit-liufei.py list-articles --format md执行完操作后,Issue 评论 body 格式:
[blog-mini-kit-liufei] ✅ {操作名称}完成
## 操作结果
| 操作 | 状态 | 资源 ID | 详情 |
|------|------|---------|------|
| {操作名} | ✅ 成功 / 🔴 失败 | {id} | {简要说明} |
**API 地址**:{base_url}
**执行时间**:{UTC ISO}
失败时:
[blog-mini-kit-liufei] 🔴 {操作名称}失败
## 错误分析
- **操作**:{操作名}
- **错误**:{API 返回的错误信息}
- **HTTP 状态码**:{code}
- **原因**:{分析原因}
### 修复建议
{修复步骤}
成功时:
分析结论:
- 场景:博客 API 操作
- Skill:blog-mini-kit-liufei v0.1.0
- 操作:{subcommand} {params}
- 结果:✅ 成功({API 返回的关键数据摘要})
- 必须执行:Issue 评论汇总结果 → 任务结束
失败时:
分析结论:
- 场景:博客 API 操作
- Skill:blog-mini-kit-liufei v0.1.0
- 操作:{subcommand} {params}
- 结果:🔴 失败({错误原因})
- 必须执行:Issue 评论报告错误 → 任务结束
完成所有业务动作后,在最终答复末尾输出以下 JSON 块并结束任务:
{
"actions": ["{具体执行的操作,如 list-articles: 返回 5 篇文章}"],
"conclusion": "{处理结论,如 查询成功,返回 5 篇文章}",
"artifacts": ["{产生的产物:写操作返回资源 ID 或操作结果 / 文件操作返回 URL / 只读查询无产物填空数组}"],
"next_step": "{下一步建议,如 无 / 等待用户下一步指令}",
"issue_summary": "{Issue 最新聚合结论,紧凑文本,用 | 分隔}"
}
注意:只输出一个 JSON 块,放在答复末尾。