lark-whiteboard
SkillCommunityTranslated from ChineseThis skill enables AI agents to interact with Lark Whiteboards for creating, querying, and updating diagrams. It supports various formats including Mermaid, PlantUML, and raw JSON structures to facilitate automated visual documentation.
npx skills add open.feishu.cn/lark-whiteboard[!IMPORTANT]
- Run
lark-cli --versionto confirm availability, no need to ask the user.- Run
npx -y @larksuite/whiteboard-cli@^0.2.11 -vto confirm availability, no need to ask the user.
CRITICAL, Before starting, you MUST use the Read tool to read ../lark-shared/SKILL.md, which contains authentication and permission handling.
Quick Decision
| User Requirement | Action |
|---|---|
| View whiteboard content / Export as image | +query --output_as image |
| Get Mermaid/PlantUML code of the whiteboard | +query --output_as code |
| Check if the whiteboard was drawn by code | +query --output_as code |
| Modify node text/color (simple changes) | +query --output_as raw → Manually edit JSON → +update --input_format raw |
| User has already provided Mermaid/PlantUML code, or explicitly specified the format | Generate/use code yourself → +update --input_format mermaid/plantuml |
| Draw complex charts (architecture/flow/org, etc.) | → § Creation Workflow |
| Modify/redraw existing complex whiteboard | → § Modification Workflow |
Shortcuts
| Shortcut | Description |
|---|---|
+query | Query whiteboard, export as preview image, code, or raw node structure |
+update | Update whiteboard, supports PlantUML, Mermaid, or OpenAPI native format |
Creation Workflow
This workflow is used for creating a whiteboard independently. When creating multiple whiteboards in batches within a document, lark-doc is responsible for scheduling. See
references/lark-doc-whiteboard.mdin thelark-docskill.
Step 1: Get board_token
| What the user provided | How to obtain |
|---|---|
Provided whiteboard token (wbcnXXX) directly | Use directly |
| Document URL or doc_id, whiteboard already exists in doc | lark-cli docs +fetch --api-version v2 --doc <URL> --as user, extract from the returned <whiteboard token="xxx"/> |
| Document URL or doc_id, need to create a new whiteboard | lark-cli docs +update --api-version v2 --doc <doc_id> --command append --content '<whiteboard type="blank"></whiteboard>' --as user, obtain from the response data.new_blocks[0].block_token (the one where block_type == "whiteboard"; see lark-doc SKILL.md for parameter details) |
Step 2: Render & Write
→ Proceed to the § Render & Write Whiteboard section, and return the result to the user directly after completing the process.
Modification Workflow
Step 1: Get board_token (Same as Creation Workflow Step 1)
Step 2: Determine modification strategy
+query --output_as code
├─ Returns Mermaid/PlantUML code
│ → Modify the original code → +update --input_format mermaid/plantuml
├─ No code (Whiteboard drawn via DSL or other methods)
│ ├─ Only change text/color → +query --output_as raw → Manually edit JSON → +update --input_format raw
│ └─ Redraw/Structural adjustment → +query --output_as image → View image then proceed to [§ Render & Write Whiteboard]
└─ User has explicit requirements → Prioritize user requirements
Render & Write Whiteboard
Rendering Routing
State your identity first: Based on the training source, which family do you belong to? Claude / Gemini / GPT / GLM / Doubao or Seed / Other. Your identity determines the SVG / DSL routing (different families have uneven capabilities for these two expression languages), do not skip this step.
Then select the path based on chart type × identity, read the corresponding file and execute according to its complete workflow (including reading scene guides, generating content, rendering review, and delivery):
| Chart Type | Identity | Path |
|---|---|---|
| Mind map, flowchart, sequence diagram, class diagram, pie chart, Gantt chart | Any identity | routes/mermaid.md |
| Other charts | Claude / Gemini / GPT / GLM | routes/svg.md |
| Other charts | Doubao / Seed / Other | routes/dsl.md |
⚠️ SVG path failure fallback: When following
routes/svg.md, if one of the following occurs → Discard current SVG, switch to readingroutes/dsl.mdand redraw from scratch, do not patch line by line:
- Rendering command throws an error directly (syntax-level crash, not a
--checkwarn/error)- Two rounds of rewriting still fail to eliminate the
--checktext-overflowerror- Visual inspection shows severe PNG distortion (large areas of text overflow, elements overlapping and obscuring key information, overall layout collapse)
SVG source patching often introduces new bugs, switching to DSL and redrawing from scratch is usually more stable. This is a hard fallback for SVG path freedom, do not intrude into the creation process of
routes/svg.md.
Artifact Specifications
Artifact directory: ./diagrams/YYYY-MM-DDTHHMMSS/ (local time, without colons or timezone suffix). If the user specifies a path, follow the user's preference.
Fixed filenames within the directory:
diagram.svg ← SVG source (SVG path)
diagram.mmd ← Mermaid source (Mermaid path)
diagram.json ← DSL source file (DSL path) / OpenAPI JSON (exported from diagram.svg for SVG path)
diagram.gen.cjs ← Coordinate calculation script (only for DSL script construction method)
diagram.png ← Rendering result
Write to Whiteboard
Regarding --overwrite In the whiteboard update command, if the --overwrite flag is not included, it performs an incremental update. If the whiteboard already contains content, the new content might overlap with existing content, causing issues. Therefore, if you need to update the entire whiteboard content, you must include the --overwrite flag for an overwrite update.
npx -y @larksuite/whiteboard-cli@^0.2.11 -i <artifact file> --to openapi --format json \
| lark-cli whiteboard +update \
--whiteboard-token <Token> \
--source - --input_format raw \
--idempotent-token <10+ character unique string> \
--as user \
--overwrite
--idempotent-tokenmust be at least 10 characters. It is recommended to use a timestamp + identifier (e.g.,1744800000-board-1) to avoid duplicate writes due to retries. If you need to upload with bot identity, replace--as userwith--as bot.
[!IMPORTANT]
- 运行
lark-cli --version,确认可用,无需询问用户。- 运行
npx -y @larksuite/whiteboard-cli@^0.2.11 -v,确认可用,无需询问用户。
CRITICAL — 开始前 MUST 先用 Read 工具读取 ../lark-shared/SKILL.md,其中包含认证、权限处理
快速决策
| 用户需求 | 行动 |
|---|---|
| 查看画板内容 / 导出图片 | +query --output_as image |
| 获取画板的 Mermaid/PlantUML 代码 | +query --output_as code |
| 检查画板是否由代码绘制 | +query --output_as code |
| 修改节点文字/颜色(简单改动) | +query --output_as raw → 手动改 JSON → +update --input_format raw |
| 用户已提供 Mermaid/PlantUML 代码,或明确指定用该格式 | 自己生成/使用代码 → +update --input_format mermaid/plantuml |
| 绘制复杂图表(架构/流程/组织等) | → § 创作 Workflow |
| 修改/重绘已有复杂画板 | → § 修改 Workflow |
Shortcuts
创作 Workflow
此 workflow 用于独立创作一个画板。 需要在文档中批量创建多个画板时,由 lark-doc 负责调度,见
lark-doc技能的references/lark-doc-whiteboard.md。
Step 1:获取 board_token
| 用户给了什么 | 怎么获取 |
|---|---|
直接给了 whiteboard token(wbcnXXX) | 直接使用 |
| 文档 URL 或 doc_id,文档中已有画板 | lark-cli docs +fetch --api-version v2 --doc <URL> --as user,从返回的 <whiteboard token="xxx"/> 提取 |
| 文档 URL 或 doc_id,需要新建画板 | lark-cli docs +update --api-version v2 --doc <doc_id> --command append --content '<whiteboard type="blank"></whiteboard>' --as user,从响应 data.new_blocks[0].block_token 取得(block_type == "whiteboard" 的那条;参数详见 lark-doc SKILL.md) |
Step 2:渲染 & 写入
→ 进入 § 渲染 & 写入画板 章节,按流程完成后直接返回结果给用户。
修改 Workflow
Step 1:获取 board_token(同创作 Workflow Step 1)
Step 2:判断修改策略
+query --output_as code
├─ 返回 Mermaid/PlantUML 代码
│ → 在原代码上修改 → +update --input_format mermaid/plantuml
├─ 无代码(DSL 或其他方式绘制的画板)
│ ├─ 只改文字/颜色 → +query --output_as raw → 手动改 JSON → +update --input_format raw
│ └─ 重绘/结构调整 → +query --output_as image → 看图后进入 [§ 渲染 & 写入画板]
└─ 用户有明确要求 → 以用户要求优先
渲染 & 写入画板
渲染路由
先自报身份:按训练来源,你属于哪一家?Claude / Gemini / GPT / GLM / Doubao 或 Seed / Other。身份决定 SVG / DSL 分流(不同家族对这两种表达语言的能力不均衡),不要跳过这一步。
然后按图表类型 × 身份选路径,读对应文件按其完整 workflow 执行(含读 scene 指南、生成内容、渲染审查、交付):
| 图表类型 | 身份 | 路径 |
|---|---|---|
| 思维导图、流程图、时序图、类图、饼图、甘特图 | 任何身份 | routes/mermaid.md |
| 其他图表 | Claude / Gemini / GPT / GLM | routes/svg.md |
| 其他图表 | Doubao / Seed / Other | routes/dsl.md |
⚠️ SVG 路径失败回退:走
routes/svg.md时,碰到以下情况之一 → 丢弃当前 SVG,改读routes/dsl.md从零重画,不要逐行修补:
- 渲染命令直接报错(语法级崩溃,不是
--check的 warn/error)- 两轮改写仍无法消除
--check的text-overflowerror- 目测 PNG 视觉严重错乱(文字大面积溢出、元素重叠压住关键信息、布局整体崩溃)
SVG 源码修补常常引入新 bug,换 DSL 从零重画往往更稳。这是 SVG 路径自由发挥的硬兜底,不要侵入
routes/svg.md的创作流程。
产物规范
产物目录:./diagrams/YYYY-MM-DDTHHMMSS/(本地时间,不含冒号和时区后缀)。如用户指定路径,以用户为准。
目录内固定文件名:
diagram.svg ← SVG 源码(SVG 路径)
diagram.mmd ← Mermaid 源码(Mermaid 路径)
diagram.json ← DSL 源文件(DSL 路径) / OpenAPI JSON(SVG 路径从 diagram.svg 导出)
diagram.gen.cjs ← 坐标计算脚本(仅 DSL 脚本构建方式)
diagram.png ← 渲染结果
写入画板
关于 --overwrite 画板更新命令中,若不携带 --overwrite flag,则是增量更新画板内容,若画板内已有内容的话,新增内容可能会和已有内容重叠,导致问题。 因此,若需要整体更新画板内容,需携带 --overwrite flag 覆盖式更新。
npx -y @larksuite/whiteboard-cli@^0.2.11 -i <产物文件> --to openapi --format json \
| lark-cli whiteboard +update \
--whiteboard-token <Token> \
--source - --input_format raw \
--idempotent-token <10+字符唯一串> \
--as user \
--overwrite
--idempotent-token最少 10 字符,建议用时间戳+标识拼接(如1744800000-board-1),避免重试导致重复写入。 如需应用身份上传,将--as user替换为--as bot。
Installs
201,617First seen
Jun 10, 2026
Auto-fetched from GitHub .
Stats via skills.sh.
Skills similar to lark-whiteboard:
Installs
Installs
Installs