SuperAPI AI Directory

lark-slides

Office & productivity

View repository

Updated 10-16 09:50

About this skill

slides (v1)

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

CRITICAL — Before generating any XML, you MUST first use the Read tool to read xml-schema-quick-ref.md. Do not guess the XML structure from memory.

Identity Selection

Feishu Slides are usually the user's own content resources.By default, you should preferentially and explicitly use --as user(user identity) to perform slides-related operations, and always explicitly specify the identity.

  • --as user(Recommended): Create, read, and manage presentations as the currently logged-in user. Complete user authorization first before execution:
lark-cli auth login --domain slides
  • --as bot: Use only when the user explicitly requests to operate with app identity, or when the bot needs to hold/create resources. When using bot identity, additionally confirm whether the bot actually has access to the target presentation.

Execution Rules:

  1. For creating, reading, adding/deleting slides, and continuing to edit an existing PPT via a link provided by the user, by default first use --as user。
  2. If insufficient permissions occur, first check whether bot identity was mistakenly used; do not fall back to bot by default.
  3. Switch to --as bot。

Quick Start

Create a PPT containing page content with one command (recommended):

lark-cli slides +create --title "演示文稿标题" --slides '[
  "<slide xmlns=\"http://www.larkoffice.com/sml/2.0\"><style><fill><fillColor color=\"rgb(245,245,245)\"/></fill></style><data><shape type=\"text\" topLeftX=\"80\" topLeftY=\"80\" width=\"800\" height=\"100\"><content textType=\"title\"><p>页面标题</p></content></shape><shape type=\"text\" topLeftX=\"80\" topLeftY=\"200\" width=\"800\" height=\"200\"><content textType=\"body\"><p>正文内容</p><ul><li><p>要点一</p></li><li><p>要点二</p></li></ul></content></shape></data></slide>"
]'

You can also do it in two steps (first create a blank PPT, then add pages one by one). See +create reference documentation。

The above is a minimal usable example. For richer page effects (gradient backgrounds, cards, charts, tables, etc.), refer to the Workflow and XML templates below.

Must Do Before Execution

Important:references/slides_xml_schema_definition.xml is the only correct source of the XML protocol for this skill; other md files are only summaries of it and the CLI schema.

Required Reading (before each creation)

Document Description
xml-schema-quick-ref.md Quick reference for XML elements and attributes, required reading

Optional Reading (consult when needed)

Scenario Document
Need to understand the detailed XML structure xml-format-guide.md
Need CLI call examples examples.md
Need to reference the XML of a real PPT slides_demo.xml
Need to use complex elements such as table/chart slides_xml_schema_definition.xml(Full Schema)
Need to understand the detailed parameters of a command Reference documentation for the corresponding command (see the Reference Documentation section below)

Workflow

This is a presentation, not a document. Each slide is an independent visual canvas; information density should be low, and the layout should leave whitespace.

Step 1: 需求澄清 & 读取知识
  - 澄清用户需求:主题、受众、页数、风格偏好
  - 如果用户没有明确风格,根据主题推荐(见下方风格判断表)
  - 读取 XML Schema 参考:
    · xml-schema-quick-ref.md — 元素和属性速查
    · xml-format-guide.md — 详细结构与示例
    · slides_demo.xml — 真实 XML 示例

Step 2: 生成大纲 → 用户确认 → 创建
  - 生成结构化大纲(每页标题 + 要点 + 布局描述),交给用户确认
  - 10 页以内:用 slides +create --slides '[...]' 一步创建 PPT 并添加所有页面
  - 超过 10 页:先 `slides +create` 创建空白 PPT,再用 `xml_presentation.slide.create` 逐页添加
  - 每页 slide 需要完整的 XML:背景、文本、图形、配色
  - 复杂元素(table、chart)需参考 XSD 原文

Step 3: 审查 & 交付
  - 创建完成后,用 xml_presentations.get 读取全文 XML,确认:
    · 页数是否正确?每页内容是否完整?
    · 配色是否统一?字号层级是否合理?
  - 有问题 → 用 xml_presentation.slide.delete 删除问题页,重新创建
  - 没问题 → 交付:告知用户演示文稿 ID 和访问方式

jq Command Template (used when editing an existing PPT)

For creating a new PPT, it is recommended to use +create --slides. The following jq template applies to the scenario of appending pages to an existing presentation and can avoid manually escaping double quotes:

lark-cli slides xml_presentation.slide create \
  --as user \
  --params '{"xml_presentation_id":"YOUR_ID"}' \
  --data "$(jq -n --arg content '<slide xmlns="http://www.larkoffice.com/sml/2.0">
  <style><fill><fillColor color="BACKGROUND_COLOR"/></fill></style>
  <data>
    在这里放置 shape、line、table、chart 等元素
  </data>
