SuperAPI AI Directory

colleague-skill

Data & analytics

View repository

Updated 10-15 17:26

About this skill

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.

This Skill supports both Chinese and English. Based on the language of the user's first message, use the same language for the entire conversation. Instructions for both languages are provided below; select and follow the corresponding version according to the user's language.

Colleague.skill Creator (Claude Code Edition)

Trigger Conditions

Activate when the user says any of the following:

  • /create-colleague
  • "Help me create a colleague skill"
  • "I want to distill a colleague"
  • "Create new colleague"
  • "Make me a skill for XX"

When the user says the following to an existing colleague Skill, enter evolution mode:

  • "I have new files" / "Append"
  • "This is wrong" / "He wouldn't do this" / "He should be"
  • /update-colleague {slug}

When the user says /list-colleagues , list all generated colleagues.


Tool Usage Rules

This Skill runs in the Claude Code environment and uses the following tools:

Task Use Tool
Read PDF documents Read tool (native PDF support)
Read image screenshots Read tool (native image support)
Read MD/TXT files Read tool
Parse Feishu message JSON export Bash → python3 ${CLAUDE_SKILL_DIR}/tools/feishu_parser.py
Feishu fully automatic collection (recommended) Bash → python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py
Feishu documents (browser login session) Bash → python3 ${CLAUDE_SKILL_DIR}/tools/feishu_browser.py
Feishu documents (MCP App Token) Bash → python3 ${CLAUDE_SKILL_DIR}/tools/feishu_mcp_client.py
DingTalk fully automatic collection Bash → python3 ${CLAUDE_SKILL_DIR}/tools/dingtalk_auto_collector.py
Parse email .eml/.mbox Bash → python3 ${CLAUDE_SKILL_DIR}/tools/email_parser.py
Write/update Skill files Write / Edit tool
Version management Bash → python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py
List existing Skills Bash → python3 ${CLAUDE_SKILL_DIR}/tools/skill_writer.py --action list

Base directory: Skill files are written to ./colleagues/{slug}/(relative to the current project directory). To change to a global path, use --base-dir ~/.openclaw/workspace/skills/colleagues。


Main Flow: Create a New Colleague Skill

Step 1: Basic Information Entry (3 questions)

Refer to ${CLAUDE_SKILL_DIR}/prompts/intake.md 's question sequence; ask only 3 questions:

  1. Nickname/Codename(required)
  2. Basic information(one sentence: company, level, position, gender—write whatever comes to mind)
    • Example:字节 2-1 后端工程师 男
  3. Personality profile(one sentence: MBTI, zodiac sign, personality tags, corporate culture, impressions)
    • Example:INTJ 摩羯座 甩锅高手 字节范 CR很严格但从来不解释原因

Everything except the name can be skipped. After collecting, summarize and confirm before proceeding to the next step.

Step 2: Raw Material Import

Ask the user to provide raw materials, presenting four methods to choose from:

原材料怎么提供?

  [A] 飞书自动采集(推荐)
      输入姓名,自动拉取消息记录 + 文档 + 多维表格

  [B] 钉钉自动采集
      输入姓名,自动拉取文档 + 多维表格
      消息记录通过浏览器采集(钉钉 API 不支持历史消息)

  [C] 飞书链接
      直接给文档/Wiki 链接(浏览器登录态 或 MCP)

  [D] 上传文件
      PDF / 图片 / 导出 JSON / 邮件 .eml

  [E] 直接粘贴内容
      把文字复制进来

可以混用,也可以跳过(仅凭手动信息生成)。

Method A: Feishu automatic collection (recommended)

First-time use requires configuration:

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py --setup

Group chat collection(uses tenant_access_token; the bot must be in the group):

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py \
  --name "{name}" \
  --output-dir ./knowledge/{slug} \
  --msg-limit 1000 \
  --doc-limit 20

Private chat collection(requires user_access_token + private chat chat_id):

Private chat messages can only be retrieved via user identity (user_access_token); app identity has no access to private chats.

Prerequisites:

The user needs to provide the following information:

  1. Feishu app credentials:app_id and app_secret(obtained by creating a custom app on the Feishu Open Platform)
  2. User permissions: The app needs the following user permissions (scopes) enabled:
    • im:message — Read/send messages as the user
    • im:chat — Read the chat list as the user
  3. OAuth authorization code (code): After the user completes OAuth authorization in the browser, obtain it from the callback URL

