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 create a requirements collection form" / "Create a form"
- "Collect everyone's weekly reports" / "Information collection"
- "Make a registration form" / "Registration form"
- "Help me make a feedback questionnaire" / "Make a questionnaire"
- "Create a meeting registration form" / "Data collection"
Prerequisites
Requires user identity(to create tables/forms) and bot identity(to send messages and distribute forms).
lark-cli auth login --domain base,im
Workflow
{表单主题 + 字段需求}
│
├── AI 设计表单结构 ─────────────► 根据主题生成字段方案(用户确认)
│
├── base +table-create ──────────► 创建数据表 + 字段
│ └── [降级] +field-create 逐个创建字段
│
├── base +form-create ───────────► 创建表单视图
│
├── base +form-questions-create ─► 配置表单问题(max 10/次)
│
├── base +form-get ──────────────► 获取表单链接
│
└── im +messages-send ───────────► 分发表单链接到群聊
Step 1: AI designs the form structure
Based on the form purpose described by the user, AI automatically designs the field plan. For example, if the user says "create a requirements collection form", generate the following plan:
[
{"name": "需求标题", "type": "text"},
{"name": "提出人", "type": "text"},
{"name": "优先级", "type": "select", "options": ["高", "中", "低"]},
{"name": "需求描述", "type": "text"},
{"name": "期望上线日期", "type": "datetime"},
{"name": "附件", "type": "attachment"}
]
Confirm the field plan with the user before executing the creation operation.
Step 2: Create the data table
Method 1: One-step creation (including fields)
lark-cli base +table-create \
--base-token "<base_token>" \
--name "<表名>" \
--fields '[
{"name":"需求标题","type":"text"},
{"name":"提出人","type":"text"},
{"name":"优先级","type":"select","multiple":false,"options":[{"name":"高"},{"name":"中"},{"name":"低"}]},
{"name":"需求描述","type":"text"},
{"name":"期望上线日期","type":"datetime"}
]' \
--as user
Method 2: Fallback (when the table is created successfully but fields fail)
If +table-create partially succeeds (table created but field creation failed, error code 800004135):
# 1. 获取表 ID
lark-cli base +table-list --base-token "<base_token>" --as user
# 2. 逐个创建字段(间隔 1-2 秒)
lark-cli base +field-create \
--base-token "<base_token>" \
--table-id "<table_id>" \
--json '{"field_name":"需求标题","type":1}' \
--as user
sleep 1
lark-cli base +field-create \
--base-token "<base_token>" \
--table-id "<table_id>" \
--json '{"field_name":"提出人","type":1}' \
--as user
sleep 1
Step 3: Create the form view
lark-cli base +form-create \
--base-token "<base_token>" \
--table-id "<table_id>" \
--name "<表单名称>" \
--description "请填写以下信息,提交后将自动记录到数据表中。" \
--as user
Extract from the returned result form_id。
Step 4: Configure form questions
Create at most 10 questions at a time. If there are more than 10, create them in batches.
lark-cli base +form-questions-create \
--base-token "<base_token>" \
--table-id "<table_id>" \
--form-id "<form_id>" \
--questions '[
{"type":"text","title":"需求标题","required":true},
{"type":"text","title":"提出人","required":true},
{"type":"select","title":"优先级","required":true,"multiple":false,"options":[{"name":"高","hue":"Red"},{"name":"中","hue":"Yellow"},{"name":"低","hue":"Green"}]},
{"type":"text","title":"需求描述","required":true},
{"type":"text","title":"期望上线日期","required":false}
]' \
--as user
Supported question types:
| type | Description | Optional style |
|---|---|---|
text |
Single-line text | plain, phone, url, email |
number |
Number | rating(rating) |
select |
Single choice/Multiple choice | — |
datetime |
Date and time | format: "yyyy/MM/dd" |
user |
Select personnel | — |
attachment |
Attachment upload | — |
location |
Location | — |
Rating field example:
{"type":"number","title":"满意度评分","style":{"type":"rating","icon":"star","min":1,"max":5},"required":true}
Step 5: Get the form link
lark-cli base +form-get \
--base-token "<base_token>" \
--table-id "<table_id>" \
--form-id "<form_id>" \
--as user
Extract the form's share link from the returned result (share_url or form_url)。
Step 6: Distribute the form link
Send to group chat
lark-cli im +messages-send \
--chat-id "<chat_id>" \
--markdown "## {表单名称}
{表单描述}
请点击以下链接填写:{表单链接}
截止时间:{截止日期}" \
--as bot
Send to individual
lark-cli im +messages-send \
--user-id "<open_id>" \
--markdown "请填写 {表单名称}:{表单链接}" \
--as bot
Fallback Strategy
| Scenario | Fallback Plan |
|---|---|
| +table-create field failure | Fall back to +field-create to create them one by one |
| +form-create failure | Check whether base_token and table_id are correct |
| More than 10 questions | Create in batches, 10 at a time |
| base_token not provided | Ask the user to provide it, or use +base-create to create a new one |
| Distribution failure | Output the form link so the user can share it manually |
Permission Table
| Command | Required scope |
|---|---|
base +table-create |
bitable:app |
base +field-create |
bitable:app |
base +form-create |
bitable:app |
base +form-questions-create |
bitable:app |
base +form-get |
bitable:app:readonly |
im +messages-send |
im:message |
References
../lark-base/SKILL.md— Multi-dimensional table atomic operations../lark-im/SKILL.md— Message sending