Loading...
Loading...
This skill is used when users request to draw charts in Feishu Cloud Docs, or use Feishu Whiteboard to draw architecture diagrams, flowcharts, mind maps, sequence diagrams, or other visual charts.
npx skill4agent add larksuite/cli lark-whiteboard[!NOTE] Environment Dependencies: Drawing whiteboard requires(Whiteboard Node.js CLI tool) and@larksuite/whiteboard-cli(LarkSuite CLI tool). If execution fails, install manually and retry:lark-clinpm install -g @larksuite/whiteboard-cli@^0.1.0
[!IMPORTANT] Be sure to obtain user consent before executingto install new dependencies!npm install
This is a whiteboard, not a web page. Whiteboard allows free placement of elements on an infinite canvas, and flex layout is an optional enhancement.
Step 1: Routing & Knowledge Reading
- Determine rendering path (see routing table): Mermaid or DSL?
- Read corresponding scene guide — understand structural features and layout strategies
- Confirm layout strategy (see quick judgment below) and construction method
- Read references/ core modules — syntax, layout, color scheme, typesetting, connections
Step 2: Generate Complete DSL (Including Colors)
- Plan information volume and grouping according to content.md
- Select layout mode and spacing according to layout.md
- Apply colors according to style.md (use default classic color palette if not specified by user)
- Output complete JSON according to schema.md syntax
- Refer to connectors.md for connections and typography.md for typesetting
Note: For some graphics (fishbone/flywheel/bar/line charts, etc.), write .js scripts according to scene guide templates to generate JSON:
- node xxx.js → output JSON file
- Use the generated JSON file to proceed to Step 3
Step 3: Rendering & Review → Delivery
- Self-check before rendering (see checklist below)
- Render PNG and check:
· Is information complete? Is layout reasonable? Is color scheme coordinated?
· Is text not truncated? Are connections not crossing?
- If there are issues → fix according to symptom table → re-render (max 2 rounds)
- If serious issues remain after 2 rounds → consider using Mermaid path as fallback
- If no issues → deliver:
· If user requests upload to Feishu → follow instructions in "Upload to Feishu Whiteboard" section below
· If user doesn't specify → display PNG image to user| Judgment Condition | Layout Strategy | Construction Method |
|---|---|---|
| Clear hierarchical structure (user layer → service layer → data layer) | Flex Layered | Write JSON directly |
| Spatial position carries information (geography, topology, angle) | Pure Absolute Positioning | Write script to calculate coordinates (node xxx.js) |
| Multiple independent modules connected in parallel | Hybrid (Island-style) | Write JSON directly + height estimation assistance |
| Uncertain | Default Flex (most secure) | Write JSON directly |
Construction method is a strong constraint: When the scene guide requires "script generation", you must first write a script (.js) and execute it withto output the JSON file. Coordinates for absolute positioning scenarios (fishbone diagrams, flywheel diagrams, bar charts, line charts, etc.) require mathematical calculation; manually writing JSON can easily lead to node overlap or connection penetration.node
| Chart Type | Path | Reason |
|---|---|---|
| Mind Map | Mermaid | Automatic layout for radial structure |
| Sequence Diagram | Mermaid | Automatic arrangement of participants + messages |
| Class Diagram | Mermaid | Automatic layout for class relationships |
| Pie Chart | Mermaid | Natively supported by Mermaid |
| Flowchart | Mermaid | Stable structure generation via Mermaid syntax |
| All other types | DSL | Precise control over style and layout |
scenes/mermaid.md.mmd| Module | File | Description |
|---|---|---|
| DSL Syntax | | Node types, attributes, size values |
| Content Planning | | Information extraction, density decision, connection prediction |
| Layout System | | Grid methodology, Flex mapping, spacing rules |
| Typesetting Rules | | Font size hierarchy, alignment, line spacing |
| Connection System | | Topology planning, anchor point selection |
| Color Scheme System | | Multiple color palettes, visual hierarchy |
| Chart Type | File | Applicable Scenario |
|---|---|---|
| Architecture Diagram | | Layered architecture, microservice architecture |
| Organizational Chart | | Company organization, tree hierarchy |
| Comparison Chart | | Solution comparison, feature matrix |
| Fishbone Diagram | | Causal analysis, root cause analysis |
| Bar Chart | | Bar chart, horizontal bar chart |
| Line Chart | | Line chart, trend chart |
| Treemap | | Rectangular treemap, hierarchical proportion |
| Funnel Chart | | Conversion funnel, sales funnel |
| Pyramid Chart | | Hierarchical structure, demand hierarchy |
| Cycle/Flywheel Chart | | Growth flywheel, closed-loop link |
| Milestone | | Timeline, version evolution |
| Mermaid | | Mind map, sequence diagram, class diagram, pie chart, flowchart |
npx -y @larksuite/whiteboard-cli@^0.1.0 -i my-diagram.json -o ./images/my-diagram.png # DSL Path
npx -y @larksuite/whiteboard-cli@^0.1.0 -i diagram.mmd -o ./images/diagram.png # Mermaid Path
npx -y @larksuite/whiteboard-cli@^0.1.0 -i skeleton.json -o ./images/step1.png -l coords.json # Two-stage (extract coordinates)Upload requires Feishu authentication. When encountering authentication or permission errors, readto learn about login and permission handling.../lark-shared/SKILL.md
| What User Provided | How to Obtain Token |
|---|---|
Whiteboard Token ( | Use directly |
| Document URL or doc_id, with existing whiteboard in document | |
| Document URL or doc_id, need to create new whiteboard | |
../lark-doc/SKILL.md[!CAUTION] MANDATORY PRE-FLIGHT CHECK When you want to write content to an existing whiteboard Token, never execute the upload command directly! You must strictly follow these two steps: Enforce Dry Run (Status Detection) You must first addparameters to the command to detect the current state of the whiteboard. Example command:--overwrite --dry-runbashnpx -y @larksuite/whiteboard-cli@^0.1.0 --to openapi -i <input file> --format json | lark-cli docs +whiteboard-update --whiteboard-token <Token> --overwrite --dry-run --as userParse Results and Intercept
- Carefully read the Dry Run output logs.
- If the log contains
: This means the whiteboard is not empty, and the current operation will overwrite and destroy the user's original chart!XX whiteboard nodes will be deleted- You must stop the operation immediately, and confirm with the user via the
tool (or directly reply): "The target whiteboard is currently not empty. Continuing the update will clear the original XX nodes. Are you sure you want to overwrite?"AskUserQuestion- Only after the user explicitly authorizes "agree to overwrite" can you remove
and execute the upload.--dry-run- The user may request you to update the whiteboard content without overwriting; in this case, remove the
and--overwriteparameters before uploading.--dry-run
npx -y @larksuite/whiteboard-cli@^0.1.0 --to openapi -i <input file> --format json | lark-cli docs +whiteboard-update --whiteboard-token <Whiteboard Token> --yes --as userOnce uploaded, the whiteboard cannot be modified. To upload as an application identity, replacewith--as user. If the whiteboard is not empty, first add--as botto check the number of nodes to be deleted, confirm with the user, then remove--overwrite --dry-runto execute.--dry-run
| Observed Issue | What to Modify |
|---|---|
| Text truncated | Change height to fit-content |
| Text overflows container right side | Increase width, or shorten text |
| Nodes overlap and stick together | Increase gap |
| Nodes are crowded together | Increase padding and gap |
| Connections pass through nodes | Adjust fromAnchor/toAnchor or increase spacing |
| Large blank areas | Reduce outer frame width |
| Text and background color are too similar | Adjust fillColor or textColor |
| Overall layout is left/right biased | Adjust x coordinate of absolute positioning to center content |
Most frequently violated rules that must be followed even without reading sub-module files.
'fit-content'fill-containerlayout: 'none'layout: 'none'{ "type": "frame", "layout": "vertical", "children": [
{ "type": "rect", "x": 100, "y": 0, "text": "Chengdu" },
{ "type": "rect", "x": 540, "y": 0, "text": "Kangding" }
]}layout: "none"