If the user is missing any of the above information, guide them through the configuration. Do not assume the user has already set it up.

Complete process for obtaining user_access_token:

When the user has provided app_id and app_secret, and confirmed that user permissions have been enabled:

  1. Help the user generate the OAuth authorization link:

    https://open.feishu.cn/open-apis/authen/v1/authorize?app_id={APP_ID}&redirect_uri=http://www.example.com&scope=im:message%20im:chat
    

    ⚠️ Note:redirect_uri You need to add it in the Feishu app's "Security Settings → Redirect URL": http://www.example.com

  2. The user opens the link in a browser, logs in, and authorizes

  3. The page will redirect to http://www.example.com?code=xxx, and the user copies the code to you

  4. Exchange the code for a token:

    python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py --exchange-code {CODE}
    

    Or write your own Python script to call the Feishu API to exchange it:

    # 1. 获取 app_access_token
    POST https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal
    Body: {"app_id": "xxx", "app_secret": "xxx"}
    
    # 2. 用 code 换 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"}
    

Obtain the private chat chat_id:

Users usually do not know the chat_id. When the user has a user_access_token but no chat_id, you shouldwrite your own Python scriptto obtain it:

  • Method: Use the user_access_token to send a message to the other party's open_id; the return value will include the chat_id
    POST https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id
    Header: Authorization: Bearer {user_access_token}
    Body: {"receive_id": "{对方open_id}", "msg_type": "text", "content": "{\"text\":\"你好\"}"}
    # 返回值中的 chat_id 就是私聊会话 ID
    
  • Note:GET /im/v1/chats will not return private chat conversations. This is a limitation of the Feishu API, not a permissions issue. Do not try to use this endpoint to find private chats
  • If the user does not know the other party's open_id, they can use the tenant_access_token to call the contacts API to search:
    GET https://open.feishu.cn/open-apis/contact/v3/scopes
    # 返回应用可见范围内所有用户的 open_id
    

Execute collection:

After obtaining the user_access_token and chat_id:

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py \
  --open-id {对方open_id} \
  --p2p-chat-id {chat_id} \
  --user-token {user_access_token} \
  --name "{name}" \
  --output-dir ./knowledge/{slug} \
  --msg-limit 1000

Flexibility principle: The above API calls do not necessarily have to use the collector script. If the script does not work or the scenario does not match, you can directly write a Python script to call the Feishu API to complete the task. Core 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
  • Pull messages:GET /im/v1/messages?container_id_type=chat&container_id={chat_id}
  • Query contacts:GET /contact/v3/scopes、GET /contact/v3/users/{user_id}

Automatically collect content:

  • Group chats: messages he sent in all group chats shared with him (filter out system messages and sticker packs)
  • Private chat: the complete private chat conversation with him (including messages from both sides, used to understand the conversation context)
  • Feishu documents and Wiki he created/edited
  • Related Bitable (if authorized)

After collection is complete, use Read to read the files in the output directory:

  • knowledge/{slug}/messages.txt → message records (group chat + private chat)
  • knowledge/{slug}/docs.txt → document content
  • knowledge/{slug}/collection_summary.json → collection summary

If collection fails, determine the cause yourself based on the error and try to fix it. Common issues:

  • Group chat collection: the bot has not been added to the group chat
  • Private chat collection: user_access_token expired (valid for 2 hours, can be refreshed with refresh_token)
  • Insufficient permissions: guide the user to enable the corresponding permissions on the Feishu Open Platform and reauthorize
  • Or switch to method B/C

Method B: DingTalk automatic collection

Configuration is required for first use:

python3 ${CLAUDE_SKILL_DIR}/tools/dingtalk_auto_collector.py --setup

Then enter the name and collect with one click:

python3 ${CLAUDE_SKILL_DIR}/tools/dingtalk_auto_collector.py \
  --name "{name}" \
  --output-dir ./knowledge/{slug} \
  --msg-limit 500 \
  --doc-limit 20 \
  --show-browser   # 首次使用加此参数,完成钉钉登录

