SuperAPI AI Directory

lark-workflow-multi-agent-dev

Agents & models

View repository

Updated 10-15 23:59

About this skill

Multi-Programming-Agent Collaboration Workflow

CRITICAL — Before starting, you MUST first use the Read tool to read ../lark-shared/SKILL.md, which contains authentication and permission handling

Applicable Scenarios

  • "Help me do this task with multiple agents" / "Parallel development"
  • "Have multiple AIs each write a version for the same task" / "Competition mode"
  • "Assign these tasks to different AIs" / "Division-of-labor mode"
  • "One writes code, one reviews, one writes tests" / "Pipeline mode"
  • "Compare which solution is better" / "Code comparison"
  • "Show the current development tasks" / "Task list"

Prerequisites

Only user identityis supported. Ensure authorization before execution:

lark-cli auth login --domain im,base,task

Workflow Overview

任务输入:
  用户描述任务 ──► AI 解析任务复杂度和可拆分性

模式选择:
  ├── 竞赛模式 ──► 同一任务 × N 代理 → 对比选优
  ├── 分工模式 ──► N 个子任务 × 各代理 → 并行完成
  └── 流水线模式 ──► 代码 → 审查 → 测试 → 顺序协作

执行:
  Agent Tool ──► 启动子代理并行执行

追踪:
  base +record-upsert ──► 记录任务和结果

通知:
  im +messages-send ──► 完成通知 + 结果摘要

Data Initialization

Base Table Structure

Table 1: Development Tasks (dev_tasks)

Field Name Type Description
Task Description Text A brief description of the task content
Working Mode Single select Competition/Division of labor/Pipeline
Assigned Agent Text Name of the assigned agent
Agent Count Number Number of participating agents
Status Single select Pending assignment/In progress/Completed/Canceled
Result Summary Text A brief description of the execution result
Result Details Text Detailed results (e.g., code diff link)
Code Repository URL Associated code repository
Branch Name Text Name of the created branch
Start Time Date Task start time
Completion Time Date Task completion time
Duration (seconds) Number Task execution duration

Table 2: Competition Log (competition_log)

Field Name Type Description
Task Description Text Competition task description
Agent A Name Text e.g., "Claude Opus 4.6"
Agent A Result Text Execution result summary for Agent A
Agent B Name Text e.g., "Claude Sonnet 4.6"
Agent B Result Text Execution result summary for Agent B
Agent C Name Text Optional third agent
Agent C result Text
Winner Text Recommended solution after AI evaluation
Evaluation rationale Text Why this solution was chosen
Evaluation date Date Evaluation time

Initialization command

# 注意:+table-create 可能部分成功,需捕获错误后用 +field-create 补字段
# 注意:连续创建字段会触发限流(错误码 800004135),每次调用间隔至少 1 秒
lark-cli base +table-create --name "开发任务" --fields '[
  {"name":"任务描述","type":"text"},
  {"name":"工作模式","type":"select","multiple":false,"options":[{"name":"竞赛"},{"name":"分工"},{"name":"流水线"}]},
  {"name":"分配代理","type":"text"},
  {"name":"代理数量","type":"number"},
  {"name":"状态","type":"select","multiple":false,"options":[{"name":"待分配"},{"name":"执行中"},{"name":"已完成"},{"name":"已取消"}]},
  {"name":"结果摘要","type":"text"},
  {"name":"结果详情","type":"text"},
  {"name":"代码仓库","type":"link"},
  {"name":"分支名","type":"text"},
  {"name":"开始时间","type":"datetime"},
  {"name":"完成时间","type":"datetime"},
  {"name":"耗时(秒)","type":"number"}
]'
lark-cli base +table-create --name "竞赛记录" --fields '[
  {"name":"任务描述","type":"text"},
  {"name":"代理A名称","type":"text"},
  {"name":"代理A结果","type":"text"},
  {"name":"代理B名称","type":"text"},
  {"name":"代理B结果","type":"text"},
  {"name":"代理C名称","type":"text"},
  {"name":"代理C结果","type":"text"},
  {"name":"优胜者","type":"text"},
  {"name":"评估理由","type":"text"},
  {"name":"评估日期","type":"datetime"}
]'

Rate limiting handling: If +table-create partially fails due to rate limiting, the table will still be created successfully. In this case:

  1. Use base +table-list to get the table_id
  2. Use base +field-create --table-id <id> --json '{"name":"字段名","type":"text"}' to add fields one by one, with an interval of 1-2 seconds each time

Mode 1: Competition mode

Applicable scenarios

  • Need to find the optimal implementation solution
  • The same requirement has multiple implementation approaches
  • Core features with high code quality requirements

Workflow

用户描述任务
      │
      ▼
AI 解析任务,确保描述清晰无歧义
      │
      ├──► Agent 1(如 Claude Opus 4.6)──► 结果 A
      ├──► Agent 2(如 Claude Sonnet 4.6)──► 结果 B
      └──► Agent 3(如 Claude Haiku 4.5)──► 结果 C
                                                      │
                                                      ▼
                                              AI 对比评估
                                                      │
                                                      ▼
                                              选出最优方案
                                                      │
                                                      ▼
                                              飞书消息通知