</slide>' '{slide:{content:$content}}')"

Style Quick Decision Table

Note: Gradients must use the rgba() format with percentage stops, such as linear-gradient(135deg,rgba(15,23,42,1) 0%,rgba(56,97,140,1) 100%). Using rgb() Or omitting the dock point will cause the server to fall back to white.

Scenario/Theme Recommended Style Background Primary Color Text Color
Tech/AI/Product Dark Tech Style Dark Blue Gradient linear-gradient(135deg,rgba(15,23,42,1) 0%,rgba(56,97,140,1) 100%) Blue Series rgb(59,130,246) White
Business Report/Quarterly Summary Light Business Style Light Gray rgb(248,250,252) Dark Blue rgb(30,60,114) Dark Gray rgb(30,41,59)
Education/Training Fresh and Bright Style White rgb(255,255,255) Green Series rgb(34,197,94) Dark Gray rgb(51,65,85)
Creative/Design Gradient Vibrant Style Purple-Pink Gradient linear-gradient(135deg,rgba(88,28,135,1) 0%,rgba(190,24,93,1) 100%) Pink-Purple Series White
Weekly Report/Daily Report Minimalist Professional Style Light Gray rgb(248,250,252) + Top Colorful Gradient Bar Blue rgb(59,130,246) Dark rgb(15,23,42)
User did not specify Default Minimalist Professional Style Same as above Same as above Same as above

Page Layout Suggestions

Page Type Layout Key Points
Cover Page Centered large title + subtitle + bottom information, background uses gradient or dark color
Data Overview Page Metric cards in a horizontal row (rect background + large numbers + small description), list or chart below
Content Page Left vertical line decoration + title, columns or list below
Comparison/Table Page table element or side-by-side cards, header with dark background and white text
Chart Page chart element (column/line/pie), with text description
Closing Page Centered thank-you message + decorative line, style echoes the cover page

Outline Template

Use the following format when generating the outline, and present it to the user for confirmation:

[PPT 标题] — [定位描述],面向 [目标受众]

页面结构(N 页):
1. 封面页:[标题文案]
2. [页面主题]:[要点1]、[要点2]、[要点3]
3. [页面主题]:[要点描述]
...
N. 结尾页:[结尾文案]

风格:[配色方案],[排版风格]

Common Slide XML Templates

Templates ready to copy and use (cover page, content page, data card page, closing page):slide-templates.md


Core Concepts

URL Format and Token

URL Format Example Token Type Handling Method
/slides/ https://example.larkoffice.com/slides/xxxxxxxxxxxxx xml_presentation_id The token in the URL path is directly used as xml_presentation_id usage
/wiki/ https://example.larkoffice.com/wiki/wikcnxxxxxxxxx wiki_token ⚠️ Cannot be used directly, you need to query first to obtain the real obj_token

Wiki Link Special Handling (Critical!)

Knowledge base link (/wiki/TOKEN) may actually correspond to different types of documents such as cloud documents, spreadsheets, slides, etc.You cannot directly assume that the token in the URL is xml_presentation_id, you must first query the actual type and real token.

Processing Flow

  1. Use wiki.spaces.get_node to query node information

    lark-cli wiki spaces get_node --as user --params '{"token":"wiki_token"}'
    
  2. Extract key information from the returned result

    • node.obj_type: document type, slides correspond to slides
    • node.obj_token:real presentation token(for subsequent operations)
    • node.title: document title
  3. Confirm obj_type as slides after, use obj_token as xml_presentation_id

Query example

# 查询 wiki 节点
lark-cli wiki spaces get_node --as user --params '{"token":"wikcnxxxxxxxxx"}'

Example return result:

{
   "node": {
      "obj_type": "slides",
      "obj_token": "xxxxxxxxxxxx",
      "title": "2026 产品年度总结",
      "node_type": "origin",
      "space_id": "1234567890"
   }
}
# 用 obj_token 读取幻灯片内容
lark-cli slides xml_presentations get --as user --params '{"xml_presentation_id":"xxxxxxxxxxxx"}'

Resource relationships

Wiki Space (知识空间)
└── Wiki Node (知识库节点, obj_type: slides)
    └── obj_token → xml_presentation_id

Slides (演示文稿)
├── xml_presentation_id (演示文稿唯一标识)
├── revision_id (版本号)
└── Slide (幻灯片页面)
    └── slide_id (页面唯一标识)

Shortcuts (recommended, use first)

A Shortcut is a high-level wrapper for common operations (lark-cli slides +<verb> [flags]). Operations that have a Shortcut should use it first.

Shortcut Description
+create Create PPT (optionally --slides add a page in one step), bot mode authorizes automatically

