refactor: 通用技能按类别拆分为独立目录
skills/ → skills-dev(9), skills-req(10), skills-ops(4), skills-integration(8), skills-biz(4), skills-workflow(7) generate-marketplace.py 改为自动扫描所有 skills-* 目录。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
139
skills-integration/feishu-plugin/skills/SKILL.md
Normal file
139
skills-integration/feishu-plugin/skills/SKILL.md
Normal file
@@ -0,0 +1,139 @@
|
||||
---
|
||||
name: feishu
|
||||
description: 飞书文档与多维表格操作入口。当用户提到飞书、云文档、多维表格、Bitable 相关任务时自动激活。
|
||||
---
|
||||
|
||||
# 飞书集成
|
||||
|
||||
## 功能模块
|
||||
|
||||
| 模块 | 技能 | 说明 |
|
||||
|------|------|------|
|
||||
| 云文档 | `feishu-docx` | 创建、编辑云文档,会议纪要 |
|
||||
| 多维表格 | `feishu-bitable` | 记录增删改查,数据同步 |
|
||||
| 任务 | 本技能 | 创建待办任务 |
|
||||
|
||||
## 环境配置
|
||||
|
||||
```bash
|
||||
# ~/.zshrc(凭证唯一配置位置)
|
||||
export FEISHU_APP_ID="cli_a9f29dca82b9dbef"
|
||||
export FEISHU_APP_SECRET="<从飞书开放平台获取>"
|
||||
```
|
||||
|
||||
**权限要求**:
|
||||
- 云文档:`docx:document`, `drive:drive`
|
||||
- 多维表格:`bitable:app`
|
||||
- 任务:`task:task:write`
|
||||
|
||||
## Access Token
|
||||
|
||||
```python
|
||||
import os, requests
|
||||
|
||||
def get_tenant_access_token():
|
||||
"""获取飞书 tenant_access_token"""
|
||||
url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"
|
||||
response = requests.post(url, json={
|
||||
"app_id": os.environ["FEISHU_APP_ID"],
|
||||
"app_secret": os.environ["FEISHU_APP_SECRET"]
|
||||
})
|
||||
data = response.json()
|
||||
if data.get("code") == 0:
|
||||
return data["tenant_access_token"]
|
||||
raise Exception(f"获取 token 失败: {data}")
|
||||
```
|
||||
|
||||
## 默认存储位置
|
||||
|
||||
| 文件夹 | folder_token |
|
||||
|--------|-------------|
|
||||
| ai-proj 根目录 | `RTLKf247ClQQDyd5IjxcTOVQnxd` |
|
||||
| 01运营 (默认) | `C80gfkRnzlonQ5d4AhOcOACDnNg` |
|
||||
|
||||
## URL 结构
|
||||
|
||||
```
|
||||
云文档: https://xxx.feishu.cn/docx/DoxcXXXXXX
|
||||
└── document_id
|
||||
|
||||
多维表格: https://xxx.feishu.cn/base/BascXXX?table=tblXXX&view=vewXXX
|
||||
└── app_token └── table_id
|
||||
```
|
||||
|
||||
## 飞书任务
|
||||
|
||||
```python
|
||||
def create_task(summary: str, due_time: int = None):
|
||||
"""创建飞书任务"""
|
||||
url = "https://open.feishu.cn/open-apis/task/v2/tasks"
|
||||
token = get_tenant_access_token()
|
||||
payload = {"summary": summary}
|
||||
if due_time:
|
||||
payload["due"] = {"timestamp": str(due_time), "is_all_day": False}
|
||||
response = requests.post(url,
|
||||
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
|
||||
json=payload)
|
||||
data = response.json()
|
||||
if data.get("code") == 0:
|
||||
return data["data"]["task"]
|
||||
raise Exception(f"创建任务失败: {data}")
|
||||
```
|
||||
|
||||
## 工具类
|
||||
|
||||
完整工具类见:
|
||||
- `~/.claude/skills/feishu/feishu_bitable.py` - 多维表格
|
||||
- `~/.claude/skills/feishu/feishu_docx.py` - 云文档
|
||||
|
||||
## Incoming Webhook(群机器人通知卡片)
|
||||
|
||||
**Webhook 地址**:存储在 `~/.config/devops/credentials.env` → `FEISHU_DEPLOY_WEBHOOK`
|
||||
|
||||
**⚠️ 关键注意事项**:
|
||||
- ❌ **禁用 schema 2.0**:`"schema": "2.0"` 会返回 ErrCode 11246,必须用 legacy 格式
|
||||
- ✅ **legacy 卡片格式**(无 schema 字段)才能正常发送
|
||||
- ❌ **按钮 URL 禁止指向列表页**:必须带具体资源 ID(如 `/requirements/864`,不能是 `/requirements`)
|
||||
- ✅ **保存到文件再 curl**:包含中文的 JSON 直接用 `'...'` 传参会报 "blank argument" 错误
|
||||
|
||||
**正确的卡片发送示例**:
|
||||
```bash
|
||||
cat > /tmp/feishu_card.json << 'EOF'
|
||||
{
|
||||
"msg_type": "interactive",
|
||||
"card": {
|
||||
"header": {
|
||||
"title": {"tag": "plain_text", "content": "通知标题"},
|
||||
"template": "blue"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"tag": "div",
|
||||
"text": {"tag": "lark_md", "content": "**内容**:描述文字"}
|
||||
},
|
||||
{
|
||||
"tag": "action",
|
||||
"actions": [{
|
||||
"tag": "button",
|
||||
"text": {"tag": "plain_text", "content": "查看详情"},
|
||||
"type": "primary",
|
||||
"url": "https://ai.pipexerp.com/requirements/864"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
curl -s -X POST \
|
||||
"https://open.feishu.cn/open-apis/bot/v2/hook/xxx" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @/tmp/feishu_card.json
|
||||
```
|
||||
|
||||
**header template 颜色**:`blue`(待审批)/ `green`(通过)/ `red`(驳回)/ `wathet`(信息)
|
||||
|
||||
## 相关技能
|
||||
|
||||
- `feishu-docx` - 云文档详细操作
|
||||
- `feishu-bitable` - 多维表格详细操作
|
||||
Reference in New Issue
Block a user