Collected content:

  • DingTalk documents and knowledge bases he created/edited
  • Bitable
  • Message records (⚠️ The DingTalk API does not support pulling historical messages; automatically switches to browser collection)

After collection is complete Read Read:

  • knowledge/{slug}/docs.txt
  • knowledge/{slug}/bitables.txt
  • knowledge/{slug}/messages.txt

If message collection fails, prompt the user to take a screenshot of the chat record and upload it.


Method C: Upload file

  • PDF / image:Read The tool reads directly
  • Feishu message JSON export:
    python3 ${CLAUDE_SKILL_DIR}/tools/feishu_parser.py --file {path} --target "{name}" --output /tmp/feishu_out.txt
    
    Then Read /tmp/feishu_out.txt
  • Email file .eml / .mbox:
    python3 ${CLAUDE_SKILL_DIR}/tools/email_parser.py --file {path} --target "{name}" --output /tmp/email_out.txt
    
    Then Read /tmp/email_out.txt
  • Markdown / TXT:Read The tool reads directly

Method B: Feishu link

When the user provides a Feishu document/Wiki link, ask how to read it:

检测到飞书链接,选择读取方式:

  [1] 浏览器方案(推荐)
      复用你本机 Chrome 的登录状态
      ✅ 内部文档、需要权限的文档都能读
      ✅ 无需配置 token
      ⚠️  需要本机安装 Chrome + playwright

  [2] MCP 方案
      通过飞书 App Token 调用官方 API
      ✅ 稳定,不依赖浏览器
      ✅ 可以读消息记录(需要群聊 ID)
      ⚠️  需要先配置 App ID / App Secret
      ⚠️  内部文档需要管理员给应用授权

选择 [1/2]:

Choose 1 (browser solution):

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_browser.py \
  --url "{feishu_url}" \
  --target "{name}" \
  --output /tmp/feishu_doc_out.txt

On first use, if not logged in, a browser window will pop up asking you to log in (one-time).

Choose 2 (MCP solution):

On first use, initialization configuration is required:

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_mcp_client.py --setup

After that, read directly:

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_mcp_client.py \
  --url "{feishu_url}" \
  --output /tmp/feishu_doc_out.txt

Read message records (requires group chat ID, format oc_xxx):

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_mcp_client.py \
  --chat-id "oc_xxx" \
  --target "{name}" \
  --limit 500 \
  --output /tmp/feishu_msg_out.txt

After both methods output, use Read Read the result file and enter the analysis process.


Method C: Paste directly

The content pasted by the user is directly used as text raw material, with no need to call any tool.


If the user says "no file" or "skip", generate the Skill based only on the manual information from Step 1.

Step 3: Analyze raw materials

Aggregate all collected raw materials and the basic information filled in by the user, and analyze along the following two lines:

Line A (Work Skill):

  • Reference ${CLAUDE_SKILL_DIR}/prompts/work_analyzer.md extraction dimensions in
  • Extract: responsible systems, technical specifications, work processes, output preferences, experience and knowledge
  • Extract with emphasis based on the job type (different emphases for backend/frontend/algorithm/product/design)

Line B (Persona):

  • Reference ${CLAUDE_SKILL_DIR}/prompts/persona_analyzer.md extraction dimensions in
  • Translate the tags filled in by the user into specific behavioral rules (see the tag translation table)
  • Extract from raw materials: expression style, decision-making patterns, interpersonal behavior

Step 4: Generate and preview

Reference ${CLAUDE_SKILL_DIR}/prompts/work_builder.md Generate Work Skill content. Reference ${CLAUDE_SKILL_DIR}/prompts/persona_builder.md Generate Persona content (5-layer structure).

Show the user a summary (5-8 lines each), and ask:

Work Skill 摘要:
  - 负责:{xxx}
  - 技术栈:{xxx}
  - CR 重点:{xxx}
  ...

Persona 摘要:
  - 核心性格:{xxx}
  - 表达风格:{xxx}
  - 决策模式:{xxx}
  ...

确认生成?还是需要调整?

Step 5: Write files

After the user confirms, perform the following write operations:

1. Create directory structure(use Bash):

mkdir -p colleagues/{slug}/versions
mkdir -p colleagues/{slug}/knowledge/docs
mkdir -p colleagues/{slug}/knowledge/messages
mkdir -p colleagues/{slug}/knowledge/emails

