SuperAPI AI Directory

lark-approval

Office & productivity

View repository

Updated 10-14 16:54

About this skill

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

All commands default to --as user(approval is a human action). Before calling, read the corresponding file under references as needed to check the parameter structure; do not guess fields;references is the primary source of information, and only for native / advanced scenarios not covered by the reference, additionally use lark-cli ... --help、lark-cli schema and other methods to supplement and confirm fields.

Routing priority (first determine whether it is an approval, then choose the command)

Approval to-dos are not Feishu tasks.As long as the user's core object is an approval document / approval to-do / approval instance, preferentially use lark-approval, and do not defer to lark-task。

Clearly belongs to lark-approval high-priority semantics

When any of the following semantics appear, preferentially use lark-approval:

  • Approval to-do / approval document / approval instance / approval comment / approval definition
  • Approve / reject / transfer / send back / withdraw / urge / add approver / cc
  • To-do list / to-do documents / initiated approvals / completed approvals / approval details / editable upon approval

Decision rule: As long as the final action is to approve, reject, transfer, send back, withdraw, urge, add approver, cc, view details, or view initiated/completed/to-do items on an approval document, it belongs to lark-approval. Only when the user is handlingnon-approval tasks/to-dosdoes it go through lark-task。

Which command to choose

What to do Command Read reference as needed
Search initiable definitions approvals search lark-approval-approvals-search.md
View approval definition details/confirm form and process before submitting approvals get lark-approval-approvals-get.md
Initiate a native approval instance/submit a leave approval/submit an expense approval/create an approval instance instances create lark-approval-initiate.md
View/search to-dos, completed items tasks query(topic: 1 to-do, 2 completed, 17 unread, 18 read) lark-approval-tasks-query.md
View form/progress/current node instances get lark-approval-instances-get.md
Approve approval tasks approve lark-approval-tasks-approve.md
Reject approval tasks reject lark-approval-tasks-reject.md
Transfer approval tasks transfer lark-approval-tasks-transfer.md
Add approver to approval tasks add_sign lark-approval-tasks-add-sign.md
Send approval back tasks rollback lark-approval-tasks-rollback.md
Urge approval tasks remind lark-approval-tasks-remind.md
Withdraw an initiated approval instances cancel lark-approval-instances-cancel.md
Add a cc to an approval instance instances cc lark-approval-instances-cc.md
Search initiated approvals by definition/keyword instances initiated lark-approval-instances-initiated.md

Processing chain:

  • Initiate approval:approvals search -> approvals get -> instances create
  • Process approval:tasks query Get instance_code + task_id(operations must be paired together) → only when the user explicitly needs to view details, the current node, form content, or process progress, then instances get → execute the operation

Execution principles (reduce misrouting, mistaken retries, and ineffective consumption)

1) First obtain the minimum necessary information, then execute

  • When the goal is only to process to-dos, preferentially tasks query get instance_code + task_id
  • Onlywhen the user explicitly wants to view details, the current node, form content, or process progress, call instances get
  • When the user has already explicitly provided instance_code / task_id , do not first query the list and then filter

2) When the object is known, go directly to the action

  • After obtaining instance_code + task_id , preferentially directly execute tasks approve/reject/transfer/add_sign/rollback/remind
  • If there is already a sufficiently fresh query result in the same round, do not repeat tasks query
  • Do not default to the list -> filter -> detail -> write full chain; when the object is already clear, steps should be compressed

3) Error-code-driven, not blind retries

  • After a write operation fails, first look at the error code and error semantics, then decide whether to do a supplementary query or end
  • Unless the error explicitly indicates it is recoverable or requires additional parameters, do not repeatedly fire the same write operation
  • Do not retry the same failure reason multiple times in a row, to avoid runaway token usage and time consumption; retry at most once

Write operation failure handling: 1395001 decision tree

When write operations such as reject / transfer / return / withdraw / approve return 1395001(task status abnormal / write pre-check failed), handle according to the following rules:

  1. First stop blind retries, do not repeatedly submit the same write operation in succession; retry at most once
  2. Prioritize explaining from the following angles:
    • The task may have already been handled by someone else
    • The document status has changed, and the current action is no longer allowed
    • The current user no longer has the qualification to operate this task
    • The current node or document status does not support this operation
  3. If confirmation is needed, only supplement once with a status query (tasks query or instances get), do not fall into a query/write loop
  4. Finally give the user a clear conclusion and next-step suggestions, rather than continuing meaningless retries

Special note: For reject / transfer / withdraw scenarios, the above rules must be enforced even more strictly; these scenarios are the most prone to failure due to status switching.

lark-cli approval approvals search --data '{"keyword":"请假"}' --as user
lark-cli approval approvals get --params '{"approval_code":"<code>"}' --as user
lark-cli approval instances create --data '{"approval_code":"<code>","form":"[...]"}' --yes --as user
lark-cli approval tasks query --params '{"topic":"1"}' --as user
lark-cli approval tasks approve --data '{"instance_code":"<ic>","task_id":"<tid>","comment":"同意"}' --as user

Not within the scope of this skill

Create approval definitions (via the Feishu client or the approval admin console); third-party definition initiation (returns create_link, guide the user to initiate via the link); non-approval-type to-dos → lark-task