Execution steps

  1. Parse the task: The AI ensures the task description is complete and unambiguous, and asks the user for additional details when necessary
  2. Launch agents: Use Claude Code's Agent Tool to launch multiple sub-agents in parallel (2-3 recommended)

Agent Tool call example (competition mode):

Initiate multiple Agent Tool calls simultaneously in a single message to achieve parallelism:

Agent(subagent_type="general-purpose", model="opus",   description="竞赛方案A", prompt="在仓库 {repo_path} 中完成任务:{任务描述}。要求:写出完整的实现代码。")
Agent(subagent_type="general-purpose", model="sonnet",  description="竞赛方案B", prompt="在仓库 {repo_path} 中完成任务:{任务描述}。要求:写出完整的实现代码。")
Agent(subagent_type="general-purpose", model="haiku",   description="竞赛方案C", prompt="在仓库 {repo_path} 中完成任务:{任务描述}。要求:写出完整的实现代码。")

Note: Agent Tool is a built-in capability of Claude Code (not a lark-cli command).

  • subagent_type: Use general-purpose to handle code tasks
  • model: Optional opus(complex logic),sonnet(code review/documentation),haiku(testing/simple modifications)
  • isolation: "worktree": If each agent needs to work independently without interference, worktree isolation can be enabled
  • Multiple Agent Tools can be executed simultaneously by calling them in parallel in the same message
  1. Collect results: Wait for all agents to complete
  2. Compare and evaluate: The AI compares from the following dimensions:
    • Functional completeness
    • Code quality (readability, maintainability)
    • Performance
    • Edge case handling
    • Security
  3. Record results: Save to the multidimensional table
  4. Notify the user: Send a Feishu message

Evaluation output format

## 竞赛结果:{任务描述}

### 方案 A({代理名称})
- 优点:{列表}
- 缺点:{列表}
- 评分:{分}/10

### 方案 B({代理名称})
- 优点:{列表}
- 缺点:{列表}
- 评分:{分}/10

### 推荐:方案 {X}
理由:{详细理由}

Mode 2: Division of labor mode

Applicable scenarios

  • There are multiple independent tasks that need to be processed in parallel
  • There are no dependencies between tasks
  • Need to quickly complete multiple small tasks

Workflow

用户描述多个任务
      │
      ▼
AI 解析并拆分任务列表
      │
      ├──► Agent 1 ──► 任务 A(修 bug)
      ├──► Agent 2 ──► 任务 B(写新页面)
      └──► Agent 3 ──► 任务 C(优化查询)
                                        │
                                        ▼
                                  全部完成后汇总
                                        │
                                        ▼
                                  飞书消息通知

Execution steps

  1. Split tasks: The AI analyzes the user's description and splits it into independent subtasks
  2. Assign agents: Assign one agent to each subtask
  3. Execute in parallel: Use Agent Tool to launch all sub-agents simultaneously

Agent Tool call example (division of labor mode):

Agent(subagent_type="general-purpose", description="修bug", prompt="修复 {repo_path} 中 src/api/login.ts 的登录超时问题")
Agent(subagent_type="general-purpose", description="写新页面", prompt="在 {repo_path} 中创建 src/pages/dashboard.tsx 仪表盘页面")
Agent(subagent_type="general-purpose", description="优化查询", prompt="优化 {repo_path} 中 src/db/queries.ts 的数据库查询性能")
  1. Collect and summarize: Wait for all agents to complete
  2. Record and notify

Task splitting principles

  • No data dependencies between tasks
  • Each task can be verified independently
  • Moderate task granularity (expected to be completed in 5-30 minutes)

Mode 3: Pipeline Mode

Applicable Scenarios

  • Complex features require multi-stage processing
  • Requires code review and quality assurance
  • Standardized development process

Standard Pipeline

阶段 1: 编写代码(Claude Opus 4.6)
  │  - 编写功能实现
  │  - 编写基础测试
  │
  ▼
阶段 2: 代码审查(Claude Sonnet 4.6)
  │  - 审查代码质量
  │  - 检查潜在 bug
  │  - 提出改进建议
  │
  ▼
阶段 3: 编写测试 + 集成(Claude Haiku 4.5)
  │  - 补充测试用例
  │  - 运行测试验证
  │  - 修复发现的问题
  │
  ▼
汇总报告

Custom Pipeline

Users can customize the pipeline stages and agent assignments:

  • "Use Opus to write the frontend in the first stage, and use Sonnet to do UI review in the second stage"

Execution Steps

  1. Define the pipeline: determine the stages, the agent for each stage, and the input/output between stages
  2. Sequential execution: after each stage is completed, pass the result to the next stage

Agent Tool call example (pipeline mode):

# 阶段1: 编写代码(Opus)
Agent(subagent_type="general-purpose", model="opus", description="阶段1-编写代码", prompt="在 {repo_path} 中实现功能:{任务描述}。编写功能代码和基础测试。")

# 阶段2: 代码审查(Sonnet)— 等阶段1完成后执行
Agent(subagent_type="code-reviewer", model="sonnet", description="阶段2-代码审查", prompt="审查 {repo_path} 中刚刚实现的代码。检查代码质量、潜在 bug、改进建议。")

# 阶段3: 补充测试(Haiku)— 等阶段2完成后执行
Agent(subagent_type="general-purpose", model="haiku", description="阶段3-测试集成", prompt="在 {repo_path} 中为已审查通过的代码补充测试用例并运行测试。")

Key: In pipeline mode, the Agent must execute in order (the prompt of the later stage must include the result of the previous stage).

  1. Quality gate: Each stage can "pass" or "send back" (the previous stage needs modification)
    • If the code review finds serious issues → send the review comments back to the agent in stage 1 for revision
    • Send back at most 2 rounds; if more than 2 rounds, report directly to the user and let the user decide how to handle it
  2. Final summary: generate a summary report after all stages are completed

Task Management

View task list

lark-cli base +record-list --table-id "<tasks_table_id>" --filter '...状态 != "已完成" AND 状态 != "已取消"'

Update task status

lark-cli base +record-upsert --table-id "<tasks_table_id>" --json '{
  "任务描述": "...",
  "状态": "已完成",
  "结果摘要": "...",
  "完成时间": "..."
}'

Create Feishu task tracking

For important development tasks, also create a Feishu task:

lark-cli task +create --summary "[多代理] {任务描述}" --description "工作模式:{模式}\n分配代理:{代理列表}"

Notification

Task completion notification

lark-cli im +messages-send --chat-id "<chat_id>" --markdown "..."

Notification format:

Competition mode:

竞赛完成!

任务:{任务描述}
参与代理:{N} 个
总耗时:{X} 秒

推荐方案:{代理名称}(评分 {分}/10)
理由:{一句话}

查看详细对比:{多维表格链接}

Division-of-labor mode:

分工任务全部完成!

总任务数:{N} 个
总耗时:{X} 秒(并行加速 {倍数}x)

| 任务 | 代理 | 状态 | 耗时 |
|------|------|------|------|
| 任务A | Agent1 | 完成 | {X}s |
| 任务B | Agent2 | 完成 | {Y}s |
| 任务C | Agent3 | 完成 | {Z}s |

Pipeline mode:

流水线执行完成!

任务:{任务描述}
总耗时:{X} 秒

| 阶段 | 代理 | 状态 | 备注 |
|------|------|------|------|
| 编写代码 | Opus 4.6 | 通过 | — |
| 代码审查 | Sonnet 4.6 | 通过 | 3个改进建议 |
| 测试集成 | Haiku 4.5 | 通过 | 12个测试通过 |

查看完整报告:{多维表格链接}

GitHub Repository Integration

The agents in this Skill operate on code in the current working directory by default. If you need to operate on a GitHub repository:

Specify the repository path

In the Agent Tool's prompt , explicitly specify the repository path:

Agent(description="修复bug", prompt="在 D:/projects/my-app 仓库中修复...")

Git Operations

Sub-agents of the Agent Tool can use git commands for version control:

# 创建分支(各代理独立分支,避免冲突)
git checkout -b agent/contest-a

# 提交代码
git add src/
git commit -m "feat: 实现XX功能(竞赛方案A)"

# 推送到远程
git push -u origin agent/contest-a

Create a Pull Request

After the agent completes the code, it can create a PR via the gh CLI:

# 创建 PR
gh pr create --title "feat: XX功能实现" --body "$(cat <<'EOF'
## 方案说明
{代理生成的方案描述}

## 变更内容
- {变更列表}
EOF
)"

Note: Pushing to a remote repository and creating a PR will affect shared state, so user confirmation must be obtained before execution.

Worktree Isolation Mode

Use isolation: "worktree" to let each agent work in an independent git worktree without interfering with each other:

Agent(subagent_type="general-purpose", isolation="worktree", description="竞赛方案A", prompt="...")
Agent(subagent_type="general-purpose", isolation="worktree", description="竞赛方案B", prompt="...")

After the comparison is complete, keep the worktree of the winning solution and delete the other solutions.


Usage Recommendations

  1. Simple tasks(single feature, clear requirements) → competition mode, 2 agents are sufficient
  2. Batch tasks(multiple independent bugs, multiple small features) → division-of-labor mode, allocate agents according to the number of tasks
  3. Complex features(new modules, core features) → pipeline mode, ensure quality
  4. Agent selection recommendations:
    • Complex logic, architecture design → Opus
    • Code review, documentation → Sonnet
    • Testing, simple modifications → Haiku

Permission table

Command Required scope
base +table-create bitable:app
base +record-list bitable:app:read
base +record-upsert bitable:app:write
im +messages-send im:message:send_as_bot
task +create task:task:write

Reference

  • lark-shared — Authentication, permissions (required reading)
  • lark-base — +table-create、+record-list、+record-upsert Detailed usage
  • lark-im — +messages-send Detailed usage
  • lark-task — +create Detailed usage