lark-slides
SkillCommunityTranslated from ChineseThis skill enables AI agents to create and manage Lark Slides presentations. It supports creating new presentations, reading slide content, and performing granular edits like replacing or inserting elements on specific pages.
npx skills add open.feishu.cn/lark-slidesslides (v1)
Quick Reference
| User Request | Priority Action | Key Document / Command |
|---|---|---|
| Create new PPT | Plan slide_plan.json first, then choose one-step or two-step creation based on complexity | planning-layer.md, visual-planning.md, asset-planning.md, slides +create |
| Major page rewrite | Read existing XML first, write new plan, then replace or rebuild relevant pages | xml_presentations.get, +replace-slide, lark-slides-edit-workflows.md |
| Edit single title, text block, image, or local element | Prioritize block-level replacement/insertion, do not change page order | slides +replace-slide, lark-slides-replace-slide.md |
| Read or analyze existing PPT | Parse slides/wiki token, read full text or single-page XML, save xml_presentation_id, slide_id, revision_id | xml_presentations.get, xml_presentation.slide.get |
| Upload or use images | Upload as file_token first, writing http(s) external links is prohibited | slides +media-upload, or @./path placeholder for +create --slides |
| Draw charts with data series (bar/column/line/area/radar/pie) in slide | Use native <chart> element | xml-schema-quick-ref.md |
| Draw flowcharts, sequence diagrams, architecture diagrams, scatter plots, funnel charts, or decorative patterns in slide | Must read reference document with Read tool first, then generate <whiteboard> element | lark-slides-whiteboard.md |
| Use semantic icons | Search IconPark first, then write <icon iconType="..."> | iconpark_tool.py search → resolve, iconpark.md |
| User mentions templates, themes, layouts | Search templates first, then summarize, crop skeleton if necessary | template_tool.py search → summarize → extract |
| Creation failure, blank page, 3350001, layout anomaly | Read status first, then fix according to troubleshooting checklist, do not assume original operation was atomically successful | troubleshooting.md, validation-checklist.md |
CRITICAL, Before starting, MUST read ../lark-shared/SKILL.md with the Read tool. Authentication, permissions, and global parameters are all based on lark-shared.
CRITICAL, Before generating any XML, MUST read xml-schema-quick-ref.md with the Read tool. Guessing XML structure from memory is prohibited.
CRITICAL, When creating a new presentation or performing a major page rewrite, MUST generate .lark-slides/plan/<deck-or-task-id>/slide_plan.json before generating XML. Create the corresponding directory first. See planning-layer.md for planning layer rules and intermediate artifact lifecycles. Small edits to existing pages, such as replacing a single title or inserting a block, are exempt.
CRITICAL, When creating a new presentation or performing a major page rewrite, MUST read visual-planning.md before generating XML to ensure layout_type, visual_focus, and text_density actually change the page geometry, main visual, and text volume.
CRITICAL, When creating a new presentation or performing a major page rewrite, planning asset_need MUST follow asset-planning.md: perform metadata planning only, must include fallback_if_missing, and must not require real searching, downloading, or uploading of assets.
CRITICAL, After creation or major rewrite, MUST perform explicit validation according to validation-checklist.md: read full-text XML, verify page count and key elements, check for blank/broken pages, obvious overflow, and layout risks; use scripts/xml_text_overlap_lint.py for XML syntax and text overlap static checks.
CRITICAL, When self-checking before creation or troubleshooting failures, MUST check XML escaping, structure, shell truncation, image tokens, 3350001, and layout risks according to troubleshooting.md.
CRITICAL, If the user mentions "template", "apply template", "reference a certain theme/style/layout", or if the user request clearly falls within existing scenario templates (e.g., work reports, product introductions, business plans, training, promotion reports, etc.), MUST first perform template search using search in scripts/template_tool.py; provide 2-3 best-matching template candidates for the user to choose from by default. After locking in a template, use summarize to obtain theme and layout summaries; only use extract to crop target page-type XML when a layout skeleton is needed. Do not read the full template XML directly.
[!NOTE]
scripts/template_tool.pyrequires Python 3.references/template-index.jsonis a script cache/lightweight routing index, not a document for the agent to read by default;assets/templates/*.xmlare machine resources and should only be summarized or cropped via scripts, not read in full.
CRITICAL, When using templates to generate or rewrite pages, MUST summarize the target page type first; only extract when a specific layout skeleton is needed.
Editing existing slide pages: Prioritize using +replace-slide (block-level replacement/insertion, do not move page order); see lark-slides-edit-workflows.md for action selection and the full read-modify-write process.
Identity Selection
Feishu slides are usually the user's own content resources. By default, you should prioritize explicitly using --as user (user identity) to perform slides-related operations, and always specify the identity explicitly.
--as user(Recommended): Create, read, and manage presentations as the currently logged-in user. Complete user authorization before execution:
lark-cli auth login --domain slides
--as bot: Use only when the user explicitly requests operations as the application identity, or when the bot needs to hold/create resources. When using bot identity, confirm whether the bot actually has access to the target presentation.
Execution Rules:
- Creating, reading, adding/deleting slides, and continuing to edit existing PPTs via user-provided links should all default to
--as user. - If permission is insufficient, check if the bot identity was used by mistake; do not default to falling back to the bot.
- Only switch to
--as botif the user explicitly requests "operate as application identity / bot identity", or if the current workflow involves the bot creating resources and then performing collaboration authorization.
Pre-execution Requirements
Important:
references/slides_xml_schema_definition.xmlis the only correct source of XML protocol for this skill; other md files are only summaries of it and the CLI schema.
High-frequency read-only:
- xml-schema-quick-ref.md
- planning-layer.md (New creation / Major rewrite)
- visual-planning.md (New creation / Major rewrite)
- asset-planning.md (New creation / Major rewrite)
- validation-checklist.md (After creation / Major rewrite)
Read on demand:
- Creation:
lark-slides-create.md - Editing:
lark-slides-edit-workflows.md,lark-slides-replace-slide.md - Images:
lark-slides-media-upload.md - Flowcharts / Sequence diagrams / Architecture diagrams / Decorative patterns:
lark-slides-whiteboard.md - Icons:
iconpark.md,scripts/iconpark_tool.py - Templates:
template-catalog.md,scripts/template_tool.py - Troubleshooting:
troubleshooting.md - Full protocol:
slides_xml_schema_definition.xml
Workflow
This is a presentation, not a document. Each slide is an independent visual scene; information density should be low, and layout should include whitespace.
Design Ideas
Do not generate slides without a sense of design. A plain white background + title + bullets can only serve as a minimalist temporary draft and cannot be used as a formal delivery.
Before writing XML, determine the deck-level visual strategy in slide_plan.json:
- Thematic Color Palette: The color scheme must serve the theme, industry, and audience; do not default to blue business style. If the same set of colors works for another completely different theme, the color scheme is not specific enough.
- Primary/Secondary Ratio: Choose 1 primary color to carry about 60-70% of the visual weight, 1-2 secondary colors for structure and partitioning, and 1 accent color used only for key numbers, conclusions, or action points. Do not give all colors the same weight.
- Background Consistency: Determine the background strategy for the entire deck first; default to maintaining the same light/dark tone and base color system. Only section breaks, transitions, or highlight pages should intentionally change the background, and changes must be made to look like they belong to the same design set through the same primary colors, textures, sidebars, or motifs. Regardless of light or dark, ensure sufficient contrast for body text, icons, and lines.
- Unified Motif: Choose a reusable visual motif to run through the entire document, such as thick sidebars, circular icon bases, semi-bleed image areas, numbered nodes, color blocks in the top-left corner of cards, or large numbers. Do not change the decorative language on every page.
Each page must have at least one visual element: image, icon, chart, table, process, comparison structure, large number, schematic, or abstract visual composed of shapes. Text boxes themselves do not count as main visuals.
Prioritize these page forms:
- Two-column structure: Text on left/image on right or image on left/text on right, with the visual area occupying 35-45% of the width.
- Icon rows: Icons on color blocks or circular bases, with short titles and a one-sentence explanation on the right.
- 2x2 / 2x3 grid: Suitable for capabilities, modules, risks, action items; keep content in each cell at the same level.
- Semi-bleed visuals: Images or abstract shapes occupy the left/right half of the screen, with text overlaid or arranged along the edge.
- Large number cards: Use 60-72pt numbers for key metrics, accompanied by 10-14pt labels below.
- Comparison columns: Use side-by-side layout for before/after, plan A/B, problem/solution, with titles and baselines strictly aligned.
- Timeline/Flowchart: Express steps using nodes and arrows; the flow direction must be visible at a glance.
Font and spacing suggestions:
- Titles 36-44pt, key conclusions can be larger; body text 14-18pt; notes 10-12pt.
- Body text defaults to left-aligned; use center-aligned only for covers, endings, or large number scenarios.
- Page margins at least 40px; maintain 24-40px spacing between content blocks, and keep it consistent within the same deck.
- Card padding must provide real space; do not let text touch the edges; consider text box padding when aligning shapes and text.
Common mistakes to avoid:
- Do not reuse the same title + three bullets layout for all pages.
- Do not use low-contrast text or low-contrast icons, such as light gray text on a light background.
- Do not let decorative lines cross through text, or let footers, sources, or numbering crowd the main content.
- Do not represent missing assets as blank image boxes; must generate XML-native visuals according to
fallback_if_missing. - Do not leave template placeholder text, example company names, example dates, or original template content unrelated to the user's theme.
Creation Method Selection
| Scenario | Recommended Method |
|---|---|
| Simple XML (1-3 pages, simple structure, almost no complex Chinese or special characters) | One-step creation with slides +create --slides '[...]' |
| Complex XML (multi-page, contains Chinese, long text, complex layout, nested quotes, many special characters) | Two-step creation: Create blank PPT with slides +create first, then add page by page using xml_presentation.slide create |
| Appending or inserting pages into existing PPT | Use xml_presentation.slide create, combined with before_slide_id if necessary |
[!WARNING] The risk of
--slides '[...]'lies mainly in shell parameter passing, not just the number of pages. Even if there is only 1 page, if the XML is complex enough, the two-step creation method is recommended.
[!IMPORTANT]
slides +create --slidescreates pages one by one at the underlying level; it is not an atomic operation. If it fails midway, record thexml_presentation_id, read back to confirm the current status, and then continue to fix or append.
Template and Script Priority Workflow
See template-catalog.md for template details. Remember the main workflow: search first, summarize after locking in, and extract only when a skeleton is needed; do not read full template XML directly or copy placeholder text.
python3 skills/lark-slides/scripts/template_tool.py search --query "<User request original text>" --limit 3
python3 skills/lark-slides/scripts/template_tool.py summarize --template <template-id> --label <Cover|Table of Contents|Section|Content|Ending>
python3 skills/lark-slides/scripts/template_tool.py extract --template <template-id> --label <Page type> --out /tmp/template-slice.xml
Step 1: Requirement clarification & Read knowledge
- Clarify theme, audience, page count, style; handle template requirements according to "Template and Script Priority Workflow"
- Read xml-schema-quick-ref.md; also read planning-layer.md, visual-planning.md, asset-planning.md for new creation / major rewrite
Step 2: Generate outline → User confirmation → Write slide_plan.json
- Generate structured outline for user confirmation; if using a template, indicate which template it is based on
- New creation / major rewrite must first create directory and write to `.lark-slides/plan/<deck-or-task-id>/slide_plan.json`
- Execute plan fields, path naming, template boundaries, and `asset_need` structure according to planning-layer.md / asset-planning.md
Step 3: Generate XML according to slide_plan.json → Create
- Consume plan page by page: key_message determines main conclusion, layout_type determines geometry, visual_focus determines main visual, text_density determines text volume
- When real assets are missing, must use `fallback_if_missing` to generate XML-native fallback visuals; do not leave blank
- Determine creation method according to "Creation Method Selection"; handle images, complex XML, escaping, and 3350001 troubleshooting according to lark-slides-create.md, media-upload.md, troubleshooting.md
Step 4: Review & Delivery
- After creation, must use xml_presentations.get to read full-text XML and perform explicit validation according to validation-checklist.md, including XML text overlap check
- Handle failures or partial successes according to troubleshooting.md; prioritize fixing local issues with `+replace-slide`
- If no issues → Delivery: Inform the user of the presentation ID and access method
jq Command Template (Use when editing existing PPT)
+create --slides is recommended for new PPTs. The following jq template is suitable for scenarios where pages are appended to an existing presentation, which can avoid manual escaping of double quotes:
# Append to the end
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>
Place shape, line, table, chart, whiteboard, etc. elements here
</data>
</slide>' '{slide:{content:$content}}')"
# Insert before a specific page: before_slide_id must be in the --data body, at the same level as slide
# ⚠️ Do not write before_slide_id into --params, CLI will silently send it as an unknown query parameter, the server will ignore it, and the new page will go to the end
lark-cli slides xml_presentation.slide create \
--as user \
--params '{"xml_presentation_id":"YOUR_ID"}' \
--data "$(jq -n --arg content '<slide ...>...</slide>' --arg before 'TARGET_SLIDE_ID' \
'{slide:{content:$content}, before_slide_id:$before}')"
Gradients must use
rgba()format with percentage stops, such aslinear-gradient(135deg,rgba(15,23,42,1) 0%,rgba(56,97,140,1) 100%). Usingrgb()or omitting stops will cause the server to fall back to white.
Outline Template
Use the following format when generating an outline for user confirmation:
[PPT Title], [Positioning description], for [Target audience]
Template: [No template used / <category>/<template>.xml (Reason for recommendation)]
Page structure (N pages):
1. Cover page: [Title text]
2. [Page theme]: [Point 1], [Point 2], [Point 3]
3. [Page theme]: [Page description]
...
N. Ending page: [Ending text]
Style: [Color scheme], [Layout style]
Core Concepts
URL Format and Tokens
| URL Format | Example | Token Type | Handling Method |
|---|---|---|---|
/slides/ | https://example.larkoffice.com/slides/xxxxxxxxxxxxx | xml_presentation_id | Token in URL path is used directly as xml_presentation_id |
/wiki/ | https://example.larkoffice.com/wiki/wikcnxxxxxxxxx | wiki_token | ⚠️ Cannot be used directly, need to query to get the real obj_token first |
+replace-slideand+media-uploadshortcuts automatically parse the above two types of URLs; when calling native APIs directly, you still need to parse wiki links manually.
Special Handling for Wiki Links (Critical!)
Knowledge base links (/wiki/TOKEN) cannot be used directly as xml_presentation_id. Before calling native APIs directly, query the wiki node first, confirm node.obj_type == "slides", and then use node.obj_token as the real presentation ID.
lark-cli wiki spaces get_node --as user --params '{"token":"wiki_token"}'
Shortcuts +replace-slide and +media-upload automatically parse /wiki/ URLs; you only need to perform this step yourself when manually calling xml_presentations.* / xml_presentation.slide.*.
Resource Relationships
Wiki Space
└── Wiki Node (Knowledge base node, obj_type: slides)
└── obj_token → xml_presentation_id
Slides (Presentation)
├── xml_presentation_id (Unique presentation identifier)
├── revision_id (Version number)
└── Slide (Slide page)
└── slide_id (Unique page identifier)
Shortcuts and APIs
Shortcuts are high-level wrappers for common operations (lark-cli slides +<verb> [flags]). Prioritize using operations that have shortcuts.
| Shortcut | Description |
|---|---|
+create | Create PPT (optional --slides to add pages in one step, supports <img src="@./local.png"> placeholder for automatic upload) |
+media-upload | Upload local image to specified presentation, returns file_token (used as <img src="...">), max 20 MB |
+replace-slide | Block-level replacement/insertion for existing slide pages (block_replace / block_insert), automatically injects id and <content/>, does not change page order |
Use native APIs when no shortcut covers the requirement. High-frequency resources: xml_presentations.get to read full text; xml_presentation.slide.create/delete/get/replace to manage single pages.
lark-cli schema slides.<resource>.<method> # Must check parameter structure before calling API
lark-cli slides <resource> <method> [flags] # Call API
Important: When using native APIs, you must run
schemafirst to view the--data/--paramsparameter structure; do not guess field formats.
Core Rules
- Plan before writing XML: When creating a new presentation or performing a major page rewrite, you must write to
.lark-slides/plan/<deck-or-task-id>/slide_plan.jsonfirst; templates, styles, and outlines can only serve as planning input and cannot bypass the planning layer. - Creation process: Simple short XML (1-3 pages, simple structure, few special characters) can be created in one step with
slides +create --slides '[...]'; for complex content, images, long Chinese text, nested quotes, many special characters, or more than 10 pages, default to creating a blank PPT withslides +createfirst, then add page by page usingxml_presentation.slide.create. - Direct children of
<slide>are only<style>,<data>,<note>: Text and graphics must be placed inside<data>. - Text is expressed via
<content>: Must use<content><p>...</p></content>; text cannot be written directly inside a shape. - Save key IDs: Subsequent operations require
xml_presentation_id,slide_id, andrevision_id. - Delete with caution: Deletion is irreversible, and at least one slide must remain.
- Prioritize block-level replacement for editing existing pages: Modify single shapes/images using
+replace-slide(block_replace/block_insert); do not rebuild the entire page. Only useslide.delete+slide.createwhen the entire page structure needs to be replaced. <img src>can only usefile_tokenuploaded to Feishu Drive; http(s) external links are prohibited: The Feishu slides rendering engine does not proxy external images; external src usually does not display or shows a broken image in PPT. The process must be: "Save image locally → Upload usingslides +media-uploador@./pathplaceholder for+create --slides→ Writefile_tokeninto<img src>". If the user provides a web image link,curl/download it to CWD first before proceeding with the upload process; do not put the external URL directly intosrc. Images max 20 MB (slides upload API does not support chunked upload).
Note: If the md content is inconsistent with
slides_xml_schema_definition.xmlor the output oflark-cli schema slides.<resource>.<method>, the latter two take precedence.
slides (v1)
Quick Reference
| 用户需求 | 优先动作 | 关键文档 / 命令 |
|---|---|---|
| 新建 PPT | 先规划 slide_plan.json,再按复杂度选择一步或两步创建 | planning-layer.md、visual-planning.md、asset-planning.md、slides +create |
| 大幅改写页面 | 先回读现有 XML,写入新 plan,再替换或重建相关页面 | xml_presentations.get、+replace-slide、lark-slides-edit-workflows.md |
| 编辑单个标题、文本块、图片或局部元素 | 优先块级替换/插入,不改页序 | slides +replace-slide、lark-slides-replace-slide.md |
| 读取或分析已有 PPT | 解析 slides/wiki token,回读全文或单页 XML,保存 xml_presentation_id、slide_id、revision_id | xml_presentations.get、xml_presentation.slide.get |
| 上传或使用图片 | 先上传为 file_token,禁止直接写 http(s) 外链 | slides +media-upload,或 +create --slides 的 @./path 占位符 |
| 在 slide 中绘制柱/条/折线/面积/雷达/饼等有数据序列的图表 | 使用原生 <chart> 元素 | xml-schema-quick-ref.md |
| 在 slide 中绘制流程图、时序图、架构图、散点图、漏斗图或装饰图案 | 必须先用 Read 工具读取参考文档,再生成 <whiteboard> 元素 | lark-slides-whiteboard.md |
| 使用语义图标 | 先检索 IconPark,再写 <icon iconType="..."> | iconpark_tool.py search → resolve、iconpark.md |
| 用户提到模板、主题、版式 | 先检索模板,再摘要,必要时裁切骨架 | template_tool.py search → summarize → extract |
| 创建失败、空白页、3350001、布局异常 | 先回读状态,再按排障清单修复,不假设原操作原子成功 | troubleshooting.md、validation-checklist.md |
CRITICAL — 开始前 MUST 先用 Read 工具读取 ../lark-shared/SKILL.md,认证、权限和全局参数均以 lark-shared 为准。
CRITICAL — 生成任何 XML 之前,MUST 先用 Read 工具读取 xml-schema-quick-ref.md,禁止凭记忆猜测 XML 结构。
CRITICAL — 新建演示文稿或大幅改写页面时,MUST 先生成 .lark-slides/plan/<deck-or-task-id>/slide_plan.json,再生成 XML。先创建对应目录,规划层规则和中间产物生命周期见 planning-layer.md。仅替换一个标题、插入一个块等小型已有页编辑可豁免。
CRITICAL — 新建演示文稿或大幅改写页面时,生成 XML 前 MUST 读取 visual-planning.md,确保 layout_type、visual_focus、text_density 实际改变页面几何、主视觉和文本量。
CRITICAL — 新建演示文稿或大幅改写页面时,规划 asset_need MUST 遵循 asset-planning.md:只做元数据规划,必须有 fallback_if_missing,不得要求真实搜索、下载或上传素材。
CRITICAL — 创建或大幅改写后,MUST 按 validation-checklist.md 做显式验证:回读全文 XML、核对页数和关键元素、检查空白/破损页、明显溢出、布局风险;XML 语法和文本重叠静态检查优先使用 scripts/xml_text_overlap_lint.py。
CRITICAL — 创建前自检或失败排障时,MUST 按 troubleshooting.md 检查 XML 转义、结构、shell 截断、图片 token、3350001 和布局风险。
CRITICAL — 如果用户提到“模板”“套用模板”“参考某种主题/风格/版式”,或用户需求明显落在已有场景模板内(如工作汇报、产品介绍、商业计划书、培训、晋升汇报等),MUST 先用 scripts/template_tool.py 的 search 做模板检索;默认给出 2-3 个最匹配模板候选供用户选择。锁定模板后用 summarize 获取主题和布局摘要;只有需要布局骨架时才用 extract 裁切目标页型 XML。不要直接读取完整模板 XML。
[!NOTE]
scripts/template_tool.py需要 Python 3。references/template-index.json是脚本缓存/轻量路由索引,不是默认给 agent 阅读的文档;assets/templates/*.xml是机器资源,只应通过脚本摘要或裁切,不要全文读取。
CRITICAL — 使用模板生成或改写页面时,MUST 先 summarize 目标页型;只有需要具体布局骨架时才 extract。
编辑已有幻灯片页面:优先用 +replace-slide(块级替换/插入,不动页序);选择 action 和完整读-改-写流程见 lark-slides-edit-workflows.md。
身份选择
飞书幻灯片通常是用户自己的内容资源。默认应优先显式使用 --as user(用户身份)执行 slides 相关操作,始终显式指定身份。
--as user(推荐):以当前登录用户身份创建、读取、管理演示文稿。执行前先完成用户授权:
lark-cli auth login --domain slides
--as bot:仅在用户明确要求以应用身份操作,或需要让 bot 持有/创建资源时使用。使用 bot 身份时,要额外确认 bot 是否真的有目标演示文稿的访问权限。
执行规则:
- 创建、读取、增删 slide、按用户给出的链接继续编辑已有 PPT,默认都先用
--as user。 - 如果出现权限不足,先检查当前是否误用了 bot 身份;不要默认回退到 bot。
- 只有在用户明确要求"用应用身份 / bot 身份操作",或当前工作流就是 bot 创建资源后再做协作授权时,才切换到
--as bot。
执行前必做
重要:
references/slides_xml_schema_definition.xml是此 skill 唯一正确的 XML 协议来源;其他 md 仅是对它和 CLI schema 的摘要。
高频只读:
- xml-schema-quick-ref.md
- planning-layer.md(新建 / 大幅改写)
- visual-planning.md(新建 / 大幅改写)
- asset-planning.md(新建 / 大幅改写)
- validation-checklist.md(创建 / 大幅改写后)
按需再读:
- 创建:
lark-slides-create.md - 编辑:
lark-slides-edit-workflows.md、lark-slides-replace-slide.md - 图片:
lark-slides-media-upload.md - 流程图 / 时序图 / 架构图 / 装饰图案:
lark-slides-whiteboard.md - 图标:
iconpark.md、scripts/iconpark_tool.py - 模板:
template-catalog.md、scripts/template_tool.py - 排障:
troubleshooting.md - 完整协议:
slides_xml_schema_definition.xml
Workflow
这是演示文稿,不是文档。 每页 slide 是独立的视觉画面,信息密度要低,排版要留白。
Design Ideas
不要生成无设计感的幻灯片。纯白背景 + 标题 + bullets 只能作为极简临时稿,不能作为正式交付。
开始写 XML 前,先在 slide_plan.json 里确定 deck 级视觉策略:
- 主题化配色:配色必须服务本次主题、行业和受众,不要默认蓝色商务风。如果把同一套颜色换到另一个完全不同主题仍然成立,说明配色不够具体。
- 主次比例:选择 1 个主色承担约 60-70% 视觉权重,1-2 个辅助色承担结构和分区,1 个强调色只用于关键数字、结论或行动点。不要让所有颜色权重相同。
- 背景一致性:先确定全 deck 的背景策略,默认保持同一明暗基调和底色体系;只有分节、转场或强调页才有意改变背景,并必须通过相同主色、纹理、边栏或 motif 让变化看起来属于同一套设计。无论深浅,都要保证正文、图标和线条对比充足。
- 统一 motif:选择一个可复用视觉母题贯穿全文,例如粗侧边栏、圆形图标底、半出血图片区、编号节点、卡片左上角色块或大号数字。不要每页换一套装饰语言。
每页至少要有一个视觉元素:图片、图标、图表、表格、流程、对比结构、大号数字、示意图或由 shape 组成的抽象视觉。文本框本身不算主视觉。
可优先考虑这些页面形态:
- 双栏结构:左文右图或左图右文,视觉区域占 35-45% 宽度。
- 图标行:图标在色块或圆形底中,右侧是短标题和一句解释。
- 2x2 / 2x3 网格:适合能力、模块、风险、行动项,每格内容保持同等层级。
- 半出血视觉:图片或抽象形状占据左/右半屏,文字覆盖或贴边排布。
- 大数字卡片:关键指标用 60-72pt 数字,下面配 10-14pt 标签。
- 对比列:before/after、方案 A/B、问题/解法用左右并列,标题和基线严格对齐。
- 时间线/流程图:步骤用节点和箭头表达,流程方向必须一眼可见。
字体和间距建议:
- 标题 36-44pt,关键结论可更大;正文 14-18pt;注释 10-12pt。
- 正文默认左对齐;只在封面、结尾或大号数字场景中使用居中。
- 页面边距至少 40px;内容块之间保持 24-40px 间距,并在同一 deck 内保持一致。
- 卡片内边距要真实留出空间,不要让文字贴边;对齐 shape 和文字时要考虑文本框 padding。
常见错误必须避免:
- 不要所有页面复用同一种标题 + 三 bullets 版式。
- 不要用低对比文字或低对比图标,例如浅灰字压在浅色背景上。
- 不要让装饰线穿过文字,或让页脚、来源、编号挤压主体内容。
- 不要把素材缺失表现为空白图片框;必须按
fallback_if_missing生成 XML-native 视觉。 - 不要留下模板占位文案、示例公司名、示例日期或与用户主题无关的原模板内容。
创建方式选择
| 场景 | 推荐方式 |
|---|---|
| 简单 XML(1-3 页、结构简单、几乎无复杂中文和特殊字符) | slides +create --slides '[...]' 一步创建 |
| 复杂 XML(多页、含中文、大段文本、复杂布局、嵌套引号、特殊字符较多) | 两步创建:先 slides +create 创建空白 PPT,再用 xml_presentation.slide create 逐页添加 |
| 已有 PPT 继续追加或插入页面 | 使用 xml_presentation.slide create,必要时配合 before_slide_id |
[!WARNING]
--slides '[...]'的风险点主要在 shell 参数传递,而不是单纯页数。即使只有 1 页,只要 XML 足够复杂,也建议使用两步创建法。
[!IMPORTANT]
slides +create --slides底层会逐页创建,不是原子操作。中途失败时先记录xml_presentation_id,回读确认当前状态,再继续修复或追加。
模板与脚本优先流程
模板细则见 template-catalog.md。主流程只记住:先 search,锁定后 summarize,需要骨架时才 extract;不要直接读取完整模板 XML 或照搬占位文案。
python3 skills/lark-slides/scripts/template_tool.py search --query "<用户需求原文>" --limit 3
python3 skills/lark-slides/scripts/template_tool.py summarize --template <template-id> --label <封面|目录|分节|内容|结尾>
python3 skills/lark-slides/scripts/template_tool.py extract --template <template-id> --label <页型> --out /tmp/template-slice.xml
Step 1: 需求澄清 & 读取知识
- 澄清主题、受众、页数、风格;模板需求按“模板与脚本优先流程”处理
- 读取 xml-schema-quick-ref.md;新建 / 大幅改写时还要读取 planning-layer.md、visual-planning.md、asset-planning.md
Step 2: 生成大纲 → 用户确认 → 写入 slide_plan.json
- 生成结构化大纲供用户确认;如使用模板,标明基于哪个模板改写
- 新建 / 大幅改写必须先创建目录并写入 `.lark-slides/plan/<deck-or-task-id>/slide_plan.json`
- plan 字段、路径命名、模板边界和 `asset_need` 结构按 planning-layer.md / asset-planning.md 执行
Step 3: 按 slide_plan.json 生成 XML → 创建
- 逐页消费 plan:key_message 定主结论,layout_type 定几何,visual_focus 定主视觉,text_density 定文本量
- 缺少真实素材时必须用 `fallback_if_missing` 生成 XML-native 兜底视觉;不要留空
- 创建方式按“创建方式选择”判断;图片、复杂 XML、转义和 3350001 排查按 lark-slides-create.md、media-upload.md、troubleshooting.md 执行
Step 4: 审查 & 交付
- 创建完成后,必须用 xml_presentations.get 读取全文 XML,并按 validation-checklist.md 做显式验证记录,包括 XML 文本重叠检查
- 失败或部分成功按 troubleshooting.md 处理;局部问题优先用 `+replace-slide` 修正
- 没问题 → 交付:告知用户演示文稿 ID 和访问方式
jq 命令模板(编辑已有 PPT 时使用)
新建 PPT 推荐用 +create --slides。以下 jq 模板适用于向已有演示文稿追加页面的场景,可以避免手动转义双引号:
# 追加到末尾
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、whiteboard 等元素
</data>
</slide>' '{slide:{content:$content}}')"
# 插到指定页之前:before_slide_id 必须在 --data body 里,与 slide 同级
# ⚠️ 不要把 before_slide_id 写进 --params —— CLI 会当未知 query 参数静默下发,服务端忽略,新页跑到末尾
lark-cli slides xml_presentation.slide create \
--as user \
--params '{"xml_presentation_id":"YOUR_ID"}' \
--data "$(jq -n --arg content '<slide ...>...</slide>' --arg before 'TARGET_SLIDE_ID' \
'{slide:{content:$content}, before_slide_id:$before}')"
渐变色必须使用
rgba()格式并带百分比停靠点,如linear-gradient(135deg,rgba(15,23,42,1) 0%,rgba(56,97,140,1) 100%)。使用rgb()或省略停靠点会导致服务端回退为白色。
大纲模板
生成大纲时使用以下格式,交给用户确认:
[PPT 标题] — [定位描述],面向 [目标受众]
模板:[未使用模板 / <category>/<template>.xml(推荐原因)]
页面结构(N 页):
1. 封面页:[标题文案]
2. [页面主题]:[要点1]、[要点2]、[要点3]
3. [页面主题]:[要点描述]
...
N. 结尾页:[结尾文案]
风格:[配色方案],[排版风格]
核心概念
URL 格式与 Token
| URL 格式 | 示例 | Token 类型 | 处理方式 |
|---|---|---|---|
/slides/ | https://example.larkoffice.com/slides/xxxxxxxxxxxxx | xml_presentation_id | URL 路径中的 token 直接作为 xml_presentation_id 使用 |
/wiki/ | https://example.larkoffice.com/wiki/wikcnxxxxxxxxx | wiki_token | ⚠️ 不能直接使用,需要先查询获取真实的 obj_token |
+replace-slide和+media-uploadshortcut 会自动解析以上两种 URL;直接调用原生 API 时仍需手动解析 wiki 链接。
Wiki 链接特殊处理(关键!)
知识库链接(/wiki/TOKEN)不能直接当 xml_presentation_id。直接调用原生 API 前,先查询 wiki 节点,确认 node.obj_type == "slides",再用 node.obj_token 作为真实 presentation ID。
lark-cli wiki spaces get_node --as user --params '{"token":"wiki_token"}'
Shortcut +replace-slide 和 +media-upload 会自动解析 /wiki/ URL;手动调用 xml_presentations.* / xml_presentation.slide.* 时才需要自己做这一步。
资源关系
Wiki Space (知识空间)
└── Wiki Node (知识库节点, obj_type: slides)
└── obj_token → xml_presentation_id
Slides (演示文稿)
├── xml_presentation_id (演示文稿唯一标识)
├── revision_id (版本号)
└── Slide (幻灯片页面)
└── slide_id (页面唯一标识)
Shortcuts 与 API
Shortcut 是对常用操作的高级封装(lark-cli slides +<verb> [flags])。有 Shortcut 的操作优先使用。
| Shortcut | 说明 |
|---|---|
+create | 创建 PPT(可选 --slides 一步添加页面,支持 <img src="@./local.png"> 占位符自动上传) |
+media-upload | 上传本地图片到指定演示文稿,返回 file_token(用作 <img src="...">),最大 20 MB |
+replace-slide | 对已有幻灯片页面进行块级替换/插入(block_replace / block_insert),自动注入 id 和 <content/>,不改变页序 |
没有 Shortcut 覆盖时使用原生 API。高频资源:xml_presentations.get 读取全文;xml_presentation.slide.create/delete/get/replace 管理单页。
lark-cli schema slides.<resource>.<method> # 调用 API 前必须先查看参数结构
lark-cli slides <resource> <method> [flags] # 调用 API
重要:使用原生 API 时,必须先运行
schema查看--data/--params参数结构,不要猜测字段格式。
核心规则
- 先规划再写 XML:新建演示文稿或大幅改写页面时,必须先写入
.lark-slides/plan/<deck-or-task-id>/slide_plan.json;模板、风格和大纲只能作为规划输入,不能绕过规划层 - 创建流程:简单短 XML(1-3 页、结构简单、特殊字符少)可用
slides +create --slides '[...]'一步创建;复杂内容、含图片/中文大段文本/嵌套引号/较多特殊字符,或超过 10 页时,默认先slides +create创建空白 PPT,再用xml_presentation.slide.create逐页添加 <slide>直接子元素只有<style>、<data>、<note>:文本和图形必须放在<data>内- 文本通过
<content>表达:必须用<content><p>...</p></content>,不能把文字直接写在 shape 内 - 保存关键 ID:后续操作需要
xml_presentation_id、slide_id、revision_id - 删除谨慎:删除操作不可逆,且至少保留一页幻灯片
- 编辑已有页面优先块级替换:修改单个 shape/img 用
+replace-slide(block_replace/block_insert),不要整页重建;只有需要替换整页结构时才用slide.delete+slide.create <img src>只能用上传到飞书 drive 的file_token,禁止使用 http(s) 外链 URL:飞书 slides 渲染端不会代理外链图片,外链 src 在 PPT 里通常不显示或显示破图。流程必须是「先把图存到本地 → 用slides +media-upload上传或+create --slides的@./path占位符自动上传 → 拿file_token写进<img src>」。如果用户给了网图链接,先curl/下载到 CWD 内再走上传流程,不要直接把外链 URL 塞进src。图片最大 20 MB(slides upload API 不支持分片上传)。
注意:如果 md 内容与
slides_xml_schema_definition.xml或lark-cli schema slides.<resource>.<method>输出不一致,以后两者为准。
Installs
201,615First seen
Jun 10, 2026
Auto-fetched from GitHub .
Stats via skills.sh.
Skills similar to lark-slides:
Installs
Installs
Installs