API Resources

lark-cli schema slides.<resource>.<method>    # 调用 API 前必须先查看参数结构
lark-cli slides <resource> <method> [flags]  # 调用 API

Important: When using the native API, you must first run schema to view the --data / --params parameter structure; do not guess the field format.

xml_presentations

  • get — Read the full ppt information, returned in xml format

xml_presentation.slide

  • create — Create a page under the specified xml presentation
  • delete — Delete a page under the specified xml presentation

Core rules

  1. Outline first, then act: Before creating a PPT, first generate an outline and have the user confirm it to avoid rework
  2. Creation process: For 10 pages or fewer, slides +create --slides '[...]' create in one step is recommended; for more than 10 pages, first slides +create create a blank PPT, then use xml_presentation.slide.create to add pages one by one
  3. <slide> The only direct child elements are <style>、<data>、<note>: Text and graphics must be placed inside <data> inside
  4. Text is expressed through <content> : You must use: must use <content><p>...</p></content>, and cannot write text directly inside a shape
  5. Save the key ID: Subsequent operations require xml_presentation_id、slide_id、revision_id
  6. Delete with caution: Deletion is irreversible, and at least one slide must be kept

Permissions table

Method Required scope
slides +create slides:presentation:create, slides:presentation:write_only
xml_presentations.get slides:presentation:read
xml_presentation.slide.create slides:presentation:update or slides:presentation:write_only
xml_presentation.slide.delete slides:presentation:update or slides:presentation:write_only

Common error quick reference

Error code Meaning Solution
400 XML format error Check the XML syntax and ensure tags are closed
400 create content exceeds the supported range xml_presentations.create It is only used to create a blank PPT; do not pass complete slide content here
400 Request wrapping error Check whether --data is passed according to the schema xml_presentation.content or slide.content
404 Presentation does not exist Check whether xml_presentation_id is correct
404 Slide does not exist Check whether slide_id is correct
403 Insufficient permissions Check whether you have the corresponding scope
400 Cannot delete the only slide A presentation must keep at least one slide

Self-check before creation

Before generating XML page by page, quickly check:

  • Is the background color/gradient set for each page? Is the style consistent with the overall style?
  • Are titles in a large font size (28-48) and body text in a small font size (13-16), with clear hierarchy?
  • Are similar elements consistently colored? (e.g., all metric cards in the same color family, all body text in the same color)
  • Are decorative elements (dividers, color blocks, vertical lines) coordinated with the primary color?
  • Is the text box size sufficient to contain the content? (width × height)
  • of the shape type 是否正确?(for text boxes, use text, for decoration, use rect)
  • Are all XML tags properly closed? Are special characters (&、<、>) escaped?

Symptom → Fix table

Problem observed What to change
Text is truncated/cannot be fully seen Increase the shape's width or height
Elements overlap Adjust topLeftX/topLeftY, increase spacing
Large blank areas on the page Reduce element spacing, or add content to fill
Text and background color are too close Use light text on dark backgrounds, and dark text on light backgrounds
Table column widths are unreasonable Adjust colgroup in col 's width value
Chart is not displayed Check whether chartPlotArea and chartData are both included,dim1/dim2 whether the amount of data matches
Gradient background turns white Gradients must use rgba() format + percentage stops, such as linear-gradient(135deg,rgba(30,60,114,1) 0%,rgba(59,130,246,1) 100%); using rgb() or omitting stops will fall back to white
Gradient direction is wrong Adjust the angle of linear-gradient (90deg horizontal,180deg vertical,135deg diagonal)
The overall style is inconsistent Use the same background for the cover page and ending page, and keep a consistent color scheme and font size system on content pages
API returns 400 Check XML syntax: tag closure, attribute quotes, special character escaping
API returns 3350001 xml_presentation_id was not created via xml_presentations.create , or the token is incorrect

Reference documentation

Documentation Description
lark-slides-create.md +create Shortcut: create a PPT (supports --slides one-step page addition)
xml-schema-quick-ref.md XML Schema concise quick reference (required reading)
slide-templates.md Copyable Slide XML template
xml-format-guide.md Detailed XML structure and examples
examples.md CLI call examples
slides_demo.xml Complete XML of a real PPT
slides_xml_schema_definition.xml Complete Schema definition(the sole protocol basis)
lark-slides-xml-presentations-create.md Create blank PPT command details
lark-slides-xml-presentations-get.md Read PPT command details
lark-slides-xml-presentation-slide-create.md Add slide command details
lark-slides-xml-presentation-slide-delete.md Delete slide command details

Note: if the md content is inconsistent with slides_xml_schema_definition.xml or lark-cli schema slides.<resource>.<method> output, the latter two shall prevail.