Distill a colleague into an AI Skill. Auto-collect Feishu/DingTalk data, generate Work Skill + Persona, with continuous evolution. | 把同事蒸馏成 AI Skill,自动采集飞书/钉钉数据,生成 Work + Persona,支持持续进化。
Language / 语言: This skill supports both English and Chinese. Detect the user's language from their first message and respond in the same language throughout. Below are instructions in both languages — follow the one matching the user's language.
Bash → python3 ${CLAUDE_SKILL_DIR}/tools/skill_writer.py --action list
Base directory: Skill files are written to ./colleagues/{slug}/ (relative to the project directory).
For a global path, use --base-dir ~/.openclaw/workspace/skills/colleagues.
Main Flow: Create a New Colleague Skill
Step 1: Basic Info Collection (3 questions)
Refer to ${CLAUDE_SKILL_DIR}/prompts/intake.md for the question sequence. Only ask 3 questions:
Alias / Codename (required)
Basic info (one sentence: company, level, role, gender — say whatever comes to mind)
Example: INTJ Capricorn blame-shifter ByteDance-style strict in CR but never explains why
Everything except the alias can be skipped. Summarize and confirm before moving to the next step.
Step 2: Source Material Import
Ask the user how they'd like to provide materials:
text
How would you like to provide source materials?
[A] Feishu Auto-Collect (recommended)
Enter name, auto-pull messages + docs + spreadsheets
[B] DingTalk Auto-Collect
Enter name, auto-pull docs + spreadsheets
Messages collected via browser (DingTalk API doesn't support message history)
[C] Feishu Link
Provide doc/Wiki link (browser session or MCP)
[D] Upload Files
PDF / images / exported JSON / email .eml
[E] Paste Text
Copy-paste text directly
Can mix and match, or skip entirely (generate from manual info only).
Or write a Python script to call the Feishu API directly:
python
# 1. Get app_access_token
POST https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal
Body: {"app_id": "xxx", "app_secret": "xxx"}
# 2. Exchange code for user_access_token
POST https://open.feishu.cn/open-apis/authen/v1/oidc/access_token
Header: Authorization: Bearer {app_access_token}
Body: {"grant_type": "authorization_code", "code": "xxx"}
Getting the p2p chat_id:
Users typically don't know their chat_id. When the user has a user_access_token but no chat_id, write a Python script yourself to obtain it:
Method: Send a message to the other user's open_id — the response includes the chat_id
python
POST https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id
Header: Authorization: Bearer {user_access_token}
Body: {"receive_id": "{target_open_id}", "msg_type": "text", "content": "{\"text\":\"hello\"}"}
# The chat_id in the response is the p2p chat ID
Important: GET /im/v1/chats does NOT return p2p chats — this is a Feishu API limitation, not a permission issue. Do not try to use it for finding private chats.
If the user doesn't know the target's open_id, use tenant_access_token to search contacts:
python
GET https://open.feishu.cn/open-apis/contact/v3/scopes
# Returns open_ids of all users visible to the app
Flexibility principle: The above API calls don't have to go through the collector script. If the script doesn't work or doesn't fit the scenario, write Python scripts directly to call Feishu APIs. Key API reference:
Get token: POST /auth/v3/app_access_token/internal, POST /authen/v1/oidc/access_token
Send message (get chat_id): POST /im/v1/messages?receive_id_type=open_id
Fetch messages: GET /im/v1/messages?container_id_type=chat&container_id={chat_id}
Search contacts: GET /contact/v3/scopes, GET /contact/v3/users/{user_id}
Auto-collected content:
Group chats: messages sent by them (system messages and stickers filtered)
Private chats: full conversation with both parties (for context understanding)
python3 ${CLAUDE_SKILL_DIR}/tools/dingtalk_auto_collector.py \
--name "{name}" \
--output-dir ./knowledge/{slug} \
--msg-limit 500 \
--doc-limit 20 \
--show-browser # add this flag on first use to complete DingTalk login
Collected content:
DingTalk docs and knowledge bases they created/edited
Spreadsheets
Messages (⚠️ DingTalk API doesn't support message history — auto-switches to browser scraping)
After collection, Read:
knowledge/{slug}/docs.txt
knowledge/{slug}/bitables.txt
knowledge/{slug}/messages.txt
If message collection fails, prompt user to upload chat screenshots.
Emphasize different aspects by role type (backend/frontend/ML/product/design)
Track B (Persona):
Refer to ${CLAUDE_SKILL_DIR}/prompts/persona_analyzer.md for extraction dimensions
Translate user-provided tags into concrete behavior rules (see tag translation table)
Extract from materials: communication style, decision patterns, interpersonal behavior
Step 4: Generate and Preview
Use ${CLAUDE_SKILL_DIR}/prompts/work_builder.md to generate Work Skill content.
Use ${CLAUDE_SKILL_DIR}/prompts/persona_builder.md to generate Persona content (5-layer structure).
Show the user a summary (5-8 lines each), ask:
text
Work Skill Summary:
- Responsible for: {xxx}
- Tech stack: {xxx}
- CR focus: {xxx}
...
Persona Summary:
- Core personality: {xxx}
- Communication style: {xxx}
- Decision pattern: {xxx}
...
Confirm generation? Or need adjustments?
5. Generate full SKILL.md (Write tool):
Path: colleagues/{slug}/SKILL.md
SKILL.md structure:
markdown
---
name: colleague-{slug}
description: {name}, {company} {level} {role}
user-invocable: true
---
# {name}
{company} {level} {role}{append gender and MBTI if available}
---
## PART A: Work Capabilities
{full work.md content}
---
## PART B: Persona
{full persona.md content}
---
## Execution Rules
1. PART B decides first: what attitude to take on this task?
2. PART A executes: use your technical skills to complete the task
3. Always maintain PART B's communication style in output
4. PART B Layer 0 rules have the highest priority and must never be violated
Inform user:
text
✅ Colleague Skill created!
Location: colleagues/{slug}/
Commands: /{slug} (full version)
/{slug}-work (work capabilities only)
/{slug}-persona (persona only)
If something feels off, just say "he wouldn't do that" and I'll update it.
Evolution Mode: Append Files
When user provides new files or text:
Read new content using Step 2 methods
Read existing colleagues/{slug}/work.md and persona.md
Refer to ${CLAUDE_SKILL_DIR}/prompts/merger.md for incremental analysis