lark-base
Original:🇨🇳 Chinese
Translated
Invoke this skill when you need to operate Feishu Base (multidimensional table) using lark-cli: applicable for table creation, field management, record reading/writing, view configuration, history query, as well as role/form/dashboard management; also suitable for migrating from the old +table / +field / +record syntax to the current command syntax. This skill must also be used for requirements involving field design, formula fields, lookup references, cross-table calculations, row-level derived metrics, and data analysis.
117.9kinstalls
Sourcelarksuite/cli
Added on
NPX Install
npx skill4agent add larksuite/cli lark-baseTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →base
Prerequisites: Readfirst. Mandatory before execution: Before running any../lark-shared/SKILL.mdcommand, you must read the corresponding command reference document first, then invoke the command. Naming convention: Only use commands in the form ofbase.lark-cli base +...
Agent Quick Execution Sequence
- First determine the task type
- Temporary statistics / aggregate analysis →
+data-query - Need to display results in the table long-term → formula field
- User explicitly requests lookup, or it is indeed more suitable for → lookup field
from/select/where/aggregate - Detail reading / export →
+record-list / +record-get
- Temporary statistics / aggregate analysis →
- Retrieve structure first, then write commands
- At least retrieve the current table structure first: or
+field-list+table-get - For cross-table scenarios, you must also retrieve the structure of the target table
- At least retrieve the current table structure first:
- Formula / lookup have hard thresholds
- Read the corresponding guide first
- After reading the guide, create the corresponding field
- Determine field writability before writing records
- Only write to storage fields
- System fields / formula / lookup are read-only by default
Agent Prohibited Behaviors
- Do not use as an aggregate analysis engine
+record-list - Do not create formula / lookup fields without reading the guide first
- Do not guess table names, field names, or field references in formula expressions based on natural language
- Do not use system fields, formula fields, or lookup fields as the target for
+record-upsert - Do not switch to for Base scenarios
lark-cli api GET /open-apis/bitable/v1/... - Do not look for just because
bitable.*appears in wiki parsing results; continue to useobj_type=bitablein this CLIlark-cli base +...
Basic Mental Model of Base
- Base fields are divided into three categories
- Storage fields: Store user input data, typically suitable for writing, such as text, number, date, single-select, multi-select, member, association. Exception for attachment fields: For agents, file upload must go through the
+record-upsertlink.+record-upload-attachment - System fields: Automatically maintained by the platform, read-only, typically including creation time, last update time, creator, modifier, auto-number.
- Calculated fields: Derived via expressions or cross-table rules, read-only, typically including formula fields and lookup fields.
- Storage fields: Store user input data, typically suitable for
- Determine field category before writing records — Only storage fields can be written directly; formula / lookup / creation time / update time / creator / modifier / auto-number should be treated as read-only output fields and cannot be used as parameters for .
+record-upsert - Base is not just for storing table data, it can also build-in calculations — When users put forward requirements like "statistics, comparison, ranking, text concatenation, date difference, cross-table summary, status judgment", do not default to exporting data and calculating manually; first determine whether it should be completed within Base via or formula fields.
+data-query
Analysis Path Decision
- One-time analysis / temporary query → Prioritize
+data-query- Suitable for: Group statistics, SUM / AVG / COUNT / MAX / MIN, aggregation after conditional filtering.
- Feature: Needs "results calculated this time", not to沉淀 results as fields in the table.
- Long-term reusable derived metrics / row-level calculation results → Prioritize formula fields
- Suitable for: Profit margin, whether delayed, remaining days, grading tags, derived results after cross-table summary.
- Feature: Needs to display results in Base long-term, which update automatically with records.
- Explicitly requires Lookup, or indeed suitable for modeling with source/select/where/aggregate → Use lookup fields
- Default to prioritizing formula. Only use lookup when users explicitly request it, or when the configuration is naturally more suitable for lookup.
- Raw record reading / detail export →
+record-list / +record-get- Do not use as an analysis engine; it is responsible for retrieving details, not aggregation calculations.
+record-list
- Do not use
Formula / Lookup Special Rules
- When involving formula / lookup, read the guide first, then write commands
- formula:
formula-field-guide.md - lookup:
lookup-field-guide.md
- formula:
- Guide takes precedence over creation commands
- Do not create formula / lookup fields without reading the corresponding guide first
- After reading the guide, complete the corresponding JSON and create the field
- must provide
type=formulaexpression - must provide
type=lookup, and supplementfrom / select / whereif necessaryaggregate
- Formula fields take precedence over lookup fields
- As long as the user's requirement is "calculation / conditional judgment / text processing / date difference / cross-table aggregation / value retrieval after cross-table filtering", default to trying formula first.
- Only use lookup when users explicitly mention it, or when the configuration is naturally more suitable for the lookup four-tuple.
- Table names / field names must match exactly
- Table names / field names used in formulas, lookup, data-query must come from the actual returns of /
+table-list/+table-get; guessing and rewriting based on semantics is prohibited.+field-list
- Table names / field names used in formulas, lookup, data-query must come from the actual returns of
- Retrieve structure first, then write expressions
- For formulas or lookup, always retrieve the relevant table structure first, then generate expressions / configurations; do not directly assemble field names based on user口述.
Workflow Special Rules
-
Before executing any workflow command, you must read two documents: the corresponding command document + lark-base-workflow-schema.md
- → Read lark-base-workflow-create.md + schema first
+workflow-create - → Read lark-base-workflow-update.md + schema first
+workflow-update - → Read lark-base-workflow-list.md + schema first
+workflow-list - → Read lark-base-workflow-get.md + schema first
+workflow-get - → Read lark-base-workflow-enable.md + schema first
+workflow-enable - → Read lark-base-workflow-disable.md + schema first
+workflow-disable - The schema defines all StepType enums, step structures, data formats of Trigger/Action/Branch/Loop, value reference syntax, etc.
- Prohibit guessing values based on natural language (e.g., guessing "add record" as
type); must copy the exact type name from the StepType enum in the schemaCreateTrigger
-
Confirm dependency information before creation
- First retrieve actual table names and field names via /
+table-list+field-list - Prohibit guessing table names/field names based on natural language and filling them into workflow configurations
- First retrieve actual table names and field names via
Core Rules
- Only use atomic commands — Use commands like which perform one action per command, instead of the old aggregate-style
+table-list / +table-get / +field-create / +record-upsert / +view-set-filter / +record-history-list / +base-get+table / +field / +record / +view / +history / +workspace - Read field structure before writing records — First call to retrieve field structure, then read lark-base-shortcut-record-value.md to confirm the write value format for each field type
+field-list - Check field property specifications before writing fields — First read lark-base-shortcut-field-properties.md to confirm the JSON structure for
+field-create/+field-update - Execute filter queries according to view capabilities — First read lark-base-view-set-filter.md and lark-base-record-list.md, and complete filter reading via the combination of +
+view-set-filter+record-list - Analyze records (involving analysis intentions like "highest/lowest/total/average/ranking/comparison/quantity") — First read lark-base-data-query.md, and perform server-side calculation of data filtering and aggregation via
+data-query - Aggregation analysis and data retrieval are mutually exclusive — When group statistics / SUM / MAX / AVG / COUNT are needed, must use (server-side calculation); prohibit pulling all records with
+data-queryand then calculating manually; conversely,+record-listdoes not return raw records, so data retrieval scenarios still use+data-query+record-list / +record-get - All commands are prohibited from concurrent calls —
+xxx-listcan only be executed serially+table-list / +field-list / +record-list / +view-list / +record-history-list / +role-list - Batch limit: 500 items per time — It is recommended to write to the same table serially, with a 0.5–1 second delay between batches
- Unified parameter name — Always use , do not use the old
--base-token--app-token - For requirements involving "formula / lookup reference / derived metric / cross-table calculation", prioritize field scheme judgment — First determine whether to create formula / lookup fields, or just perform a one-time
+data-query - Formula, lookup, and system fields are read-only by default — Except for maintaining field definitions via , do not use these fields as record writing targets
+field-create / +field-update - Execute renaming and deletion according to explicit intentions — can be executed directly when both the target view and new name are clear;
+view-renamecan also be executed directly when the user has clearly requested deletion and the target is clear, no need for additional confirmation, and+record-delete / +field-delete / +table-deletemust be actively added when executing the delete command; only continue to ask questions when the target is unclear--yes
Form / Questionnaire Tips
- Get questionnaire list: Use (get
+form-listfirst)form-id - Get single questionnaire: Use
+form-get - Get form / questionnaire questions: Use
+form-questions-list - Delete questionnaire / form questions: Use
+form-questions-delete - Create / update questions: Use
+form-questions-create / +form-questions-update
Intent → Command Index
| Intent | Recommended Command | Remarks |
|---|---|---|
| List / Get data tables | | Atomic command |
| Create / Update / Delete data tables | | One action per command |
| List / Get fields | | Atomic command |
| Create / Update fields | | Use |
| Create / Update formula fields | | |
| Create / Update lookup fields | | |
| List / Get records | | Atomic command; For |
| Create / Update records | | |
| Aggregate analysis / Comparison sorting / Get min/max / Filter statistics | | Do not use |
| Configure / Query views | | |
| View record history | | Query record history by table and record |
| Filter query by view | | Combined call |
| Create / Get / Copy Base | | Atomic command |
| List / Get workflows | | Atomic command |
| Create / Update workflows | | Use |
| Enable / Disable workflows | | One action per command |
| Enable / Disable advanced permissions | | Advanced permissions must be enabled to use custom roles; Disabling will invalidate existing roles |
| List / Get roles | | View role summary or complete configuration |
| Create / Update / Delete roles | | Manage custom role permissions |
| List / Get forms | | Atomic command |
| Create / Update / Delete forms | | One action per command |
| List / Create / Update / Delete form questions | | One action per command |
| List / Get dashboards | | Atomic command |
| Create / Update / Delete dashboards | | One action per command |
| List / Get dashboard Blocks | | Atomic command |
| Create / Update / Delete dashboard Blocks | | One action per command |
Operation Notes
- Unified Base token specification: Use uniformly
--base-token - Discipline for calls: Concurrent calls to
+xxx-listare prohibited; must execute serially during batch execution+table-list / +field-list / +record-list / +view-list / +record-history-list / +role-list / +dashboard-list / +dashboard-block-list / +workflow-list - limit upper limit: The maximum value of
+record-listis--limit. When more data is needed, must use pagination (increment200) to pull in batches; passing more thanoffsetat a time is prohibited200 - Determine field writability first: Only storage fields can be written; formula / lookup / system fields are read-only by default and should be skipped when writing records
- Proactively consider formula capabilities: When users say "calculate" "generate tags" "judge abnormality" "cross-table summary" "alert by date difference", first determine whether formula fields should be created instead of only returning manual analysis solutions
- Lookup is not the default first choice: Lookup is only used when users explicitly request it or it is indeed more suitable for fixed lookup models; formula is prioritized for regular calculations, cross-table aggregation and conditional judgments
- Attachment fields: If users want to "upload attachments / add files to records", only use the link (read field → read record → upload material → write back record)
+record-upload-attachment - Member fields / User fields: Pay attention to the difference between and execution identity (user / bot) during debugging
user_id_type - History usage: queries record history by
+record-history-list, and does not support full-table history scanningtable-id + record-id - Workspace status: Integrated with
+base-create / +base-get / +base-copy - Result return specification for : After successful creation or copying, the identification information of the new Base must be actively returned in the reply. If the return result contains an accessible link (such as
+base-create / +base-copy), it should also be returned togetherbase.url - Friendliness rules for :
+base-create / +base-copy,--folder-token, and--time-zoneduring copying are optional parameters. Do not interrupt the process for these optional parameters when users have no special requirements; execute creation/copy directly if possible--name - Permission handling for (bot creation): If the Base is created by an application identity (bot), after successful creation or copying, continue to use the bot identity to add
+base-create / +base-copy(administrator) permission to the currently available user (referring to the user identity that has logged in and is available in the auth module of the current CLI), and clearly state the authorization result (success / no available user / authorization failure and reason) in the reply. If authorization is not completed, provide subsequent guidance (retry authorization later or continue using bot); owner transfer must be confirmed separately, unauthorized execution is prohibitedfull_access - Dashboard usage: returns
+dashboard-createafter creation;dashboard_idof Block is passed in via JSON string, and supports reading files viadata_config@file.json - Advperm usage: Advanced permissions must be enabled via to manage roles (
+advperm-enable);+role-*is a high-risk operation, and all existing custom roles will become invalid after disabling; the operating user must be a Base administrator; read lark-base-advperm-enable.md / lark-base-advperm-disable.md first+advperm-disable - Role usage: only supports
+role-create;custom_roleuses Delta Merge (+role-updateandrole_namemust always be provided);role_typeis irreversible and only supports custom roles; role configuration supports+role-delete(Base-level copy/download),base_rule_map(table-level permissions including record/field granularity),table_rule_map(dashboard permissions),dashboard_rule_map(document permissions); read role-config.md before writing rolesdocx_rule_map - Form form-id: Obtained via ; The
+form-listreturned byidis+form-create, which can be used forform-idoperations+form-questions-* - Workflow usage: Before creating or updating a workflow, you must carefully read lark-base-workflow-schema.md to understand the structure of each trigger and node component; meanwhile, does not return the complete tree structure, so use
+workflow-listif you need to read the complete structure.+workflow-get - Data-query usage: Before using , you must read lark-base-data-query.md to understand the DSL structure, supported field types, aggregation functions and restrictions;
+data-queryin DSL must match the table field name exactly, retrieve real field names withfield_namebefore constructing+field-list - Formula / lookup usage: Before constructing expressions or where conditions, at least retrieve the current table structure first; for cross-table scenarios, retrieve the structure of the target table; guessing field names based on natural language is not allowed
- View rename confirmation rule: When the user has clearly specified "which view to rename to what name", can be executed directly without additional confirmation
+view-rename - Delete confirmation rule (records / fields / tables): If the user has clearly stated to delete and the target is clear, can be executed directly without additional confirmation; add
+record-delete / +field-delete / +table-deletedirectly when executing to pass the CLI's high-risk write check. Only use--yesor list commands to confirm when the target is ambiguous+record-get / +field-get / +table-get
Special Handling of Wiki Links (Extremely Critical!)
Knowledge base links () may correspond to different document types such as cloud documents, spreadsheets, multidimensional tables, etc. Do not directly assume that the token in the URL is the file_token; you must first query the actual type and real token.
/wiki/TOKENProcessing Flow
-
Query node information using
wiki.spaces.get_nodebashlark-cli wiki spaces get_node --params '{"token":"<wiki_token>"}' -
Extract key information from the return result
- : Document type (docx/doc/sheet/bitable/slides/file/mindnote)
node.obj_type - : Real document token (used for subsequent operations)
node.obj_token - : Document title
node.title
-
Select subsequent commands based on
obj_type| obj_type | Description | Subsequent Commands | |----------|------|-----------| || New version cloud document |docx、drive file.comments.*| |docx.*| Old version cloud document |doc| |drive file.comments.*| Spreadsheet |sheet| |sheets.*| Multidimensional table |bitable(priority); if shortcut does not cover, uselark-cli base +...; Do not switch tolark-cli base <resource> <method>| |lark-cli api /open-apis/bitable/v1/...| Slides |slides| |drive.*| File |file| |drive.*| Mind map |mindnote|drive.* -
Useparsed from wiki as Base token
obj_token- When ,
obj_type=bitableis the real token that should be used for subsequentnode.obj_tokencommands.base - That is: If the original input is a link, do not directly use
/wiki/...aswiki_token.--base-token
- When
-
If token error occurs, fallback to check wiki
- If the command returns ,
param baseToken is invalid,base_token invalid, and the user initially provided anot foundlink or/wiki/..., first suspect that "wiki token is used as base token".wiki_token - At this time, do not switch to API; immediately re-execute
bitable/v1, confirmlark-cli wiki spaces get_node, then re-executeobj_type=bitableusinglark-cli base +....node.obj_token
- If the command returns
Query Example
bash
# Query wiki node
lark-cli wiki spaces get_node --params '{"token":"Pgrr***************UnRb"}'Return result example:
json
{
"node": {
"obj_type": "docx",
"obj_token": "UAJ***************E9nic",
"title": "ai friendly test - 1 copy",
"node_type": "origin",
"space_id": "6946843325487906839"
}
}Base Link Parsing Rules
| Link Type | Format | Handling Method |
|---|---|---|
| Direct Base link | | Extract directly as |
| Wiki knowledge base link | | Call |
URL Parameter Extraction
https://{domain}/base/{base-token}?table={table-id}&view={view-id}- →
/base/{token}--base-token - →
?table={id}--table-id - →
?view={id}--view-id
Prohibited Items
- Prohibit directly passing the complete URL as the parameter
--base-token - Prohibit directly using wiki_token as
--base-token
Quick Check of Common Errors
| Error Code | Meaning | Solution |
|---|---|---|
| 1254064 | Incorrect date format | Use millisecond timestamp instead of string / second-level timestamp |
| 1254068 | Incorrect hyperlink format | Use |
| 1254066 | Member field error | Use |
| 1254045 | Field name does not exist | Check field name (including spaces, case) |
| 1254015 | Field value type mismatch | Call |
| Wiki token, workspace token or other tokens are used as | If the input comes from a |
| Formula / lookup creation failed | Guide not read or structure is invalid | Read |
| Failed to write to system fields / formula fields | Read-only fields are treated as writable | Switch to writing storage fields, and let formula / lookup / system fields automatically generate calculation results |
| 1254104 | Batch exceeds 500 items | Call in batches |
| 1254291 | Concurrent write conflict | Write serially + add delay between batches |
Reference Documents
- lark-base-shortcut-field-properties.md — JSON specification for (recommended)
+field-create/+field-update - role-config.md — Detailed explanation of role permission configuration
- lark-base-shortcut-record-value.md — Value format specification for (recommended)
+record-upsert - formula-field-guide.md — Formula field syntax, function constraints, CurrentValue rules, cross-table calculation mode (highly recommended)
- lookup-field-guide.md — Lookup field configuration rules, where/aggregate constraints, trade-off with formula
- lark-base-view-set-filter.md — View filter configuration
- lark-base-record-list.md — Record list reading and pagination
- lark-base-advperm-enable.md — to enable advanced permissions
+advperm-enable - lark-base-advperm-disable.md — to disable advanced permissions
+advperm-disable - lark-base-role-list.md — to list roles
+role-list - lark-base-role-get.md — to get role details
+role-get - lark-base-role-create.md — to create roles
+role-create - lark-base-role-update.md — to update roles
+role-update - lark-base-role-delete.md — to delete roles
+role-delete - lark-base-dashboard.md — Dashboard command index (each command has been split into independent documents)
- lark-base-dashboard-block.md — Dashboard block command index (each command has been split into independent documents)
- dashboard-block-data-config.md — Block data_config structure, chart types, filter rules
- lark-base-workflow.md — Workflow command index
- lark-base-workflow-schema.md — Detailed explanation of JSON body data structure for , including configuration rules for triggers and various nodes (highly recommended)
+workflow-create/+workflow-update - lark-base-data-query.md — aggregate analysis (DSL structure, supported field types, aggregation functions)
+data-query - examples.md — Complete operation examples (table creation, import, filter, update)
Command Groups
Mandatory before execution: After locating the command from the table below, be sure to read the corresponding command reference document first, then invoke the command.
| Command Group | Description |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |