mirror of
https://github.com/titanwings/colleague-skill.git
synced 2026-04-04 22:59:06 +08:00
refactor: restructure to official AgentSkills/Claude Code skill format
- Flatten colleague-creator/ to repo root (repo = skill directory) - Update SKILL.md frontmatter with official fields: name, description, argument-hint, version, user-invocable, allowed-tools - Move PRD.md → docs/PRD.md - Add .gitignore, requirements.txt, LICENSE - Update README and INSTALL docs to reflect new structure and git clone install Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
27
.gitignore
vendored
Normal file
27
.gitignore
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated colleague skills (user data, not committed)
|
||||
colleagues/
|
||||
!colleagues/example_zhangsan/
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.pyo
|
||||
.venv/
|
||||
venv/
|
||||
*.egg-info/
|
||||
|
||||
# Config with credentials
|
||||
~/.colleague-skill/
|
||||
|
||||
# Playwright browser data
|
||||
playwright-data/
|
||||
|
||||
# Temp files
|
||||
/tmp/feishu_*.txt
|
||||
/tmp/email_*.txt
|
||||
/tmp/dingtalk_*.txt
|
||||
knowledge/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
43
INSTALL.md
43
INSTALL.md
@@ -6,16 +6,15 @@
|
||||
|
||||
### A. Claude Code(推荐)
|
||||
|
||||
把 `colleague-creator` 目录复制到你的项目或全局 Claude 目录:
|
||||
本项目遵循官方 [AgentSkills](https://agentskills.io) 标准,整个 repo 就是 skill 目录。克隆到 Claude skills 目录即可:
|
||||
|
||||
```bash
|
||||
# 方式 1:放到当前项目的 .claude/skills/ 目录下
|
||||
mkdir -p .claude/skills
|
||||
cp -r colleague-creator .claude/skills/
|
||||
git clone https://github.com/titanwings/colleague-skill .claude/skills/colleague-creator
|
||||
|
||||
# 方式 2:放到全局目录,所有项目都能用
|
||||
mkdir -p ~/.claude/skills
|
||||
cp -r colleague-creator ~/.claude/skills/
|
||||
git clone https://github.com/titanwings/colleague-skill ~/.claude/skills/colleague-creator
|
||||
```
|
||||
|
||||
然后在 Claude Code 中说 `/create-colleague` 即可启动。
|
||||
@@ -27,9 +26,8 @@ cp -r colleague-creator ~/.claude/skills/
|
||||
### B. OpenClaw
|
||||
|
||||
```bash
|
||||
# 复制到 OpenClaw 的 skills 目录
|
||||
cp -r colleague-creator ~/.openclaw/workspace/skills/
|
||||
cp -r colleagues ~/.openclaw/workspace/skills/
|
||||
# 克隆到 OpenClaw 的 skills 目录
|
||||
git clone https://github.com/titanwings/colleague-skill ~/.openclaw/workspace/skills/colleague-creator
|
||||
```
|
||||
|
||||
重启 OpenClaw session,说 `/create-colleague` 启动。
|
||||
@@ -66,25 +64,25 @@ pip3 install openpyxl # Excel .xlsx 转 CSV
|
||||
|
||||
**飞书自动采集初始化**:
|
||||
```bash
|
||||
python3 colleague-creator/tools/feishu_auto_collector.py --setup
|
||||
python3 tools/feishu_auto_collector.py --setup
|
||||
# 输入飞书开放平台的 App ID 和 App Secret
|
||||
```
|
||||
|
||||
**钉钉自动采集初始化**:
|
||||
```bash
|
||||
python3 colleague-creator/tools/dingtalk_auto_collector.py --setup
|
||||
python3 tools/dingtalk_auto_collector.py --setup
|
||||
# 输入钉钉开放平台的 AppKey 和 AppSecret
|
||||
# 首次运行加 --show-browser 参数以完成钉钉登录
|
||||
```
|
||||
|
||||
**飞书 MCP 初始化**(手动指定链接时使用):
|
||||
```bash
|
||||
python3 colleague-creator/tools/feishu_mcp_client.py --setup
|
||||
python3 tools/feishu_mcp_client.py --setup
|
||||
```
|
||||
|
||||
**飞书浏览器方案**(首次使用会弹窗登录,之后自动复用登录态):
|
||||
```bash
|
||||
python3 colleague-creator/tools/feishu_browser.py \
|
||||
python3 tools/feishu_browser.py \
|
||||
--url "https://xxx.feishu.cn/wiki/xxx" \
|
||||
--show-browser # 首次使用加这个参数,登录后不再需要
|
||||
```
|
||||
@@ -94,29 +92,32 @@ python3 colleague-creator/tools/feishu_browser.py \
|
||||
## 快速验证
|
||||
|
||||
```bash
|
||||
cd ~/.claude/skills/colleague-creator # 或你的项目 .claude/skills/colleague-creator
|
||||
|
||||
# 测试飞书解析器
|
||||
python3 colleague-creator/tools/feishu_parser.py --help
|
||||
python3 tools/feishu_parser.py --help
|
||||
|
||||
# 测试邮件解析器
|
||||
python3 colleague-creator/tools/email_parser.py --help
|
||||
python3 tools/email_parser.py --help
|
||||
|
||||
# 列出已有同事 Skill
|
||||
python3 colleague-creator/tools/skill_writer.py --action list --base-dir ./colleagues
|
||||
python3 tools/skill_writer.py --action list --base-dir ./colleagues
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 目录结构说明
|
||||
|
||||
本项目整个 repo 就是一个 skill 目录(AgentSkills 标准格式):
|
||||
|
||||
```
|
||||
colleague-skill/
|
||||
├── colleague-creator/ # 创建器(复制到 skills 目录)
|
||||
│ ├── SKILL.md # OpenClaw 入口
|
||||
│ ├── SKILL_claude_code.md # Claude Code 入口
|
||||
│ ├── prompts/ # 分析和生成的 Prompt 模板
|
||||
│ └── tools/ # Python 工具脚本
|
||||
colleague-skill/ ← clone 到 .claude/skills/colleague-creator/
|
||||
├── SKILL.md # skill 入口(官方 frontmatter)
|
||||
├── prompts/ # 分析和生成的 Prompt 模板
|
||||
├── tools/ # Python 工具脚本
|
||||
├── docs/ # 文档(PRD 等)
|
||||
│
|
||||
└── colleagues/ # 生成的同事 Skill 存放处
|
||||
└── colleagues/ # 生成的同事 Skill 存放处(.gitignore 排除)
|
||||
└── {slug}/
|
||||
├── SKILL.md # 完整 Skill(Persona + Work)
|
||||
├── work.md # 仅工作能力
|
||||
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 titanwings
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
69
README.md
69
README.md
@@ -115,31 +115,28 @@ PART B — Persona(他是什么人)
|
||||
|
||||
### 安装
|
||||
|
||||
**Claude Code:**
|
||||
**Claude Code(官方 skill 格式):**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/your-username/colleague-skill
|
||||
cd colleague-skill
|
||||
|
||||
# 放到当前项目
|
||||
mkdir -p .claude/skills
|
||||
cp -r colleague-creator .claude/skills/
|
||||
git clone https://github.com/titanwings/colleague-skill .claude/skills/colleague-creator
|
||||
|
||||
# 或放到全局
|
||||
cp -r colleague-creator ~/.claude/skills/
|
||||
# 或放到全局(所有项目可用)
|
||||
git clone https://github.com/titanwings/colleague-skill ~/.claude/skills/colleague-creator
|
||||
```
|
||||
|
||||
**OpenClaw:**
|
||||
|
||||
```bash
|
||||
cp -r colleague-creator ~/.openclaw/workspace/skills/
|
||||
cp -r colleagues ~/.openclaw/workspace/skills/
|
||||
git clone https://github.com/titanwings/colleague-skill
|
||||
cp -r colleague-skill ~/.openclaw/workspace/skills/colleague-creator
|
||||
```
|
||||
|
||||
**依赖(可选):**
|
||||
|
||||
```bash
|
||||
pip3 install pypinyin # 中文姓名转拼音 slug
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
|
||||
### 创建第一个同事 Skill
|
||||
@@ -173,32 +170,36 @@ pip3 install pypinyin # 中文姓名转拼音 slug
|
||||
|
||||
## 项目结构
|
||||
|
||||
本项目遵循 [AgentSkills](https://agentskills.io) 开放标准,整个 repo 就是一个 Claude Code skill 目录:
|
||||
|
||||
```
|
||||
colleague-skill/
|
||||
colleague-skill/ ← 整个 repo 是一个 skill 目录
|
||||
│
|
||||
├── colleague-creator/ # Meta-skill:同事创建器
|
||||
│ ├── SKILL.md # OpenClaw 入口
|
||||
│ ├── SKILL_claude_code.md # Claude Code 入口
|
||||
│ ├── prompts/
|
||||
│ │ ├── intake.md # 对话式信息录入
|
||||
│ │ ├── work_analyzer.md # 工作能力提取(按职位分路)
|
||||
│ │ ├── persona_analyzer.md # 性格行为提取(含标签翻译表)
|
||||
│ │ ├── work_builder.md # work.md 生成模板
|
||||
│ │ ├── persona_builder.md # persona.md 五层结构模板
|
||||
│ │ ├── merger.md # 增量 merge 逻辑
|
||||
│ │ └── correction_handler.md # 对话纠正处理
|
||||
│ └── tools/
|
||||
│ ├── feishu_parser.py # 飞书消息解析
|
||||
│ ├── email_parser.py # 邮件解析(eml/mbox/txt)
|
||||
│ ├── skill_writer.py # Skill 文件写入与管理
|
||||
│ └── version_manager.py # 版本存档与回滚
|
||||
│
|
||||
└── colleagues/ # 生成的同事 Skill(示例)
|
||||
└── example_zhangsan/
|
||||
├── SKILL.md
|
||||
├── work.md
|
||||
├── persona.md
|
||||
└── meta.json
|
||||
├── SKILL.md ← skill 入口(含官方 frontmatter)
|
||||
├── prompts/ ← 分析和生成的 Prompt 模板
|
||||
│ ├── intake.md # 对话式信息录入
|
||||
│ ├── work_analyzer.md # 工作能力提取(按职位分路)
|
||||
│ ├── persona_analyzer.md # 性格行为提取(含标签翻译表)
|
||||
│ ├── work_builder.md # work.md 生成模板
|
||||
│ ├── persona_builder.md # persona.md 五层结构模板
|
||||
│ ├── merger.md # 增量 merge 逻辑
|
||||
│ └── correction_handler.md # 对话纠正处理
|
||||
├── tools/ ← Python 工具脚本
|
||||
│ ├── feishu_auto_collector.py # 飞书全自动采集
|
||||
│ ├── feishu_browser.py # 飞书浏览器方案(内部文档)
|
||||
│ ├── feishu_mcp_client.py # 飞书 MCP 方案
|
||||
│ ├── feishu_parser.py # 飞书导出 JSON 解析
|
||||
│ ├── dingtalk_auto_collector.py # 钉钉全自动采集
|
||||
│ ├── email_parser.py # 邮件解析(eml/mbox/txt)
|
||||
│ ├── skill_writer.py # Skill 文件写入与管理
|
||||
│ └── version_manager.py # 版本存档与回滚
|
||||
├── colleagues/ ← 生成的同事 Skill(.gitignore 排除,示例除外)
|
||||
│ └── example_zhangsan/
|
||||
├── docs/
|
||||
│ └── PRD.md
|
||||
├── requirements.txt
|
||||
├── LICENSE
|
||||
└── README.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
---
|
||||
name: colleague_creator
|
||||
description: 创建同事的 Persona + Work Skill,支持 PDF/飞书/邮件导入和持续进化
|
||||
name: colleague-creator
|
||||
description: 把同事蒸馏成 AI Skill。输入姓名自动采集飞书/钉钉数据,生成 Work Skill + Persona 两部分,支持持续进化。
|
||||
argument-hint: "[colleague-name-or-slug]"
|
||||
version: "1.0.0"
|
||||
user-invocable: true
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
---
|
||||
|
||||
# 同事.skill 创建器(Claude Code 版)
|
||||
@@ -1,133 +0,0 @@
|
||||
---
|
||||
name: colleague_creator
|
||||
description: 创建同事的 Persona + Work Skill,支持 PDF/飞书/邮件导入和持续进化
|
||||
user-invocable: true
|
||||
---
|
||||
|
||||
# 触发条件
|
||||
|
||||
当用户说以下任意内容时启动本 Skill:
|
||||
- `/create-colleague`
|
||||
- "帮我创建一个同事 skill"
|
||||
- "我想蒸馏一个同事"
|
||||
- "新建同事"
|
||||
|
||||
当用户对已存在的同事 Skill 说以下内容时,进入进化模式:
|
||||
- "我有新文件" / "追加文件"
|
||||
- "这不对" / "他不会这样" / "他应该是"
|
||||
- `/update-colleague {slug}`
|
||||
|
||||
当用户说 `/list-colleagues` 时,列出所有已生成的同事 Skill。
|
||||
|
||||
---
|
||||
|
||||
# 主流程:创建新同事 Skill
|
||||
|
||||
## Step 1:基础信息录入
|
||||
|
||||
参考 `prompts/intake.md`,通过对话引导用户填写基础信息。
|
||||
|
||||
所有字段均可跳过。对于每个字段,如果用户说"跳过"或"不填",直接进入下一项。
|
||||
|
||||
询问顺序:
|
||||
1. 同事的姓名或代号(必须,用于生成文件名)
|
||||
2. 公司 + 职级 + 职位(如"字节 2-1 算法工程师",可一句话说完)
|
||||
3. 性别
|
||||
4. MBTI
|
||||
5. 个性标签(展示预设选项,可多选,可自定义)
|
||||
6. 企业文化标签(展示预设选项,可多选)
|
||||
7. 你对他的主观印象(自由文本,可跳过)
|
||||
|
||||
收集完毕后,汇总确认,用户确认后进入 Step 2。
|
||||
|
||||
## Step 2:文件导入
|
||||
|
||||
提示用户上传原材料,支持:
|
||||
- PDF 文档(接口文档、技术规范、飞书导出)
|
||||
- 图片截图
|
||||
- 飞书消息导出 JSON 文件(提示:飞书 → 消息 → 导出)
|
||||
- 邮件文本文件(.eml 或 .txt)
|
||||
- Markdown 文本
|
||||
|
||||
处理规则:
|
||||
- PDF 文件:使用 pdf 工具读取全文
|
||||
- 图片:使用图像理解读取内容
|
||||
- JSON 文件(飞书消息):调用 `tools/feishu_parser.py` 解析,提取目标同事发出的内容
|
||||
- .eml / .txt(邮件):调用 `tools/email_parser.py` 解析,提取发件人为目标同事的邮件
|
||||
- Markdown / 纯文本:直接读取
|
||||
|
||||
用户可以说"没有文件"或"跳过",此时仅凭手动信息生成 Skill。
|
||||
|
||||
## Step 3:分析原材料
|
||||
|
||||
如果有文件内容,执行两条并行分析线路:
|
||||
|
||||
**线路 A(Work Skill 分析)**:
|
||||
参考 `prompts/work_analyzer.md`,从原材料中提取:
|
||||
- 负责的系统/业务/文档
|
||||
- 技术规范与代码风格偏好
|
||||
- 工作流程(接需求→方案→交付)
|
||||
- 输出格式偏好
|
||||
- 积累的知识结论
|
||||
|
||||
**线路 B(Persona 分析)**:
|
||||
参考 `prompts/persona_analyzer.md`,从原材料中提取:
|
||||
- 表达风格(用词、句式、口头禅)
|
||||
- 决策模式与判断框架
|
||||
- 人际行为(对上/对下/对平级)
|
||||
- 在压力下的行为特征
|
||||
- 边界与雷区
|
||||
|
||||
## Step 4:生成 Skill 文件
|
||||
|
||||
参考 `prompts/work_builder.md` 生成 `work.md` 内容。
|
||||
参考 `prompts/persona_builder.md` 生成 `persona.md` 内容。
|
||||
|
||||
向用户展示两个部分的摘要(各 5-8 行),询问是否需要调整。
|
||||
|
||||
用户确认后,调用 `tools/skill_writer.py`,写入以下文件:
|
||||
```
|
||||
colleagues/{slug}/SKILL.md
|
||||
colleagues/{slug}/work.md
|
||||
colleagues/{slug}/persona.md
|
||||
colleagues/{slug}/meta.json
|
||||
```
|
||||
|
||||
告知用户 Skill 已创建,触发词为 `/{slug}`,工作版 `/{slug}-work`,人格版 `/{slug}-persona`。
|
||||
|
||||
---
|
||||
|
||||
# 进化模式:追加文件
|
||||
|
||||
当用户提供新文件时:
|
||||
1. 读取新文件内容(同 Step 2 处理方式)
|
||||
2. 读取现有 `work.md` 和 `persona.md`
|
||||
3. 参考 `prompts/merger.md`,判断新内容属于 Work 还是 Persona
|
||||
4. 只追加增量信息,不覆盖已有结论
|
||||
5. 调用 `tools/version_manager.py` 存档当前版本后写入更新
|
||||
6. 告知用户更新摘要
|
||||
|
||||
---
|
||||
|
||||
# 进化模式:对话纠正
|
||||
|
||||
当用户说"这不对"/"他应该是"/"他不会这样"时:
|
||||
1. 参考 `prompts/correction_handler.md`,识别纠正的具体内容
|
||||
2. 判断属于 Work Skill 还是 Persona 的纠正
|
||||
3. 生成一条 correction 记录,格式:
|
||||
`[场景] 不应该 {错误行为},应该 {正确行为}`
|
||||
4. 追加到对应文件的 Correction 层
|
||||
5. 立即生效
|
||||
|
||||
---
|
||||
|
||||
# 管理命令
|
||||
|
||||
`/list-colleagues`:
|
||||
列出 `colleagues/` 目录下所有同事,显示姓名、公司职级、版本号、最后更新时间。
|
||||
|
||||
`/colleague-rollback {slug} {version}`:
|
||||
调用 `tools/version_manager.py` 回滚到指定版本。
|
||||
|
||||
`/delete-colleague {slug}`:
|
||||
确认后删除对应目录。
|
||||
12
requirements.txt
Normal file
12
requirements.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
# Required
|
||||
requests>=2.28.0
|
||||
|
||||
# Optional: Chinese name → slug conversion
|
||||
pypinyin>=0.48.0
|
||||
|
||||
# Optional: Playwright for Feishu browser login / DingTalk message scraping
|
||||
playwright>=1.40.0
|
||||
|
||||
# Optional: Word/Excel parsing (convert to PDF/CSV first if unavailable)
|
||||
python-docx>=1.1.0
|
||||
openpyxl>=3.1.0
|
||||
Reference in New Issue
Block a user