2. Write work.md(use the Write tool): Path:colleagues/{slug}/work.md

3. Write persona.md(use the Write tool): Path:colleagues/{slug}/persona.md

4. Write meta.json(use the Write tool): Path:colleagues/{slug}/meta.json Content:

{
  "name": "{name}",
  "slug": "{slug}",
  "created_at": "{ISO时间}",
  "updated_at": "{ISO时间}",
  "version": "v1",
  "profile": {
    "company": "{company}",
    "level": "{level}",
    "role": "{role}",
    "gender": "{gender}",
    "mbti": "{mbti}"
  },
  "tags": {
    "personality": [...],
    "culture": [...]
  },
  "impression": "{impression}",
  "knowledge_sources": [...已导入文件列表],
  "corrections_count": 0
}

5. Generate the complete SKILL.md(use the Write tool): Path:colleagues/{slug}/SKILL.md

SKILL.md structure:

---
name: colleague-{slug}
description: {name},{company} {level} {role}
user-invocable: true
---

# {name}

{company} {level} {role}{如有性别和MBTI则附上}

---

## PART A:工作能力

{work.md 全部内容}

---

## PART B:人物性格

{persona.md 全部内容}

---

## 运行规则

1. 先由 PART B 判断:用什么态度接这个任务?
2. 再由 PART A 执行:用你的技术能力完成任务
3. 输出时始终保持 PART B 的表达风格
4. PART B Layer 0 的规则优先级最高,任何情况下不得违背

Inform the user:

✅ 同事 Skill 已创建!

文件位置:colleagues/{slug}/
触发词:/{slug}(完整版)
        /{slug}-work(仅工作能力)
        /{slug}-persona(仅人物性格)

如果用起来感觉哪里不对,直接说"他不会这样",我来更新。

Evolution mode: append to file

When the user provides a new file or text:

  1. Read the new content as in Step 2
  2. Use Read Read the existing colleagues/{slug}/work.md and persona.md
  3. Reference ${CLAUDE_SKILL_DIR}/prompts/merger.md Analyze the incremental content
  4. Archive the current version (use Bash):
    python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py --action backup --slug {slug} --base-dir ./colleagues
    
  5. Use the Edit tool to append the incremental content to the corresponding file
  6. Regenerate SKILL.md(Merge latest work.md + persona.md)
  7. Update meta.json 's version and updated_at

Evolution mode: conversation correction

When the user expresses "incorrect"/"should be":

  1. Refer to ${CLAUDE_SKILL_DIR}/prompts/correction_handler.md to identify the correction content
  2. Determine whether it belongs to Work (technical/process) or Persona (personality/communication)
  3. Generate a correction record
  4. Use the Edit tool to append to the corresponding file's ## Correction 记录 section
  5. Regenerate SKILL.md

Management commands

/list-colleagues:

python3 ${CLAUDE_SKILL_DIR}/tools/skill_writer.py --action list --base-dir ./colleagues

/colleague-rollback {slug} {version}:

python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py --action rollback --slug {slug} --version {version} --base-dir ./colleagues

/delete-colleague {slug}: After confirmation, execute:

rm -rf colleagues/{slug}


English Version Colleague.skill Creator (Claude Code Edition)

Trigger Conditions

Activate when the user says any of the following:

  • /create-colleague
  • "Help me create a colleague skill"
  • "I want to distill a colleague"
  • "New colleague"
  • "Make a skill for XX"

Enter evolution mode when the user says:

  • "I have new files" / "append"
  • "That's wrong" / "He wouldn't do that" / "He should be"
  • /update-colleague {slug}

List all generated colleagues when the user says /list-colleagues.


Tool Usage Rules

This Skill runs in the Claude Code environment with the following tools:

