SuperAPI AI Directory

lark-workflow-doc-summarizer

Office & productivity

View repository

Updated 10-16 10:16

About this skill

Document Intelligent Summary Workflow

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

Applicable Scenarios

  • "Help me summarize this document" / "What is this document about"
  • "Extract document key points" / "What is the core content of this document"
  • "Help me quickly understand this document" / "Document summary"
  • "Summarize the content in this link" / "Extract key decisions"
  • "Batch summarize these documents" / "Help me organize the document key points"

Prerequisites

Supports user identity. Before execution, ensure authorization has been granted:

lark-cli auth login --domain doc,drive,wiki

Workflow

用户指定文档 ──► 解析输入类型
                    │
         ┌──────────┼──────────┐
         ▼          ▼          ▼
     /docs/ 链接  /wiki/ 链接  doc_token
         │          │          │
         │     wiki get_node   │
         │     提取 obj_token  │
         │          │          │
         └──────────┼──────────┘
                    ▼
            docs +fetch(Markdown)
                    │
                    ▼
              AI 分段摘要
                    │
            ┌───────┼───────┐
            ▼       ▼       ▼
          要点   关键决策  待确认项
                    │
                    ▼
         结构化摘要输出(可选:写回文档)

Step 1: Parse the document source

The user may provide the following types of input:

A. Feishu document link (/docs/ or /docx/):

https://xxx.feishu.cn/docs/<doc_token>
https://xxx.feishu.cn/docx/<doc_token>

Directly extract doc_token。

B. Knowledge base link (/wiki/):

https://xxx.feishu.cn/wiki/<wiki_token>

⚠️ Important: The token of a knowledge base link cannot be used directly as a doc_token; the real type must be queried first.

# 查询 wiki 节点信息
lark-cli wiki spaces get_node --params '{"token":"<wiki_token>"}'

Extract from the returned result:

  • node.obj_type: Document type (docx/doc/sheet/bitable, etc.)
  • node.obj_token: Real document token
  • node.title: Document title

Only when obj_type is docx or doc , continue with the summary. For other types, prompt the user: "This link points to {type}, which is not currently supported for summarization."

C. Directly provide doc_token:

Proceed directly to Step 2.

Step 2: Read the document content

Refer to lark-doc/SKILL.md。

# 读取文档内容(Markdown 格式)
lark-cli docs +fetch --doc "<doc_token>" --format markdown

Long document processing: If the document content exceeds the AI context limit (usually > 50KB), adopt the following strategy:

  1. Prompt the user that the document is relatively long and will be processed in segments
  2. Split into paragraphs by major headings (# / ##)
  3. Generate summaries segment by segment, then merge at the end

Step 3: AI generates a structured summary

After analyzing the document content, output according to the following structure:

## 📄 文档摘要:{文档标题}

### 📌 核心要点
1. **{要点 1}** — 一句话说明
2. **{要点 2}** — 一句话说明
3. **{要点 3}** — 一句话说明

### 🔑 关键决策
- {决策 1}:选择了方案 X,原因是...
- {决策 2}:确定了时间节点为...

### ❓ 待确认 / 开放问题
- {问题 1}:文中提到但未给出结论
- {问题 2}:需要进一步讨论

### 📊 数据与指标(如有)
- {指标 1}:xxx
- {指标 2}:xxx

### 📝 一句话总结
> {不超过 50 字的核心总结}

Generation rules:

  1. Core key points: Extract the 3-7 most important information points, sorted by importance
  2. Key decisions: Identify decision-making content in the document (keywords such as "decide", "determine", "adopt", "choose", etc.)
  3. Items to be confirmed: Identify undecided matters (such as "to be determined", "needs discussion", "TBD", "?", "to be confirmed", etc.)
  4. Data and metrics: If the document contains numbers, percentages, KPIs, etc., extract them separately
  5. One-sentence summary: Summarize the core viewpoint of the full text

Step 4: Batch summary mode (optional)

When the user needs to batch summarize multiple documents:

# 方式 1:用户提供多个链接/token
# 串行处理每个文档(每个文档间隔 1 秒)

# 方式 2:搜索并摘要
lark-cli drive files search --data '{"search_key":"<关键词>","count":10}' --format json
# 然后对搜索结果中的文档逐个 fetch + 摘要

Advanced search syntax (v1.0.7+):

Improve the search precision of batch summaries:

  • Boolean search:"A AND B" — contains both A and B
  • Title search:"intitle:设计方案" — only search documents whose titles contain the keyword

Tip: Advanced search syntax can reduce irrelevant results and improve batch summarization efficiency.

Batch mode output:

## 批量文档摘要(共 N 篇)

### 1. {文档 1 标题}
> {一句话总结}
- 要点:...

### 2. {文档 2 标题}
> {一句话总结}
- 要点:...

### 📊 跨文档洞察
- {跨文档的共性发现}
- {矛盾或冲突点}

Step 5: Write back to document (optional, when requested by the user)

Reference lark-doc/SKILL.md。

# 在文档开头插入摘要
lark-cli docs +update --doc "<doc_token>" --mode prepend --markdown "## 📄 文档摘要\n\n<摘要内容>\n\n---\n\n"

# 或创建单独的摘要文档
lark-cli docs +create --title "摘要:{原文档标题}" --markdown "<摘要内容>"

Fault tolerance mechanism

Exception scenario Handling method
No permission for document Prompt the user to check permissions, or contact the document administrator
wiki link points to a non-document type Prompt "This link points to a {type}, summarization is not currently supported"
Document content is empty Prompt "This document has no content yet"
Document is too long (>50KB) Process in segments + merge summaries
One document fails during batch processing Record the failure and continue processing the remaining documents

Permission table

Step Command Required scope Mandatory
Read document docs +fetch docx:document:readonly ✅ Mandatory
Parse wiki wiki spaces get_node wiki:wiki:readonly Optional (for wiki links)
Search documents drive files search drive:drive:readonly Optional (batch mode)
Write back to document docs +update / docs +create docx:document:write Optional (when writing back)

Reference

  • lark-shared — Authentication, permissions (required reading)
  • lark-doc — +fetch、+create、+update Detailed usage
  • lark-wiki — Detailed usage for wiki node queries
  • lark-drive — Detailed usage for file search