Automatically collect content from shared links upon keywords or in group chats, create Feishu docs under a knowledge base, and update the archive table.
This skill enables automatic collection and archiving of content from shared links into a structured knowledge base.
Core Workflow:
Detect Link → Fetch Content → Create Feishu Doc → Update Table
当用户消息包含以下触发词时,立即执行收录:
示例:
在群聊场景中,自动检测以下链接并静默收录:
静默收录条件:
两种模式优先级:
检测到主动触发词 → 立即收录(显式模式)
未检测到触发词但检测到链接 → 静默收录(隐式模式)
| Type | Example | Fetch Method |
|---|---|---|
| WeChat Article | https://mp.weixin.qq.com/s/xxx | kimi_fetch |
| Feishu Doc | https://xxx.feishu.cn/docx/xxx | feishu_fetch_doc |
| Feishu Wiki | https://xxx.feishu.cn/wiki/xxx | feishu_fetch_doc |
| Web Page | General URLs | kimi_fetch / web_fetch |
生效范围:所有用户、所有群聊
本技能已配置为全局可用,支持以下对象:
| 对象类型 | 支持状态 | 说明 |
|---|---|---|
| 所有用户 | ✅ 可用 | 任何用户分享的链接均可被收录 |
| 所有群聊 | ✅ 可用 | 支持技能中心群、养虾群、学习群等所有群组 |
| 私聊消息 | ✅ 可用 | 用户私信分享链接也可触发收录 |
| 多渠道 | ✅ 可用 | 飞书、其他渠道统一支持 |
权限说明:
在正式使用本技能前,系统必须自动或引导用户完成以下权限校验,以确保流程不中断:
| 权限项 | 验证工具 | 目的 |
|---|---|---|
| OAuth 授权 | feishu_oauth | 获取操作飞书文档和表格的用户凭证 |
| 知识库写入权限 | feishu_create_doc | 确保能在指定的 Space ID 下创建节点 |
| 多维表格编辑权限 | feishu_bitable_app_table_record | 确保能向指定的 app_token 写入记录 |
| 图片上传权限 | feishu_im_bot_upload | 允许将本地图片同步至飞书素材库 |
每次“安装”或配置更新后,执行以下检查:
关键词、原链接 等必需字段是否存在。feishu_oauth 弹出授权引导,而非在执行收录时报错。Before using, ensure these are configured in MEMORY.md:
## Content Collector Config
- **Knowledge Base Table**: `[Your Bitable App Token]` (Bitable app_token)
- **Table URL**: [Your Bitable Table URL]
- **Default Table ID**: `[Your Table ID]` (will auto-detect if available)
- **Knowledge Base Space ID**: `[Your Space ID]` (所有文档创建在此知识库下)
- **Knowledge Base URL**: [Your Knowledge Base Homepage URL]
- **Content Categories**: 技术教程, 实战案例, 产品文档, 学习笔记
- **Global Access**: 所有用户可用,所有群聊可用
Note:
所有收录的文档必须按照以下规则分类存储到知识库对应目录:
请参考各项目或团队定义的知识库标准目录结构进行存储。收录的文档通常存放在“素材”或“归档”类目录下。
| 内容分类 | 存储目录 (wiki_node) | 命名前缀 | 示例 |
|---|---|---|---|
| 技术教程 | F9pFw9dxTiXmpsk5bNlco704nag (内容文档) | 📖 | 📖 [标题] |
| 实战案例 | F9pFw9dxTiXmpsk5bNlco704nag (内容文档) | 🛠️ | 🛠️ [标题] |
| 产品文档 | F9pFw9dxTiXmpsk5bNlco704nag (内容文档) | 📄 | 📄 [标题] |
| 学习笔记 | F9pFw9dxTiXmpsk5bNlco704nag (内容文档) | 💡 | 💡 [标题] |
| 热点资讯 | F9pFw9dxTiXmpsk5bNlco704nag (内容文档) | 🔥 | 🔥 [标题] |
| 设计技能 | F9pFw9dxTiXmpsk5bNlco704nag (内容文档) | 🎨 | 🎨 [标题] |
| 工具推荐 | F9pFw9dxTiXmpsk5bNlco704nag (内容文档) | 🔧 | 🔧 [标题] |
| 训练营 | F9pFw9dxTiXmpsk5bNlco704nag (内容文档) | 🎓 | 🎓 [标题] |
[Emoji前缀] [原标题] | 收录日期
示例:
📖 OpenClaw保姆级教程 | 2026-03-08
🛠️ 火山方舟自动化报表案例 | 2026-03-08
🔥 GPT-5.4发布解读 | 2026-03-08
# [Emoji] [原标题]
> 📌 **元信息**
> - 来源:[原始来源]
> - 原文链接:[原始URL]
> - 收录时间:YYYY-MM-DD
> - 内容分类:[技术教程/实战案例/产品文档/学习笔记/热点资讯/设计技能/工具推荐/训练营]
> - 关键词:[关键词1, 关键词2, 关键词3]
---
## 📋 核心要点
[3-5条核心内容摘要]
---
## 📝 正文内容
[完整的转存内容]
---
## 🔗 相关链接
- 原文链接:[原始URL]
- 知识库索引:[素材池文档索引链接]
---
📚 **收录时间**:YYYY-MM-DD
🏷️ **分类**:[分类名]
🔖 **关键词**:[关键词]
每次收录完成后,必须:
Extract URL from user message using regex or direct extraction.
Choose appropriate fetch method based on URL pattern:
For WeChat articles:
kimi_fetch(url="https://mp.weixin.qq.com/s/xxx")
For Feishu docs:
feishu_fetch_doc(doc_id="https://xxx.feishu.cn/docx/xxx")
For general web pages:
kimi_fetch(url="https://example.com/article")
# or
web_fetch(url="https://example.com/article")
智能分类判断: 根据内容特征自动判断分类:
| 判断依据 | 分类 |
|---|---|
| 包含"安装/配置/部署/教程"等词 | 📖 技术教程 |
| 包含"案例/实战/项目/演示"等词 | 🛠️ 实战案例 |
| 包含"安全/公告/版本/功能"等词 | 📄 产品文档 |
| 包含"学习/成长/指南/笔记"等词 | 💡 学习笔记 |
| 包含"发布/新功能/热点"等词 | 🔥 热点资讯 |
| 包含"设计/Prompt/美学"等词 | 🎨 设计技能 |
| 包含"工具/CLI/插件"等词 | 🔧 工具推荐 |
| 包含"训练营/课程/教学"等词 | 🎓 训练营 |
When content contains images, download and upload them to Feishu:
Image Processing Workflow:
# 1. Extract image URLs from markdown
import re
image_urls = re.findall(r'!\[.*?\]\((https?://[^\)]+)\)', markdown_content)
# 2. Download and upload each image
for img_url in image_urls:
try:
# Download image
local_path = f"/tmp/img_{hash(img_url)}.jpg"
download_image(img_url, local_path)
# Upload to Feishu
upload_result = feishu_im_bot_upload(
action="upload_image",
file_path=local_path
)
# Replace URL in markdown
new_url = upload_result.get("image_key") or img_url
markdown_content = markdown_content.replace(img_url, new_url)
except Exception as e:
# Keep original URL if upload fails
print(f"Failed to process image {img_url}: {e}")
continue
Fallback Strategy:
Convert processed markdown to Feishu document with proper organization:
# 1. 确定分类和参数
content_category = classify_content(markdown_content) # 📖/🛠️/📄/💡/🔥/🎨/🔧/🎓
emoji_prefix = get_emoji_prefix(content_category) # 根据分类获取emoji
wiki_node = get_wiki_node_by_category(content_category) # 获取存储目录
# 2. 生成文档标题
doc_title = f"{emoji_prefix} {original_title} | {today_date}"
# 3. 生成文档内容(使用标准模板)
doc_content = f"""# {emoji_prefix} {original_title}
> 📌 **元信息**
> - 来源:{source_name}
> - 原文链接:{original_url}
> - 收录时间:{today_date}
> - 内容分类:{content_category}
> - 关键词:{keywords}
---
## 📋 核心要点
{extract_key_points(markdown_content, 5)}
---
## 📝 正文内容
{processed_markdown_content}
---
## 🔗 相关链接
- 原文链接:{original_url}
- 知识库索引:[Your Index Document URL]
---
📅 **收录时间**:{today_date}
🏷️ **分类**:{content_category}
🔖 **关键词**:{keywords}
"""
# 4. 创建文档到知识库对应目录
feishu_create_doc(
title=doc_title,
markdown=doc_content,
wiki_node=wiki_node # 必须指定存储目录
)
存储目录映射:
| 分类 | wiki_node | 目录名 |
|---|---|---|
| 所有素材 | F9pFw9dxTiXmpsk5bNlco704nag | 04-内容素材 |
IMPORTANT:
[Emoji] [Title] | [Date]Add record to the Bitable knowledge base (ONLY update this specific table):
feishu_bitable_app_table_record(
action="create",
app_token="[Your App Token]", # Configured in MEMORY.md
table_id="[Your Table ID]", # Will use correct table ID from the base
fields={
"关键词": keywords,
"内容分类": content_category,
"文档标题": [{"text": original_title, "type": "text"}],
"来源": [{"text": source_name, "type": "text"}],
"核心要点": [{"text": key_points, "type": "text"}],
"飞书文档链接": {"link": new_doc_url, "text": "飞书文档", "type": "url"},
"原链接": {"link": original_url, "text": "原文链接", "type": "url"} # 新增:存储原始链接
}
)
Table Fields:
| Field | Type | Description |
|---|---|---|
| 关键词 | Text | Search keywords for the content |
| 内容分类 | Single Select | Category: 📖技术教程/🛠️实战案例/📄产品文档/💡学习笔记/🔥热点资讯/🎨设计技能/🔧工具推荐/🎓训练营 |
| 文档标题 | Text | Title of the archived document |
| 来源 | Text | Original source name |
| 核心要点 | Text | Key points summary (3-5 items) |
| 飞书文档链接 | URL | Link to the created Feishu document |
| 原链接 | URL | Original source URL - 新增字段,存储采集的原始链接 |
IMPORTANT: Only update the configured knowledge base table. Never create or modify other tables.
After creating the document and updating the table, MUST update the index document:
# 1. 获取当前索引文档内容
index_doc = feishu_fetch_doc(doc_id="[Your Index Doc ID]")
# 2. 在对应分类表格中添加新行
new_index_entry = f"| {original_title} | {source_name} | [查看]({new_doc_url}) |\n"
# 3. 更新分类统计
update_category_stats(content_category)
# 4. 更新总计数
update_total_count()
或者直接追加到索引文档的末尾:
feishu_update_doc(
doc_id="[Your Index Doc ID]",
mode="append",
markdown=f"""
| {original_title} | {source_name} | [查看]({new_doc_url}) |
"""
)
| Category | Emoji | Description | Examples |
|---|---|---|---|
| 技术教程 | 📖 | Step-by-step technical guides | Installation, configuration, API usage |
| 实战案例 | 🛠️ | Real-world implementation examples | Case studies, project demos |
| 产品文档 | 📄 | Product features, security notices | Release notes, security advisories |
| 学习笔记 | 💡 | Conceptual knowledge, methodologies | Best practices, architecture guides |
| 热点资讯 | 🔥 | Breaking news, releases | GPT-5.4, new features |
| 设计技能 | 🎨 | Design, prompts, aesthetics | AJ's prompts, design guides |
| 工具推荐 | 🔧 | Tools, CLI, plugins | gws, trae, autotools |
| 训练营 | 🎓 | Courses, bootcamps, tutorials | OpenClaw bootcamp |
分类判断优先级:
When user replies "删除" or "删除 [keyword]":
# 1. Search records by keyword
feishu_bitable_app_table_record(
action="list",
app_token="[Your App Token]",
table_id="[Your Table ID]",
filter={
"conjunction": "and",
"conditions": [
{"field_name": "关键词", "operator": "contains", "value": [keyword]}
]
}
)
# 2. Confirm deletion
# If multiple found → list for user to select
# If single found → ask for confirmation
# 3. Execute deletion
feishu_bitable_app_table_record(
action="delete",
app_token="[Your App Token]",
table_id="[Your Table ID]",
record_id="record_id_to_delete"
)
| Error | Cause | Solution |
|---|---|---|
| Fetch timeout | Network issue or heavy content | Retry with longer timeout, or use alternative fetch method |
| Unauthenticated | OAuth token expired or not authed | Trigger feishu_oauth to refresh user credentials |
| Permission denied | No write access to Space/Table | Check if user/bot has 'Editor' role in Feishu |
| Content too long | Exceeds API limits | Truncate or split into multiple documents |
| Table update failed | Wrong app_token or table_id | Verify configuration in MEMORY.md |
| Field Missing | "原链接" field not in table | Add the field to Bitable manually or via API |
{
"msg_type": "post",
"content": {
"post": {
"zh_cn": {
"title": "✅ 收录完成",
"content": [
[
{"tag": "text", "text": "📄 "},
{"tag": "text", "text": "{emoji} {原标题} | {日期}", "style": {"bold": true}}
],
[{"tag": "text", "text": ""}],
[
{"tag": "text", "text": "💡 文档亮点:", "style": {"bold": true}}
],
[
{"tag": "text", "text": "• {亮点1}"}
],
[
{"tag": "text", "text": "• {亮点2}"}
],
[
{"tag": "text", "text": "• {亮点3}"}
],
[{"tag": "text", "text": ""}],
[
{"tag": "text", "text": "🔗 "},
{"tag": "a", "text": "查看飞书文档", "href": "{文档URL}"}
]
]
}
}
}
}
简洁输出示例:
✅ 收录完成
📄 📖 OpenClaw配置指南 | 2026-03-08
💡 文档亮点:
• 完整配置示例,含9大模块详解
• 多Agent扩展配置方案
• 生产环境安全配置建议
🔗 查看飞书文档 → [点击打开](https://xxx.feishu.cn/docx/xxx)
{
"msg_type": "post",
"content": {
"post": {
"zh_cn": {
"title": "✅ 已自动收录",
"content": [
[
{"tag": "text", "text": "📄 "},
{"tag": "text", "text": "{emoji} {原标题}", "style": {"bold": true}}
],
[{"tag": "text", "text": ""}],
[
{"tag": "text", "text": "💡 亮点:{亮点摘要}"}
],
[{"tag": "text", "text": ""}],
[
{"tag": "a", "text": "📎 查看文档", "href": "{文档URL}"}
]
]
}
}
}
}
{
"msg_type": "post",
"content": {
"post": {
"zh_cn": {
"title": "✅ 批量收录完成({N}份)",
"content": [
[
{"tag": "text", "text": "📄 {emoji1} {标题1}", "style": {"bold": true}}
],
[
{"tag": "text", "text": " 💡 {亮点1}"}
],
[
{"tag": "a", "text": " 🔗 查看", "href": "{链接1}"}
],
[{"tag": "text", "text": ""}],
[
{"tag": "text", "text": "📄 {emoji2} {标题2}", "style": {"bold": true}}
],
[
{"tag": "text", "text": " 💡 {亮点2}"}
],
[
{"tag": "a", "text": " 🔗 查看", "href": "{链接2}"}
]
]
}
}
}
}
输出原则:
每次收录必须完成以下所有步骤:
任何一步未完成,视为收录失败!
After each collection, update MEMORY.md:
### YYYY-MM-DD - Content Collection
- **新增收录**: [Title]
- **来源**: [Source]
- **分类**: [Category]
- **知识库状态**: 共[N]条记录
- **索引更新**: ✅ 已更新
This skill is part of the core knowledge management system. Execute with care and attention to detail.
原始网页中的图片无法直接显示在飞书文档中(外链限制)
实现步骤:
import re
import requests
import os
def process_images_in_content(markdown_content):
"""
处理 Markdown 内容中的图片:
1. 提取图片URL
2. 下载到本地
3. 上传到飞书
4. 替换为飞书图片链接
"""
# 正则匹配 Markdown 图片: 
img_pattern = r'!\[(.*?)\]\((https?://[^\)]+)\)'
def replace_image(match):
alt_text = match.group(1)
img_url = match.group(2)
try:
# 1. 下载图片
local_path = f"/tmp/img_{abs(hash(img_url)) % 100000}.jpg"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
response = requests.get(img_url, headers=headers, timeout=30)
response.raise_for_status()
with open(local_path, 'wb') as f:
f.write(response.content)
# 2. 上传到飞书
upload_result = feishu_im_bot_upload(
action="upload_image",
file_path=local_path
)
image_key = upload_result.get("image_key")
# 3. 清理临时文件
os.remove(local_path)
# 4. 返回飞书图片格式
if image_key:
return f""
else:
# 上传失败,保留原链接并添加警告
return f"\n\n> ⚠️ 图片上传失败,已保留原链接: {img_url}"
except Exception as e:
# 处理失败,保留原链接
return f"\n\n> ⚠️ 图片处理失败: {str(e)[:50]}"
# 执行替换
processed_content = re.sub(img_pattern, replace_image, markdown_content)
return processed_content
使用方式: 在创建文档之前调用:
# 获取原始内容
raw_content = kimi_fetch(url=link)
# 处理图片
processed_content = process_images_in_content(raw_content)
# 创建文档(使用处理后的内容)
feishu_create_doc(
title=title,
markdown=processed_content
)
def add_image_fallback_notice(markdown_content, original_url):
"""
在文档末尾添加图片查看说明
"""
notice = f"""
---
## 📎 原始图片资源
本文档中的图片已保留原始链接。
如图片无法显示,请查看原文:
[{original_url}]({original_url})
"""
return markdown_content + notice
创建一个独立的「图片资源库」多维表格:
# 收录时同时记录图片信息
feishu_bitable_app_table_record(
action="create",
app_token="图片资源库_token",
fields={
"文档标题": doc_title,
"图片URL": img_url,
"图片描述": alt_text,
"原文链接": original_url,
"收录状态": "待上传/已上传/失败"
}
)
图片处理方案 v1.0 - 2026-03-05
ZIP package — ready to use