Task Tool
Read PDF documents Read tool (native PDF support)
Read image screenshots Read tool (native image support)
Read MD/TXT files Read tool
Parse Feishu message JSON export Bash → python3 ${CLAUDE_SKILL_DIR}/tools/feishu_parser.py
Feishu auto-collect (recommended) Bash → python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py
Feishu docs (browser session) Bash → python3 ${CLAUDE_SKILL_DIR}/tools/feishu_browser.py
Feishu docs (MCP App Token) Bash → python3 ${CLAUDE_SKILL_DIR}/tools/feishu_mcp_client.py
DingTalk auto-collect Bash → python3 ${CLAUDE_SKILL_DIR}/tools/dingtalk_auto_collector.py
Parse email .eml/.mbox Bash → python3 ${CLAUDE_SKILL_DIR}/tools/email_parser.py
Write/update Skill files Write / Edit tool
Version management Bash → python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py
List existing Skills 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:

  1. Alias / Codename (required)
  2. Basic info (one sentence: company, level, role, gender — say whatever comes to mind)
    • Example: ByteDance L2-1 backend engineer male
  3. Personality profile (one sentence: MBTI, zodiac, traits, corporate culture, impressions)
    • 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:

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).

Option A: Feishu Auto-Collect (Recommended)

First-time setup:

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py --setup

Group chat collection (uses tenant_access_token, bot must be in the group):

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py \
  --name "{name}" \
  --output-dir ./knowledge/{slug} \
  --msg-limit 1000 \
  --doc-limit 20

Private chat (P2P) collection (requires user_access_token + p2p chat_id):

Private messages can only be accessed via user identity (user_access_token). App identity cannot access private chats.

Prerequisites:

The user needs to provide:

  1. Feishu app credentials: app_id and app_secret (from Feishu Open Platform)
  2. User scopes: The app must have these user scopes enabled:
    • im:message — read/send messages as user
    • im:chat — read chat list as user
  3. OAuth authorization code: obtained after user completes OAuth in browser

If the user is missing any of these, guide them through setup. Don't assume anything is pre-configured.

Getting user_access_token:

Once the user provides app_id, app_secret, and confirms scopes are enabled:

  1. Generate the OAuth URL for them:

    https://open.feishu.cn/open-apis/authen/v1/authorize?app_id={APP_ID}&redirect_uri=http://www.example.com&scope=im:message%20im:chat
    

    ⚠️ The redirect_uri must be added in the app's "Security Settings → Redirect URLs"

  2. User opens URL, logs in, authorizes

  3. Page redirects to http://www.example.com?code=xxx, user copies the code

  4. Exchange code for token:

    python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py --exchange-code {CODE}
    

    Or write a Python script to call the Feishu API directly:

    # 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
    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:
    GET https://open.feishu.cn/open-apis/contact/v3/scopes
    # Returns open_ids of all users visible to the app
    

Running collection:

Once you have user_access_token and chat_id:

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_auto_collector.py \
  --open-id {target_open_id} \
  --p2p-chat-id {chat_id} \
  --user-token {user_access_token} \
  --name "{name}" \
  --output-dir ./knowledge/{slug} \
  --msg-limit 1000

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)
  • Feishu docs and Wikis they created/edited
  • Related spreadsheets (if accessible)

After collection, Read the output files:

  • knowledge/{slug}/messages.txt → messages (group + private)
  • knowledge/{slug}/docs.txt → document content
  • knowledge/{slug}/collection_summary.json → collection summary

If collection fails, diagnose the error and attempt to fix it. Common issues:

  • Group chat: bot not added to the group
  • Private chat: user_access_token expired (2-hour TTL, refresh with refresh_token)
  • Insufficient permissions: guide user to enable scopes and re-authorize
  • Or switch to Option B/C

Option B: DingTalk Auto-Collect

First-time setup:

python3 ${CLAUDE_SKILL_DIR}/tools/dingtalk_auto_collector.py --setup

Then enter the name:

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.


Option C: Upload Files

  • PDF / Images: Read tool directly
  • Feishu message JSON export:
    python3 ${CLAUDE_SKILL_DIR}/tools/feishu_parser.py --file {path} --target "{name}" --output /tmp/feishu_out.txt
    
    Then Read /tmp/feishu_out.txt
  • Email files .eml / .mbox:
    python3 ${CLAUDE_SKILL_DIR}/tools/email_parser.py --file {path} --target "{name}" --output /tmp/email_out.txt
    
    Then Read /tmp/email_out.txt
  • Markdown / TXT: Read tool directly

Option D: Feishu Link

When the user provides a Feishu doc/Wiki link, ask which method to use:

Feishu link detected. Choose read method:

  [1] Browser Method (recommended)
      Reuses your local Chrome login session
      ✅ Works with internal docs requiring permissions
      ✅ No token configuration needed
      ⚠️  Requires Chrome + playwright installed locally

  [2] MCP Method
      Uses Feishu App Token via official API
      ✅ Stable, no browser dependency
      ✅ Can read messages (needs chat ID)
      ⚠️  Requires App ID / App Secret setup
      ⚠️  Internal docs need admin authorization for the app

Choose [1/2]:

Option 1 (Browser):

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_browser.py \
  --url "{feishu_url}" \
  --target "{name}" \
  --output /tmp/feishu_doc_out.txt

First use will open a browser window for login (one-time).

Option 2 (MCP):

First-time setup:

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_mcp_client.py --setup

Then read directly:

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_mcp_client.py \
  --url "{feishu_url}" \
  --output /tmp/feishu_doc_out.txt

Read messages (needs chat ID, format oc_xxx):

python3 ${CLAUDE_SKILL_DIR}/tools/feishu_mcp_client.py \
  --chat-id "oc_xxx" \
  --target "{name}" \
  --limit 500 \
  --output /tmp/feishu_msg_out.txt

Both methods output to files, then use Read to load results into analysis.


Option E: Paste Text

User-pasted content is used directly as text material. No tools needed.


If the user says "no files" or "skip", generate Skill from Step 1 manual info only.

Step 3: Analyze Source Material

Combine all collected materials and user-provided info, analyze along two tracks:

Track A (Work Skill):

  • Refer to ${CLAUDE_SKILL_DIR}/prompts/work_analyzer.md for extraction dimensions
  • Extract: responsible systems, technical standards, workflow, output preferences, experience
  • 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:

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?

Step 5: Write Files

After user confirmation, execute the following:

1. Create directory structure (Bash):

mkdir -p colleagues/{slug}/versions
mkdir -p colleagues/{slug}/knowledge/docs
mkdir -p colleagues/{slug}/knowledge/messages
mkdir -p colleagues/{slug}/knowledge/emails

2. Write work.md (Write tool): Path: colleagues/{slug}/work.md

3. Write persona.md (Write tool): Path: colleagues/{slug}/persona.md

4. Write meta.json (Write tool): Path: colleagues/{slug}/meta.json Content:

{
  "name": "{name}",
  "slug": "{slug}",
  "created_at": "{ISO_timestamp}",
  "updated_at": "{ISO_timestamp}",
  "version": "v1",
  "profile": {
    "company": "{company}",
    "level": "{level}",
    "role": "{role}",
    "gender": "{gender}",
    "mbti": "{mbti}"
  },
  "tags": {
    "personality": [...],
    "culture": [...]
  },
  "impression": "{impression}",
  "knowledge_sources": [...imported file list],
  "corrections_count": 0
}

5. Generate full SKILL.md (Write tool): Path: colleagues/{slug}/SKILL.md

SKILL.md structure:

---
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:

✅ 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:

  1. Read new content using Step 2 methods
  2. Read existing colleagues/{slug}/work.md and persona.md
  3. Refer to ${CLAUDE_SKILL_DIR}/prompts/merger.md for incremental analysis
  4. Archive current version (Bash):
    python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py --action backup --slug {slug} --base-dir ./colleagues
    
  5. Use Edit tool to append incremental content to relevant files
  6. Regenerate SKILL.md (merge latest work.md + persona.md)
  7. Update meta.json version and updated_at

Evolution Mode: Conversation Correction

When user expresses "that's wrong" / "he should be":

  1. Refer to ${CLAUDE_SKILL_DIR}/prompts/correction_handler.md to identify correction content
  2. Determine if it belongs to Work (technical/workflow) or Persona (personality/communication)
  3. Generate correction record
  4. Use Edit tool to append to the ## Correction Log section of the relevant file
  5. Regenerate SKILL.md

Management Commands

/list-colleagues:

python3 ${CLAUDE_SKILL_DIR}/tools/skill_writer.py --action list --base-dir ./colleagues

/colleague-rollback {slug} {version}:

python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py --action rollback --slug {slug} --version {version} --base-dir ./colleagues

/delete-colleague {slug}: After confirmation:

rm -rf colleagues/{slug}