pptx-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePPTX Slide Generator
PPTX 幻灯片生成器
Generate professional, on-brand presentation slides using python-pptx. This skill supports:
- Slide Generation - Create presentations for any brand in
brands/ - Carousel Generation - Create LinkedIn carousels (square format, exports to PDF)
- Slide Editing - Modify existing PPTX files
- Layout Management - Create, edit, update cookbook layouts
IMPORTANT: All skill resources are in . Always use Glob patterns starting with to find files.
.claude/skills/pptx-generator/.claude/skills/pptx-generator/使用python-pptx生成专业的、符合品牌风格的演示文稿幻灯片。此技能支持:
- 幻灯片生成 - 为目录下的任意品牌创建演示文稿
brands/ - 轮播图生成 - 创建LinkedIn轮播图(正方形格式,导出为PDF)
- 幻灯片编辑 - 修改现有的PPTX文件
- 布局管理 - 创建、编辑、更新布局库中的布局
重要提示: 所有技能资源都位于目录下。请始终使用以开头的Glob模式查找文件。
.claude/skills/pptx-generator/.claude/skills/pptx-generator/⚠️ CRITICAL: Batch Generation Rules
⚠️ 关键:批量生成规则
NEVER generate more than 5 slides at once.
| Rule | Details |
|---|---|
| Max slides per batch | 5 (can be 1, 2, 3, 4, or 5) |
| After each batch | STOP and validate output |
| Validation required | Check: no duplicate titles, proper spacing, correct colors |
| Continue when | Validation passes |
| After ALL batches | COMBINE into single file and DELETE part files |
This prevents token limit errors and catches quality issues early.
CRITICAL: Always clean up part files after combining. The user should only see ONE final PPTX file, not multiple part files.
一次生成的幻灯片数量绝对不能超过5张。
| 规则 | 详情 |
|---|---|
| 每批最大幻灯片数 | 5(可以是1、2、3、4或5张) |
| 每批生成后 | 停止并验证输出结果 |
| 验证要求 | 检查:无重复标题、间距合适、颜色正确 |
| 继续生成的条件 | 验证通过 |
| 所有批次完成后 | 合并为单个文件并删除分批次文件 |
此规则可避免令牌限制错误,并尽早发现质量问题。
关键:合并完成后务必清理分批次文件。用户应只看到一个最终的PPTX文件,而非多个分批次文件。
⚠️ PREREQUISITE: Brand Check
⚠️ 前提条件:品牌检查
Before generating slides, check if any brands exist.
Glob: .claude/skills/pptx-generator/brands/*/brand.jsonIf NO brands found (only exists):
template/-
STOP - Do not proceed with slide generation
-
Ask the user:"No brands are configured yet. Would you like me to help you create a brand first? I'll need your brand colors, fonts, and style guidelines to set this up."
-
If user wants to create a brand, follow the Creating a New Brand section below.
-
If user declines, explain that slides require a brand configuration and offer to use generic styling as a fallback.
生成幻灯片前,请检查是否存在品牌配置。
Glob: .claude/skills/pptx-generator/brands/*/brand.json如果未找到任何品牌(仅存在目录):
template/-
停止操作 - 不要继续生成幻灯片
-
询问用户:"目前尚未配置任何品牌。是否需要我帮您先创建一个品牌配置? 我需要您提供品牌颜色、字体和风格指南来完成设置。"
-
如果用户希望创建品牌,请遵循下方的创建新品牌部分。
-
如果用户拒绝,请说明幻灯片需要品牌配置,并提供使用通用样式作为备选方案。
Creating a New Brand
创建新品牌
When no brands exist or user requests a new brand:
当不存在品牌或用户请求创建新品牌时:
Step 1: Read the Template
步骤1:读取模板
Read: .claude/skills/pptx-generator/brands/template/README.md
Read: .claude/skills/pptx-generator/brands/template/brand.json
Read: .claude/skills/pptx-generator/brands/template/config.jsonRead: .claude/skills/pptx-generator/brands/template/README.md
Read: .claude/skills/pptx-generator/brands/template/brand.json
Read: .claude/skills/pptx-generator/brands/template/config.jsonStep 2: Gather Brand Information
步骤2:收集品牌信息
Ask the user for (or extract from provided materials):
| Required | Description |
|---|---|
| Brand name | Folder name (lowercase, no spaces) |
| Colors | Background, text, accent colors (hex codes) |
| Fonts | Heading font, body font, code font |
| Optional | Description |
|---|---|
| Output directory | Where to save generated files (default: |
| Logo | Path to logo file (PNG/SVG) |
| Brand guidelines | Existing style guide or website to reference |
| Tone of voice | Writing style, vocabulary preferences |
向用户询问(或从提供的材料中提取):
| 必填项 | 描述 |
|---|---|
| 品牌名称 | 文件夹名称(小写,无空格) |
| 颜色 | 背景色、文本色、强调色(十六进制代码) |
| 字体 | 标题字体、正文字体、代码字体 |
| 可选项 | 描述 |
|---|---|
| 输出目录 | 生成文件的保存位置(默认: |
| Logo | Logo文件路径(PNG/SVG格式) |
| 品牌指南 | 现有的风格指南或参考网站 |
| 语气风格 | 写作风格、词汇偏好 |
Step 3: Create Brand Files
步骤3:创建品牌文件
-
Create the brand folder:bash
mkdir -p .claude/skills/pptx-generator/brands/{brand-name} -
Create brand.json with the gathered values:json
{ "name": "Brand Name", "description": "One-line description", "colors": { "background": "hex-without-hash", "background_alt": "hex-without-hash", "text": "hex-without-hash", "text_secondary": "hex-without-hash", "accent": "hex-without-hash", "accent_secondary": "hex-without-hash", "accent_tertiary": "hex-without-hash", "code_bg": "hex-without-hash", "card_bg": "hex-without-hash", "card_bg_alt": "hex-without-hash" }, "fonts": { "heading": "Font Name", "body": "Font Name", "code": "Monospace Font" }, "assets": { "logo": "assets/logo.png", "logo_dark": null, "icon": null } } -
Create config.json with output settings:json
{ "output": { "directory": "output/{brand}", "naming": "{name}-{date}", "keep_parts": false }, "generation": { "slides_per_batch": 5, "auto_combine": true, "open_after_generate": false }, "defaults": { "slide_width_inches": 13.333, "slide_height_inches": 7.5 } } -
Create brand-system.md - Copy from template and fill in brand guidelines
-
Create tone-of-voice.md - Copy from template and fill in voice guidelines
-
Add assets - Copy logo/images to
brands/{brand-name}/assets/
-
创建品牌文件夹:bash
mkdir -p .claude/skills/pptx-generator/brands/{brand-name} -
创建brand.json文件并填入收集到的值:json
{ "name": "Brand Name", "description": "单行描述", "colors": { "background": "不带#的十六进制码", "background_alt": "不带#的十六进制码", "text": "不带#的十六进制码", "text_secondary": "不带#的十六进制码", "accent": "不带#的十六进制码", "accent_secondary": "不带#的十六进制码", "accent_tertiary": "不带#的十六进制码", "code_bg": "不带#的十六进制码", "card_bg": "不带#的十六进制码", "card_bg_alt": "不带#的十六进制码" }, "fonts": { "heading": "Font Name", "body": "Font Name", "code": "Monospace Font" }, "assets": { "logo": "assets/logo.png", "logo_dark": null, "icon": null } } -
创建config.json文件并填入输出设置:json
{ "output": { "directory": "output/{brand}", "naming": "{name}-{date}", "keep_parts": false }, "generation": { "slides_per_batch": 5, "auto_combine": true, "open_after_generate": false }, "defaults": { "slide_width_inches": 13.333, "slide_height_inches": 7.5 } } -
创建brand-system.md文件 - 从模板复制并填写品牌指南
-
创建tone-of-voice.md文件 - 从模板复制并填写语气风格指南
-
添加资源 - 将Logo/图片复制到目录
brands/{brand-name}/assets/
Step 4: Verify
步骤4:验证
After creating the brand, verify with:
Glob: .claude/skills/pptx-generator/brands/{brand-name}/*Then proceed to slide generation.
创建品牌后,通过以下方式验证:
Glob: .claude/skills/pptx-generator/brands/{brand-name}/*然后继续进行幻灯片生成。
Skill Modes
技能模式
This skill operates in three modes:
此技能有三种运行模式:
Mode 1: Generate Presentation Slides
模式1:生成演示文稿幻灯片
User wants presentation slides (16:9) created using a brand's styling.
→ Follow: Brand Discovery → Layout Selection → Content Adaptation → Execute
→ Layouts in:
cookbook/*.py用户希望使用品牌风格创建演示文稿幻灯片(16:9比例)。
→ 遵循:品牌发现 → 布局选择 → 内容适配 → 执行
→ 布局位于:
cookbook/*.pyMode 2: Generate LinkedIn Carousels
模式2:生成LinkedIn轮播图
User wants a LinkedIn carousel (square 1:1 format) for social media.
→ Follow: Brand Discovery → Carousel Planning → Generate → Export PDF
→ Layouts in:
cookbook/carousels/*.py用户希望为社交媒体创建LinkedIn轮播图(正方形1:1格式)。
→ 遵循:品牌发现 → 轮播图规划 → 生成 → 导出为PDF
→ 布局位于:
cookbook/carousels/*.pyMode 3: Manage Cookbook Layouts
模式3:管理布局库布局
User wants to create, edit, or improve layout templates.
→ Follow: Layout CRUD Operations section
用户希望创建、编辑或优化布局模板。
→ 遵循:布局CRUD操作部分
Mode 1: Generate Presentation Slides
模式1:生成演示文稿幻灯片
Step 1: Brand Discovery
步骤1:品牌发现
-
List available brands:
Glob: .claude/skills/pptx-generator/brands/*/brand.jsonExtract unique brand names from paths (e.g.,→ "rasmus")brands/rasmus/... -
Read the brand configuration files:
Read: .claude/skills/pptx-generator/brands/{brand-name}/brand.json Read: .claude/skills/pptx-generator/brands/{brand-name}/config.json- - Colors, fonts, assets
brand.json - - Output directory, generation settings
config.json
-
Read supporting markdown files for context:
Glob: .claude/skills/pptx-generator/brands/{brand-name}/*.mdThese provide voice, tone, and design philosophy. -
Extract from brand files:
- From brand.json: Colors (hex without #), fonts, asset paths
- From config.json: Output directory, slides per batch, naming convention
- From markdown: Voice, tone, vocabulary, visual principles
If brand not found, list available brands and ask user to choose.
-
列出可用品牌:
Glob: .claude/skills/pptx-generator/brands/*/brand.json从路径中提取唯一的品牌名称(例如:→ "rasmus")brands/rasmus/... -
读取品牌配置文件:
Read: .claude/skills/pptx-generator/brands/{brand-name}/brand.json Read: .claude/skills/pptx-generator/brands/{brand-name}/config.json- - 颜色、字体、资源
brand.json - - 输出目录、生成设置
config.json
-
读取支持的Markdown文件以获取上下文:
Glob: .claude/skills/pptx-generator/brands/{brand-name}/*.md这些文件提供语气、风格和设计理念。 -
从品牌文件中提取信息:
- 来自brand.json: 颜色(不带#的十六进制码)、字体、资源路径
- 来自config.json: 输出目录、每批幻灯片数、命名规则
- 来自Markdown文件: 语气、风格、词汇、视觉原则
如果未找到品牌,列出可用品牌并请用户选择。
Step 2: Layout Discovery (READ ALL FRONTMATTERS)
步骤2:布局发现(阅读所有前置元数据)
⚠️ MANDATORY: Read ALL layout frontmatters before selecting any layout.
This step is critical for making informed layout decisions. You must understand what ALL layouts offer before choosing.
Step 2a: Discover all layouts:
Glob: .claude/skills/pptx-generator/cookbook/*.pyStep 2b: Read EVERY layout file (not just one or two):
For each file found, read the first 40 lines to extract the frontmatter block. Build a mental map of:
.py# /// layout- What each layout is for (,
purpose)best_for - What each layout should NOT be used for ()
avoid_when - Limits and constraints (,
max_*,min_*)*_max_chars
The frontmatter block looks like this:
python
undefined⚠️ 强制要求:选择任何布局前,必须阅读所有布局的前置元数据。
此步骤对于做出合理的布局选择至关重要。在选择布局前,您必须了解所有可用布局的功能。
步骤2a:发现所有布局:
Glob: .claude/skills/pptx-generator/cookbook/*.py步骤2b:读取每个布局文件(不只是一个或两个):
对于每个找到的文件,读取前40行以提取前置元数据块。建立以下内容的心智图:
.py# /// layout- 每个布局的用途(、
purpose)best_for - 每个布局不适用的场景()
avoid_when - 限制和约束(、
max_*、min_*)*_max_chars
前置元数据块示例:
python
undefined/// layout
/// layout
name = "floating-cards-slide"
name = "floating-cards-slide"
purpose = "Feature highlights, process steps, multiple equal items with depth"
purpose = "功能亮点、流程步骤、多个具有层次感的同等内容项"
best_for = [
best_for = [
"Exactly 3 related features or concepts",
"恰好3个相关功能或概念",
"Process with 3 steps",
"包含3个步骤的流程",
]
]
avoid_when = [
avoid_when = [
"More than 3 items - use multi-card-slide instead",
"超过3个内容项 - 请改用multi-card-slide",
"Long card titles (over 15 characters)",
"卡片标题过长(超过15个字符)",
]
]
max_cards = 3
max_cards = 3
card_title_max_chars = 15
card_title_max_chars = 15
instructions = [
instructions = [
"EXACTLY 3 cards required - no more, no less",
"必须恰好3张卡片 - 不能多也不能少",
"Card titles must be SHORT: 1-2 words, max 15 characters",
"卡片标题必须简短:1-2个单词,最多15个字符",
]
]
///
///
**Key frontmatter fields:**
| Field | Description |
|-------|-------------|
| `name` | Layout identifier |
| `purpose` | What this layout is for |
| `best_for` | Ideal use cases (array) |
| `avoid_when` | When NOT to use this layout (array) |
| `max_*` / `min_*` | Item limits (cards, bullets, stats) |
| `instructions` | Specific tips for using this layout |
**Step 2c: Select layouts** (only AFTER reading all frontmatters):
Now that you know all available layouts and their constraints:
1. User specifies layout → Use that layout (but verify it fits the content)
2. User describes content → Match to best-fitting `best_for` criteria
3. **Check `avoid_when`** → Don't use a layout in situations it warns against
4. **Respect limits** → If content exceeds `max_*`, use a different layout
5. Multiple slides needed → Select appropriate layout for each
6. No good fit → Create a custom layout (see Mode 2)
**Example selection process:**
- User wants "5 pillars of AI infrastructure"
- You've read all frontmatters and know:
- `floating-cards-slide`: `max_cards = 3` → Won't work
- `multi-card-slide`: `max_cards = 5` → Perfect fit
- Select `multi-card-slide`
**Why read ALL frontmatters?**
- Layouts reference each other in `avoid_when` (e.g., "use multi-card-slide instead")
- You can't make the right choice without knowing all options
- Prevents backtracking when a layout doesn't fit
**关键前置元数字段:**
| 字段 | 描述 |
|-------|-------------|
| `name` | 布局标识符 |
| `purpose` | 此布局的用途 |
| `best_for` | 理想使用场景(数组) |
| `avoid_when` | 不适用的场景(数组) |
| `max_*` / `min_*` | 内容项限制(卡片、项目符号、统计数据等) |
| `instructions` | 使用此布局的特定提示 |
**步骤2c:选择布局**(仅在阅读所有前置元数据后进行):
现在您已了解所有可用布局及其约束条件:
1. 用户指定布局 → 使用该布局(但需验证是否适合内容)
2. 用户描述内容 → 匹配最符合`best_for`标准的布局
3. **检查`avoid_when`** → 不要在其警告的场景中使用该布局
4. **遵守限制** → 如果内容超出`max_*`,请使用其他布局
5. 需要多张幻灯片 → 为每张幻灯片选择合适的布局
6. 没有合适的布局 → 创建自定义布局(请参阅模式2)
**示例选择过程:**
- 用户需要"AI基础设施的5大支柱"
- 您已阅读所有前置元数据,了解到:
- `floating-cards-slide`:`max_cards = 3` → 不适用
- `multi-card-slide`:`max_cards = 5` → 完美适配
- 选择`multi-card-slide`
**为什么要阅读所有前置元数据?**
- 布局会在`avoid_when`中相互引用(例如:"请改用multi-card-slide")
- 不了解所有选项就无法做出正确选择
- 避免因布局不合适而返工Step 2d: Visual-First Layout Selection (CRITICAL FOR VARIETY)
步骤2d:以视觉优先的原则选择布局(对多样性至关重要)
🎨 DEFAULT TO VISUAL LAYOUTS. Content-slide is the LAST RESORT, not the default.
🎨 默认使用视觉化布局。content-slide是最后选择,而非默认选项。
The Variety Problem
多样性问题
The biggest mistake in presentation generation is defaulting to content-slide (title + bullets) whenever you have information to convey. This creates repetitive, boring presentations.
Common failure pattern:
- 11 out of 30 slides = content-slide (37% repetition)
- User says "this lacks variety"
- You think "but I used 11 different layout types!"
- Reality: Layout variety exists, but distribution is terrible
演示文稿生成中最大的错误是每当需要传达信息时就默认使用content-slide(标题+项目符号)。这会导致演示文稿重复、乏味。
常见错误模式:
- 30张幻灯片中有11张是content-slide(占比37%)
- 用户反馈"缺乏多样性"
- 您认为"但我使用了11种不同的布局类型!"
- 实际情况:布局确实存在多样性,但分布极不均衡
Variety Enforcement Rules
多样性强制规则
HARD LIMITS:
- Never use the same layout more than 2-3 times consecutively
- Content-slide should be <25% of total slides (not 35-40%)
- Visual layouts (cards, stats, columns, hero, diagonal) should be 50%+ of slides
- Section breaks are NOT variety - they're structural (don't count toward variety)
硬性限制:
- 连续使用同一布局的次数不得超过2-3次
- content-slide占比应<25%(而非35-40%)
- 视觉化布局(卡片、统计数据、分栏、主视觉、斜向布局)应占50%以上
- 节分隔不属于多样性 - 它们是结构性元素(不计入多样性统计)
Decision Tree: "Should I Use content-slide?"
决策树:"我应该使用content-slide吗?"
Ask these questions IN ORDER before defaulting to content-slide:
Do I have 3-5 equal items?
YES → Use multi-card-slide (not content-slide)
Do I have 2-4 big numbers/metrics?
YES → Use stats-slide (not content-slide)
Am I comparing two things?
YES → Use two-column-slide (not content-slide)
Do I have a central concept with surrounding items?
YES → Use circular-hero-slide (not content-slide)
Do I have exactly 3 related items?
YES → Use floating-cards-slide (not content-slide)
Do I have 1-3 words I want to emphasize dramatically?
YES → Use giant-focus-slide or bold-diagonal-slide (not content-slide)
Do I have a powerful quote or principle?
YES → Use quote-slide (not content-slide)
Is this the ONLY way to present this information?
YES → NOW you can use content-slide
NO → Go back through the decision tree在默认使用content-slide前,请按顺序回答以下问题:
我是否有3-5个同等重要的内容项?
是 → 使用multi-card-slide(而非content-slide)
我是否有2-4个重要数字/指标?
是 → 使用stats-slide(而非content-slide)
我是否要比较两个事物?
是 → 使用two-column-slide(而非content-slide)
我是否有一个核心概念及相关的周边内容项?
是 → 使用circular-hero-slide(而非content-slide)
我是否恰好有3个相关内容项?
是 → 使用floating-cards-slide(而非content-slide)
我是否有1-3个需要重点强调的词汇?
是 → 使用giant-focus-slide或bold-diagonal-slide(而非content-slide)
我是否有一个有力的引用或原则?
是 → 使用quote-slide(而非content-slide)
这是否是呈现此信息的唯一方式?
是 → 现在您可以使用content-slide
否 → 返回决策树重新选择Transforming Bullets Into Visual Layouts
将项目符号转换为视觉化布局示例
Example 1: "Validation Patterns"
❌ BAD (content-slide):
Title: Validation Patterns
Bullets:
- Run comprehensive test suites
- Type checking and linting
- Code review by humans and AI
- Deployment previews✅ GOOD (multi-card-slide):
Title: Validation Patterns
Cards:
1. Testing | Run comprehensive test suites after every change
2. Linting | Type checking and formatting as guardrails
3. Review | Human and AI code review process
4. Preview | Deployment previews for visual regressionExample 2: "Why PIV Works"
❌ BAD (content-slide):
Title: Why PIV Works
Bullets:
- Forces planning before implementation
- Validation catches issues immediately
- Iterative improvements compound
- System gets smarter with every bug✅ GOOD (floating-cards-slide with 3 cards):
Title: Why PIV Works
Cards:
1. Plan First | Forces architectural thinking before coding
2. Fast Feedback | Validation catches issues immediately
3. Compounds | System improves with every bug(Note: Reduced from 4 to 3 items to fit floating-cards-slide limit)
max_cardsExample 3: "Human-in-the-Loop Strategy"
❌ BAD (content-slide):
Title: Human-in-the-Loop Strategy
Bullets:
- In-the-loop: Human approves before execution
- On-the-loop: Human reviews after completion
- Code review remains critical
- AI generates, humans validate✅ GOOD (two-column-slide):
Title: Human-in-the-Loop Strategy
Left: In-the-Loop
- Human approves before execution
- Critical for production changes
- Quality gateway
Right: On-the-Loop
- Human reviews after completion
- Faster iteration cycles
- AI generates, human validates示例1:"验证模式"
❌ 错误(content-slide):
标题:验证模式
项目符号:
- 运行全面的测试套件
- 类型检查和代码规范检查
- 人工和AI代码审查
- 部署预览✅ 正确(multi-card-slide):
标题:验证模式
卡片:
1. 测试 | 每次变更后运行全面的测试套件
2. 代码规范 | 类型检查和格式化为防护措施
3. 审查 | 人工和AI代码审查流程
4. 预览 | 用于视觉回归测试的部署预览示例2:"为什么PIV有效"
❌ 错误(content-slide):
标题:为什么PIV有效
项目符号:
- 强制在实施前进行规划
- 验证可立即发现问题
- 迭代改进会产生复利效应
- 系统会随着每个bug的修复变得更智能✅ 正确(使用3张卡片的floating-cards-slide):
标题:为什么PIV有效
卡片:
1. 先规划 | 强制在编码前进行架构思考
2. 快速反馈 | 验证可立即发现问题
3. 复利效应 | 系统会随着每个bug的修复而改进(注:为适配floating-cards-slide的限制,从4个内容项减少到3个)
max_cards示例3:"人在环中策略"
❌ 错误(content-slide):
标题:人在环中策略
项目符号:
- 环内:人工在执行前批准
- 环上:人工在完成后审查
- 代码审查仍然至关重要
- AI生成,人工验证✅ 正确(two-column-slide):
标题:人在环中策略
左侧:环内
- 人工在执行前批准
- 对生产环境变更至关重要
- 质量把关
右侧:环上
- 人工在完成后审查
- 更快的迭代周期
- AI生成,人工验证Active Visual Thinking
主动视觉化思考
Before planning any slide, ask yourself:
- "Can this be more visual?" - The answer is almost always YES
- "Have I used content-slide in the last 2 slides?" - If yes, use something else
- "Does this slide look like the previous slide?" - If yes, change the layout
- "Am I falling into a pattern?" - Break it immediately
- "Would this be more engaging as cards/columns/stats?" - Usually yes
规划任何幻灯片前,请自问:
- "能否让内容更具视觉化效果?" - 答案几乎总是肯定的
- "我在过去2张幻灯片中使用过content-slide吗?" - 如果是,请使用其他布局
- "此幻灯片看起来与上一张相似吗?" - 如果是,请更改布局
- "我是否陷入了固定模式?" - 立即打破它
- "以卡片/分栏/统计数据的形式呈现会更吸引人吗?" - 通常是的
When content-slide IS Appropriate
content-slide的适用场景
Use content-slide ONLY when:
- You've genuinely tried all other layouts and they don't fit
- The information is inherently linear and textual (rare)
- You need a "breather" slide between two complex visuals
- You're at your layout distribution limits (already used all the visual ones recently)
Never use content-slide as your default thinking.
仅在以下情况下使用content-slide:
- 您确实尝试了所有其他布局,但都不适合
- 信息本质上是线性且文本化的(罕见情况)
- 您需要在两个复杂的视觉化幻灯片之间插入一个"缓冲"幻灯片
- 您已达到布局分布限制(最近已使用过所有视觉化布局)
永远不要将content-slide作为默认选择。
Quick Reference: Content Type → Best Layout
快速参考:内容类型 → 最佳布局
| Content Type | Best Layout | Why |
|---|---|---|
| 3-5 equal features/steps | multi-card-slide | Cards create visual hierarchy |
| Exactly 3 featured items | floating-cards-slide | Elevated cards add depth |
| 2-4 metrics/KPIs | stats-slide | Big numbers grab attention |
| Before/after comparison | two-column-slide | Side-by-side shows contrast |
| Hub concept with types | circular-hero-slide | Radiating pattern shows relationships |
| Dramatic emphasis (1-3 words) | giant-focus-slide | Scale creates impact |
| High-energy warning | bold-diagonal-slide | Dynamic shapes convey urgency |
| Powerful quote/principle | quote-slide | Attribution adds authority |
| List of related items | multi-card-slide | Better than bullets |
| Process with steps | floating-cards-slide | Visual flow beats text |
| Technical comparison | two-column-slide | Structured comparison |
Only use content-slide when:
- None of the above fit
- Information is truly linear
- Need a text-heavy breather between visual slides
- Already hit variety limits
| 内容类型 | 最佳布局 | 原因 |
|---|---|---|
| 3-5个同等重要的功能/步骤 | multi-card-slide | 卡片可创建视觉层次结构 |
| 恰好3个重点内容项 | floating-cards-slide | 悬浮卡片增加层次感 |
| 2-4个指标/KPI | stats-slide | 大数字吸引注意力 |
| 前后对比 | two-column-slide | 并排展示可体现对比 |
| 核心概念及相关类型 | circular-hero-slide | 放射状模式可展示关系 |
| 需要重点强调的1-3个词汇 | giant-focus-slide | 缩放效果产生冲击力 |
| 高能量警告 | bold-diagonal-slide | 动态形状传达紧迫感 |
| 有力的引用/原则 | quote-slide | 署名增加权威性 |
| 相关内容项列表 | multi-card-slide | 比项目符号更好 |
| 包含多个步骤的流程 | floating-cards-slide | 视觉流程优于文本 |
| 技术对比 | two-column-slide | 结构化对比更清晰 |
仅在以下情况下使用content-slide:
- 以上布局均不适用
- 信息确实是线性的
- 需要在视觉化幻灯片之间插入一个文本较多的缓冲幻灯片
- 已达到多样性限制
Step 3: Slide Planning (ALWAYS DO THIS)
步骤3:幻灯片规划(必须执行)
Before generating ANY slides, create a written plan.
This applies to single slides, batches, and full presentations. Planning prevents:
- Duplicate content across slides
- Wrong layout choices
- Missing key information
- Poor flow and structure
Create a slide plan table:
markdown
| # | Layout | Title | Key Content | Notes |
|---|--------|-------|-------------|-------|
| 1 | title-slide | [Title] | [Subtitle, author] | Opening slide |
| 2 | content-slide | [Title] | [3-4 bullet points] | Main concepts |
| 3 | stats-slide | [Title] | [2-3 metrics] | Impact data |
| ... | ... | ... | ... | ... |For each slide, specify:
- Slide number - Position in presentation
- Layout - Which cookbook layout to use
- Title - Exact title text (check for duplicates!)
- Key content - Bullet points, stats, quotes, etc.
- Notes - Any special considerations
Planning checklist:
- No duplicate titles across slides
- Logical flow from slide to slide
- Appropriate layout for each content type
- Content fits the chosen layout
- Batches are logically grouped (5 slides max each)
- VARIETY CHECK: Content-slide used <25% of total slides
- VARIETY CHECK: No more than 2-3 consecutive slides with same layout
- VARIETY CHECK: Visual layouts (cards, stats, columns, hero) are 50%+ of slides
- VARIETY CHECK: Each content-slide was evaluated against decision tree first
After planning, briefly present the plan before generating.
Example of good variety distribution for 30-slide presentation:
- Content-slide: 6-7 slides (20-23%)
- Section breaks: 5 slides (17%)
- Visual layouts: 15-16 slides (50-53%)
- Multi-card: 3-4 slides
- Two-column: 2-3 slides
- Stats: 1-2 slides
- Floating-cards: 2-3 slides
- Circular-hero: 1-2 slides
- Giant-focus/Bold-diagonal: 2-3 slides
- Quote: 1 slide
- Title/Closing: 2-3 slides (7-10%)
在生成任何幻灯片前,请创建书面规划。
这适用于单张幻灯片、分批次幻灯片和完整演示文稿。规划可防止:
- 幻灯片间内容重复
- 布局选择错误
- 遗漏关键信息
- 流程和结构不合理
创建幻灯片规划表:
markdown
| 序号 | 布局 | 标题 | 核心内容 | 备注 |
|---|--------|-------|-------------|-------|
| 1 | title-slide | [标题] | [副标题、作者] | 开场幻灯片 |
| 2 | content-slide | [标题] | [3-4个项目符号] | 核心概念 |
| 3 | stats-slide | [标题] | [2-3个指标] | 影响力数据 |
| ... | ... | ... | ... | ... |为每张幻灯片指定:
- 幻灯片编号 - 在演示文稿中的位置
- 布局 - 要使用的布局库布局
- 标题 - 确切的标题文本(检查是否重复!)
- 核心内容 - 项目符号、统计数据、引用等
- 备注 - 任何特殊注意事项
规划检查表:
- 幻灯片间无重复标题
- 幻灯片间逻辑流程顺畅
- 每个内容类型都使用了合适的布局
- 内容适合所选布局
- 按逻辑分组为批次(每批最多5张幻灯片)
- 多样性检查:content-slide占比<25%
- 多样性检查:连续使用同一布局不超过2-3次
- 多样性检查:视觉化布局占演示文稿的50%以上
- 多样性检查:每个content-slide都经过决策树评估
规划完成后,在生成前简要向用户展示规划。
30张幻灯片演示文稿的良好多样性分布示例:
- content-slide:6-7张(20-23%)
- 节分隔:5张(17%)
- 视觉化布局:15-16张(50-53%)
- 多卡片:3-4张
- 双栏:2-3张
- 统计数据:1-2张
- 悬浮卡片:2-3张
- 环形主视觉:1-2张
- 超大焦点/粗斜体:2-3张
- 引用:1张
- 标题/结尾:2-3张(7-10%)
Step 4: Content Adaptation
步骤4:内容适配
For each slide in your plan:
针对规划中的每张幻灯片:
Presentation Text Formatting Rules
演示文稿文本格式规则
IMPORTANT: Follow these rules for ALL slide text.
| Element | Rule | Example |
|---|---|---|
| Titles | No trailing periods or commas | "Why AI Matters" not "Why AI Matters." |
| Subtitles | No trailing punctuation | "The future of coding" not "The future of coding." |
| Bullet points | No trailing periods (unless full sentences) | "Faster development" not "Faster development." |
| Headlines | Minimal punctuation, no ellipsis | "What's Next" not "What's Next..." |
| Stats/Numbers | Clean format, no trailing punctuation | "50%" not "50%." |
| CTAs | No trailing punctuation | "Get Started" not "Get Started." |
| Labels | Short, no punctuation | "Step 1" not "Step 1:" |
Avoid:
- Trailing periods on titles, bullets, labels
- Ellipsis (...) in headlines
- Excessive commas in short phrases
- Colons at end of labels/headers
- Semicolons in bullet points
Exception: Full sentence descriptions or quotes may use appropriate punctuation.
重要提示:所有幻灯片文本都必须遵循这些规则。
| 元素 | 规则 | 示例 |
|---|---|---|
| 标题 | 末尾无句号或逗号 | "AI为何重要" 而非 "AI为何重要。" |
| 副标题 | 末尾无标点符号 | "编码的未来" 而非 "编码的未来。" |
| 项目符号 | 末尾无句号(除非是完整句子) | "更快的开发速度" 而非 "更快的开发速度。" |
| 标题 | 尽量少用标点,无省略号 | "下一步是什么" 而非 "下一步是什么..." |
| 统计数据/数字 | 格式简洁,末尾无标点 | "50%" 而非 "50%." |
| 行动号召(CTA) | 末尾无标点 | "开始使用" 而非 "开始使用。" |
| 标签 | 简短,无标点 | "步骤1" 而非 "步骤1:" |
避免:
- 标题、项目符号、标签末尾使用句号
- 标题中使用省略号(...)
- 短句中使用过多逗号
- 标签/标题末尾使用冒号
- 项目符号中使用分号
例外: 完整句子描述或引用可使用适当的标点符号。
Brand Value Mapping
品牌值映射
-
Map brand.json values to layout placeholders:
Layout Placeholder brand.json Path BRAND_BGcolors.backgroundBRAND_BG_ALTcolors.background_altBRAND_TEXTcolors.textBRAND_TEXT_SECONDARYcolors.text_secondaryBRAND_ACCENTcolors.accentBRAND_ACCENT_SECONDARYcolors.accent_secondaryBRAND_ACCENT_TERTIARYcolors.accent_tertiaryBRAND_CODE_BGcolors.code_bgBRAND_CARD_BGcolors.card_bgBRAND_CARD_BG_ALTcolors.card_bg_altBRAND_HEADING_FONTfonts.headingBRAND_BODY_FONTfonts.bodyBRAND_CODE_FONTfonts.codeNote: All color values in brand.json are hex WITHOUT theprefix.# -
Write content in brand's voice (from tone-of-voice.md)
-
Preserve layout structure (decorative elements, spacing, hierarchy)
-
将brand.json值映射到布局占位符:
布局占位符 brand.json路径 BRAND_BGcolors.backgroundBRAND_BG_ALTcolors.background_altBRAND_TEXTcolors.textBRAND_TEXT_SECONDARYcolors.text_secondaryBRAND_ACCENTcolors.accentBRAND_ACCENT_SECONDARYcolors.accent_secondaryBRAND_ACCENT_TERTIARYcolors.accent_tertiaryBRAND_CODE_BGcolors.code_bgBRAND_CARD_BGcolors.card_bgBRAND_CARD_BG_ALTcolors.card_bg_altBRAND_HEADING_FONTfonts.headingBRAND_BODY_FONTfonts.bodyBRAND_CODE_FONTfonts.code注意: brand.json中的所有颜色值都是不带前缀的十六进制码。# -
按照品牌语气撰写内容(来自tone-of-voice.md)
-
保留布局结构(装饰元素、间距、层次结构)
Step 5: Batch Generation (CRITICAL)
步骤5:批量生成(关键)
MAXIMUM 5 SLIDES PER BATCH. This is a hard limit.
When generating multiple slides:
- Generate 1-5 slides in a single PPTX file
- STOP and review the output before generating more
- Only after validation passes, continue with the next batch
- Repeat until all slides are generated
Why batching matters:
- Prevents token limit errors
- Allows quality checks between batches
- Catches issues early before they propagate
⚠️ CRITICAL BACKGROUND BUG FIX:
EVERY slide MUST have its background explicitly set. If you don't set and , the slide will use PowerPoint's default WHITE background, making text unreadable on dark-themed brands.
slide.background.fill.solid()slide.background.fill.fore_color.rgbMandatory for every slide:
python
slide = prs.slides.add_slide(prs.slide_layouts[6])
slide.background.fill.solid() # ← REQUIRED
slide.background.fill.fore_color.rgb = hex_to_rgb(BRAND_BG) # ← REQUIREDThis is especially critical when:
- Generating multiple batches (each batch is a new Presentation object)
- Using helper functions to create slides
- Combining separate PPTX files
Execution:
PREFERRED: Use heredoc (no files created):
bash
uv run --with python-pptx==1.0.2 python << 'EOF'每批最多生成5张幻灯片。这是硬性限制。
生成多张幻灯片时:
- 在单个PPTX文件中生成1-5张幻灯片
- 停止并检查输出结果,然后再继续生成
- 仅在验证通过后,继续生成下一批
- 重复此过程,直到所有幻灯片生成完成
批量生成的重要性:
- 避免令牌限制错误
- 允许在批次之间进行质量检查
- 尽早发现问题,防止问题扩大
⚠️ 关键背景漏洞修复:
每张幻灯片都必须显式设置背景。 如果您未设置和,幻灯片将使用PowerPoint默认的白色背景,这会使深色主题品牌的文本无法阅读。
slide.background.fill.solid()slide.background.fill.fore_color.rgb每张幻灯片都必须执行以下操作:
python
slide = prs.slides.add_slide(prs.slide_layouts[6])
slide.background.fill.solid() # ← 必须设置
slide.background.fill.fore_color.rgb = hex_to_rgb(BRAND_BG) # ← 必须设置在以下情况下,此操作尤为关键:
- 生成多个批次(每个批次都是一个新的Presentation对象)
- 使用辅助函数创建幻灯片
- 合并多个PPTX文件
执行方式:
首选:使用 heredoc(不创建文件):
bash
uv run --with python-pptx==1.0.2 python << 'EOF'[Adapted code with brand values and content]
[包含品牌值和内容的适配代码]
EOF
**IF heredoc fails (Windows issues): Use temp directory:**
```bashEOF
**如果heredoc失败(Windows问题):使用临时目录:**
```bashCreate temp directory if needed
必要时创建临时目录
mkdir -p .claude/skills/pptx-generator/.tmp
mkdir -p .claude/skills/pptx-generator/.tmp
Write script to temp directory
将脚本写入临时目录
(create file at .claude/skills/pptx-generator/.tmp/gen.py)
—
Execute
—
uv run --with python-pptx==1.0.2 python .claude/skills/pptx-generator/.tmp/gen.py
#(在.claude/skills/pptx-generator/.tmp/gen.py路径创建文件)
MANDATORY: Clean up immediately after execution
执行脚本
rm .claude/skills/pptx-generator/.tmp/gen.py
**CRITICAL: Never create Python files in the repository root.** Always use heredoc or temp directory within the skill folder.uv run --with python-pptx==1.0.2 python .claude/skills/pptx-generator/.tmp/gen.py
Step 6: Quality Validation (MANDATORY)
强制要求:执行后立即清理
After EVERY batch, validate before continuing:
- Open the generated PPTX and visually inspect it
- Check for these common issues:
| Issue | What to Look For | Fix |
|---|---|---|
| White background | Slide has white background instead of brand color | Add slide.background.fill.solid() and set fore_color.rgb |
| Duplicate titles | Same title text appearing twice on a slide | Remove duplicate text boxes |
| Spacing problems | Title too close to subtitle/content | Increase Y position of lower elements |
| Text overflow | Content extending beyond slide bounds | Reduce font size or split content |
| Missing elements | Decorative elements not rendering | Check shape positions and colors |
| Wrong colors | Colors not matching brand | Verify hex values (no # prefix in code) |
| Bad punctuation | Trailing periods/commas on titles/bullets | Remove unnecessary punctuation |
-
If issues found:
- Fix the current batch before continuing
- Note the issue to avoid repeating in future batches
-
If validation passes:
- Continue to next batch of slides
rm .claude/skills/pptx-generator/.tmp/gen.py
**关键:永远不要在仓库根目录创建Python文件。请始终使用heredoc或技能文件夹内的临时目录。**Step 7: Output
步骤6:质量验证(必须执行)
Use the output settings from config.json:
| Config Setting | Default | Description |
|---|---|---|
| | Where to save files |
| | File naming pattern |
| | Keep part files after combining |
Resolve placeholders:
- → Brand folder name
{brand} - → Presentation name from user request
{name} - → Current date (YYYY-MM-DD)
{date}
bash
undefined每批生成完成后,在继续前必须进行验证:
- 打开生成的PPTX文件并进行视觉检查
- 检查以下常见问题:
| 问题 | 检查要点 | 修复方法 |
|---|---|---|
| 白色背景 | 幻灯片使用白色背景而非品牌颜色 | 添加slide.background.fill.solid()并设置fore_color.rgb |
| 重复标题 | 同一幻灯片上出现相同的标题文本 | 删除重复的文本框 |
| 间距问题 | 标题与副标题/内容间距过近 | 增加下方元素的Y轴位置 |
| 文本溢出 | 内容超出幻灯片边界 | 减小字体大小或拆分内容 |
| 元素缺失 | 装饰元素未渲染 | 检查形状位置和颜色 |
| 颜色错误 | 颜色与品牌不符 | 验证十六进制值(代码中不带#前缀) |
| 标点错误 | 标题/项目符号末尾有句号/逗号 | 删除不必要的标点 |
-
如果发现问题:
- 修复当前批次后再继续
- 记录问题,避免在未来批次中重复出现
-
如果验证通过:
- 继续生成下一批幻灯片
Create output directory from config
步骤7:输出
mkdir -p {resolved-output-directory}
**Batched generation workflow:**
1. Generate each batch as `{name}-part1.pptx`, `{name}-part2.pptx`, etc.
2. Validate each batch before continuing
3. After ALL batches complete, **combine into final file** (if `auto_combine` is true)
4. Delete part files (if `keep_parts` is false)使用config.json中的输出设置:
| 配置设置 | 默认值 | 描述 |
|---|---|---|
| | 文件保存位置 |
| | 文件命名模式 |
| | 合并后是否保留分批次文件 |
解析占位符:
- → 品牌文件夹名称
{brand} - → 用户请求中的演示文稿名称
{name} - → 当前日期(YYYY-MM-DD)
{date}
bash
undefinedStep 8: Combine Batches (for multi-batch presentations)
根据配置创建输出目录
🚨 CRITICAL BUG WARNING: BACKGROUND MUST BE SET WHEN COMBINING 🚨
When combining presentations, creates slides with DEFAULT WHITE BACKGROUNDS. Shape copying does NOT copy the slide background property. You MUST explicitly set the background immediately after creating each new slide.
add_slide()This is the most common source of white slides in combined presentations.
After all batches are validated, combine them into a single PPTX:
bash
uv run --with python-pptx==1.0.2 python << 'SCRIPT'
from pptx import Presentation
from pptx.dml.color import RGBColor
from pathlib import Path
import shutil
def hex_to_rgb(hex_color: str) -> RGBColor:
h = hex_color.lstrip("#")
return RGBColor(int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16))mkdir -p {解析后的输出目录}
**批量生成工作流程:**
1. 将每批生成为`{name}-part1.pptx`、`{name}-part2.pptx`等
2. 每批生成后进行验证
3. **所有批次完成后,合并为最终文件**(如果`auto_combine`为true)
4. 删除分批次文件(如果`keep_parts`为false)Brand background color (get from brand.json)
步骤8:合并批次(适用于多批次演示文稿)
BRAND_BG = "REPLACE_WITH_BRAND_BACKGROUND" # e.g., "07090F"
🚨 关键漏洞警告:合并时必须设置背景 🚨
合并演示文稿时,会创建默认白色背景的幻灯片。形状复制不会复制幻灯片背景属性。您必须在创建每张新幻灯片后立即显式设置背景。
add_slide()这是合并演示文稿中出现白色幻灯片的最常见原因。
所有批次验证通过后,将它们合并为单个PPTX文件:
bash
uv run --with python-pptx==1.0.2 python << 'SCRIPT'
from pptx import Presentation
from pptx.dml.color import RGBColor
from pathlib import Path
import shutil
def hex_to_rgb(hex_color: str) -> RGBColor:
h = hex_color.lstrip("#")
return RGBColor(int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16))List all part files in order
品牌背景色(从brand.json获取)
output_dir = Path("output/{brand-name}")
part_files = sorted(output_dir.glob("{name}-part*.pptx"))
if len(part_files) > 1:
# Start with first part as base
combined = Presentation(part_files[0])
# Add slides from remaining parts
for part_file in part_files[1:]:
part_prs = Presentation(part_file)
for slide in part_prs.slides:
# Copy slide layout and add to combined
blank_layout = combined.slide_layouts[6]
new_slide = combined.slides.add_slide(blank_layout)
# 🚨 CRITICAL: Set background IMMEDIATELY after creating slide
# PowerPoint defaults to WHITE background - this MUST be set before copying shapes
new_slide.background.fill.solid()
new_slide.background.fill.fore_color.rgb = hex_to_rgb(BRAND_BG)
# Copy all shapes from source slide
for shape in slide.shapes:
# Clone shape to new slide
el = shape.element
new_slide.shapes._spTree.insert_element_before(
el, 'p:extLst'
)
# Save combined file
combined.save(output_dir / "{name}-final.pptx")
print(f"Combined {len(part_files)} parts into {name}-final.pptx")
# MANDATORY: Clean up part files - user should only see final file
for part_file in part_files:
part_file.unlink()
print(f"Deleted {part_file.name}")else:
# Single part, just rename
shutil.move(part_files[0], output_dir / "{name}-final.pptx")
SCRIPT
**Final output:** `output/{brand-name}/{name}-final.pptx`
**Why this bug happens:**
- `combined.slides.add_slide()` creates a NEW slide object with PowerPoint's default white background
- `shapes._spTree.insert_element_before()` copies shapes (text, rectangles, images) but NOT the background
- The background is a slide property, not a shape, so it must be set separately
- Without explicit background setting, slides 6-30 (or however many are added after the base) will be white
**Testing checklist after combining:**
- [ ] Open the combined PPTX
- [ ] Scroll through ALL slides (not just the first few)
- [ ] Verify EVERY slide has the correct background color
- [ ] If any white slides found, the combination code is missing the background setting
---BRAND_BG = "替换为品牌背景色" # 例如:"07090F"
Mode 2: Generate LinkedIn Carousels
按顺序列出所有分批次文件
LinkedIn carousels are multi-page PDFs in square (1:1) format. Each page is a swipeable slide.
output_dir = Path("output/{品牌名称}")
part_files = sorted(output_dir.glob("{名称}-part*.pptx"))
if len(part_files) > 1:
# 以第一个批次为基础
combined = Presentation(part_files[0])
# 添加剩余批次的幻灯片
for part_file in part_files[1:]:
part_prs = Presentation(part_file)
for slide in part_prs.slides:
# 复制幻灯片布局并添加到合并后的演示文稿
blank_layout = combined.slide_layouts[6]
new_slide = combined.slides.add_slide(blank_layout)
# 🚨 关键:创建幻灯片后立即设置背景
# PowerPoint默认使用白色背景 - 必须在复制形状前设置
new_slide.background.fill.solid()
new_slide.background.fill.fore_color.rgb = hex_to_rgb(BRAND_BG)
# 复制源幻灯片的所有形状
for shape in slide.shapes:
# 克隆形状到新幻灯片
el = shape.element
new_slide.shapes._spTree.insert_element_before(
el, 'p:extLst'
)
# 保存合并后的文件
combined.save(output_dir / "{名称}-final.pptx")
print(f"已将{len(part_files)}个批次合并为{名称}-final.pptx")
# 强制要求:清理分批次文件 - 用户应只看到最终文件
for part_file in part_files:
part_file.unlink()
print(f"已删除{part_file.name}")else:
# 单个批次,只需重命名
shutil.move(part_files[0], output_dir / "{名称}-final.pptx")
SCRIPT
**最终输出:** `output/{品牌名称}/{名称}-final.pptx`
**漏洞原因:**
- `combined.slides.add_slide()`会创建一个带有PowerPoint默认白色背景的新幻灯片对象
- `shapes._spTree.insert_element_before()`会复制形状(文本、矩形、图片),但不会复制背景
- 背景是幻灯片属性,而非形状属性,因此必须单独设置
- 如果不显式设置背景,第6-30张幻灯片(或基础批次之后添加的任何幻灯片)将是白色的
**合并后的测试检查表:**
- [ ] 打开合并后的PPTX文件
- [ ] 滚动浏览**所有**幻灯片(不只是前几张)
- [ ] 验证**每张**幻灯片都有正确的背景颜色
- [ ] 如果发现任何白色幻灯片,说明合并代码缺少背景设置
---Carousel vs Presentation
模式2:生成LinkedIn轮播图
| Aspect | Presentation | Carousel |
|---|---|---|
| Dimensions | 16:9 (13.333" × 7.5") | 1:1 (7.5" × 7.5") |
| Layouts | | |
| Output | PPTX | PDF (via PPTX conversion) |
| Slides | 10-50+ typical | 5-10 optimal |
| Text size | Standard | Larger (mobile readable) |
| Content | Detailed | One idea per slide |
LinkedIn轮播图是正方形(1:1)格式的多页PDF。每页都是可滑动的幻灯片。
Step 1: Brand Discovery
轮播图与演示文稿的区别
Same as Mode 1 - read brand.json, config.json, and tone-of-voice.md.
| 方面 | 演示文稿 | 轮播图 |
|---|---|---|
| 尺寸 | 16:9(13.333" × 7.5") | 1:1(7.5" × 7.5") |
| 布局 | | |
| 输出 | PPTX | PDF(通过PPTX转换) |
| 幻灯片数量 | 通常10-50+ | 最佳5-10张 |
| 文本大小 | 标准 | 更大(适合移动设备阅读) |
| 内容 | 详细 | 每页一个核心观点 |
Step 2: Carousel Layout Discovery
步骤1:品牌发现
Discover carousel-specific layouts:
Glob: .claude/skills/pptx-generator/cookbook/carousels/*.pyAvailable carousel layouts:
| Layout | Purpose | Best For |
|---|---|---|
| Opening attention-grabber | First slide only |
| One key point with explanation | Body content |
| Numbered list item with big number | Listicles, steps |
| Quote with attribution | Social proof, insights |
| Call to action | Last slide only |
Read frontmatters to understand limits and constraints for each.
与模式1相同 - 读取brand.json、config.json和tone-of-voice.md。
Step 3: Carousel Planning
步骤2:轮播图布局发现
Typical carousel structure (5-10 slides):
markdown
| # | Layout | Content |
|---|--------|---------|
| 1 | hook-slide | Attention-grabbing hook |
| 2-8 | single-point or numbered-point | Body content |
| 9/10 | cta-slide | Call to action |Carousel content rules:
- One idea per slide - Don't cram multiple points
- Large text - Must be readable on mobile
- Short copy - Max 50 chars for headlines, 150 for body
- Clear flow - Each slide should make sense if viewed alone
- Strong hook - First slide stops the scroll
- Clear CTA - Last slide tells them what to do
发现轮播图专用布局:
Glob: .claude/skills/pptx-generator/cookbook/carousels/*.py可用轮播图布局:
| 布局 | 用途 | 最佳适用场景 |
|---|---|---|
| 开场吸引注意力 | 仅第一张幻灯片 |
| 单个核心观点及解释 | 主体内容 |
| 带大数字的编号列表项 | 列表文章、步骤 |
| 带署名的引用 | 社交证明、见解 |
| 行动号召 | 仅最后一张幻灯片 |
读取前置元数据,了解每个布局的限制和约束。
Step 4: Generate Carousel
步骤3:轮播图规划
Carousel dimensions (square 1:1):
python
prs.slide_width = Inches(7.5)
prs.slide_height = Inches(7.5)Generate all slides as a single PPTX file (carousels are typically 5-10 slides, so batching rarely needed).
Execution:
bash
uv run --with python-pptx==1.0.2 python << 'SCRIPT'典型轮播图结构(5-10张幻灯片):
markdown
| 序号 | 布局 | 内容 |
|---|--------|---------|
| 1 | hook-slide | 吸引注意力的开场 |
| 2-8 | single-point或numbered-point | 主体内容 |
| 9/10 | cta-slide | 行动号召 |轮播图内容规则:
- 每页一个核心观点 - 不要塞入多个要点
- 大文本 - 必须适合移动设备阅读
- 简短文案 - 标题最多50个字符,正文最多150个字符
- 清晰的流程 - 每张幻灯片单独查看时也应表意清晰
- 有力的开场 - 第一张幻灯片要吸引用户停止滚动
- 明确的行动号召 - 最后一张幻灯片告诉用户要做什么
Carousel generation code with 7.5" x 7.5" dimensions
步骤4:生成轮播图
SCRIPT
undefined轮播图尺寸(正方形1:1):
python
prs.slide_width = Inches(7.5)
prs.slide_height = Inches(7.5)将所有幻灯片生成为单个PPTX文件(轮播图通常为5-10张幻灯片,因此很少需要批量生成)。
执行方式:
bash
uv run --with python-pptx==1.0.2 python << 'SCRIPT'Step 5: Export to PDF
包含7.5" x 7.5"尺寸的轮播图生成代码
LinkedIn requires PDF for carousel posts. Convert the PPTX to PDF:
Option A: Using LibreOffice (recommended)
bash
libreoffice --headless --convert-to pdf --outdir output/rasmus output/rasmus/carousel.pptxOption B: Using soffice
bash
soffice --headless --convert-to pdf output/rasmus/carousel.pptxNote: LibreOffice must be installed. On macOS:
brew install --cask libreofficeSCRIPT
undefinedStep 6: Output
步骤5:导出为PDF
Save both files:
- - Editable source
output/{brand}/{name}-carousel.pptx - - LinkedIn-ready
output/{brand}/{name}-carousel.pdf
LinkedIn轮播帖需要PDF格式。将PPTX转换为PDF:
选项A:使用LibreOffice(推荐)
bash
libreoffice --headless --convert-to pdf --outdir output/rasmus output/rasmus/carousel.pptx选项B:使用soffice
bash
soffice --headless --convert-to pdf output/rasmus/carousel.pptx注意: 必须安装LibreOffice。在macOS上:
brew install --cask libreofficeCarousel Checklist
步骤6:输出
- Read brand configuration
- Read carousel layout frontmatters from
cookbook/carousels/ - Plan carousel structure (hook → body → CTA)
- Keep text SHORT (check character limits in frontmatter)
- Use 7.5" × 7.5" dimensions
- Generate PPTX
- Validate output
- Export to PDF
- Test PDF in LinkedIn preview
保存两个文件:
- - 可编辑源文件
output/{品牌}/{名称}-carousel.pptx - - 适用于LinkedIn的版本
output/{品牌}/{名称}-carousel.pdf
Mode 3: Layout CRUD Operations
轮播图检查表
Creating New Layouts
—
When user requests a new layout type:
-
Study existing layouts for patterns:
Glob: .claude/skills/pptx-generator/cookbook/*.pyRead 2-3 layouts to understand:- Code structure and imports
- How brand variables are used
- Decorative element patterns
- Positioning conventions
-
Design with these quality standards:MUST be production-ready:
- Professional, polished appearance
- Visually engaging (not plain or generic)
- Distinctive decorative elements
- Strong visual hierarchy
- Proper use of whitespace
Use appropriate elements:- Charts - Pie, doughnut, bar, column for data visualization
- Images - Placeholder shapes for screenshots, photos
- Shapes - Circles, rectangles, parallelograms for visual interest
- Cards - Floating cards with shadows for depth
- Geometric patterns - Bold shapes anchored to corners/edges
Avoid:- Plain text-only layouts
- Generic bullet points without styling
- Tiny decorative elements that don't make impact
- Centered-everything boring compositions
-
Write the layout file with detailed frontmatter:⚠️ CRITICAL: The frontmatter is documentation for future AI agents.Every layout MUST include comprehensive frontmatter that teaches future AI agents:
- WHEN to use this layout (and when NOT to)
- HOW to use it correctly
- WHAT limits and constraints exist
- WHY certain choices matter
python#!/usr/bin/env -S uv run # /// script # requires-python = ">=3.11" # dependencies = [ # "python-pptx==1.0.2", # ] # /// # /// layout # name = "layout-name" # purpose = "When to use this layout - be specific" # best_for = [ # "Ideal use case 1", # "Ideal use case 2", # ] # avoid_when = [ # "Situation to avoid 1 - and what to use instead", # "Situation to avoid 2 - and what to use instead", # ] # max_items = 5 # or other relevant limits # instructions = [ # "Specific tip 1", # "Specific tip 2", # ] # /// """ LAYOUT: [Name] PURPOSE: [When to use this layout - be specific] CUSTOMIZE: - [List customizable elements] """ # ... implementationRequired frontmatter fields (be DETAILED and SPECIFIC):Field Description Example nameLayout identifier (matches filename) "multi-card-slide"purposeClear one-line description "Multiple items as cards in a row, 3-5 cards"best_forDetailed array of ideal scenarios ["Exactly 3 related features", "Process with 3 steps"]avoid_whenSpecific situations with alternatives ["More than 3 items - use multi-card-slide instead"]instructionsActionable tips for correct usage ["Card titles must be SHORT: 1-2 words, max 15 chars"]Optional but recommended fields:Field Description Example /max_*min_*Hard limits on items ,max_cards = 3min_surrounding_items = 4*_max_charsCharacter limits for text card_title_max_chars = 15Writing good frontmatter:✅ DO: Be specific and actionablepython# avoid_when = [ # "More than 3 items - use multi-card-slide instead", # "Long card titles (over 15 characters) - abbreviate or use content-slide", # ] # instructions = [ # "EXACTLY 3 cards required - no more, no less", # "Card titles must be SHORT: 1-2 words, max 15 characters", # "If titles are too long, abbreviate or use different layout", # ]❌ DON'T: Be vague or unhelpfulpython# avoid_when = ["Too many items", "Wrong content"] # instructions = ["Use correctly", "Follow the pattern"]Think of frontmatter as teaching a colleague - what would they need to know to use this layout correctly without asking you questions? -
Save to cookbook:
.claude/skills/pptx-generator/cookbook/{layout-name}-slide.py -
Test by generating a sample with the new layout
- 读取品牌配置
- 读取中的轮播图布局前置元数据
cookbook/carousels/ - 规划轮播图结构(开场 → 主体 → 行动号召)
- 保持文本简短(检查前置元数据中的字符限制)
- 使用7.5" × 7.5"尺寸
- 生成PPTX
- 验证输出
- 导出为PDF
- 在LinkedIn预览中测试PDF
Editing Existing Layouts
模式3:布局CRUD操作
—
创建新布局
-
Find the layout:
Glob: .claude/skills/pptx-generator/cookbook/*{name}*.py -
Read and understand current structure including the frontmatter
-
Make modifications while preserving:
- The script header format
- Brand variable naming conventions
- Docstring format (LAYOUT, PURPOSE, CUSTOMIZE)
-
Update the frontmatter if your changes affect:
- What the layout is best for ()
best_for - When to avoid it ()
avoid_when - Item limits (,
max_*)min_* - Usage instructions ()
instructions
- What the layout is best for (
-
Save back to the same file
-
Test the modified layout
当用户请求新布局类型时:
-
研究现有布局的模式:
Glob: .claude/skills/pptx-generator/cookbook/*.py读取2-3个布局,了解:- 代码结构和导入
- 品牌变量的使用方式
- 装饰元素模式
- 定位约定
-
按照以下质量标准设计:必须达到生产就绪级别:
- 专业、精致的外观
- 视觉吸引力强(非平淡或通用)
- 独特的装饰元素
- 清晰的视觉层次结构
- 合理使用留白
使用适当的元素:- 图表 - 饼图、环形图、条形图、柱状图,用于数据可视化
- 图片 - 用于截图、照片的占位符形状
- 形状 - 圆形、矩形、平行四边形,增加视觉趣味
- 卡片 - 带阴影的悬浮卡片,增加层次感
- 几何图案 - 锚定在角落/边缘的粗体形状
避免:- 纯文本布局
- 无样式的通用项目符号
- 无影响力的微小装饰元素
- 所有元素居中的乏味布局
-
编写带有详细前置元数据的布局文件:⚠️ 关键:前置元数据是为未来AI代理准备的文档。每个布局都必须包含全面的前置元数据,向未来的AI代理说明:
- 何时使用此布局(以及何时不使用)
- 如何正确使用
- 存在哪些限制和约束
- 某些选择的原因
python#!/usr/bin/env -S uv run # /// script # requires-python = ">=3.11" # dependencies = [ # "python-pptx==1.0.2", # ] # /// # /// layout # name = "layout-name" # purpose = "何时使用此布局 - 具体说明" # best_for = [ # "理想场景1", # "理想场景2", # ] # avoid_when = [ # "要避免的场景1 - 以及替代方案", # "要避免的场景2 - 以及替代方案", # ] # max_items = 5 # 或其他相关限制 # instructions = [ # "具体提示1", # "具体提示2", # ] # /// """ 布局:[名称] 用途:[何时使用此布局 - 具体说明] 自定义项: - [可自定义元素列表] """ # ... 实现代码必填前置元数字段(必须详细且具体):字段 描述 示例 name布局标识符(与文件名匹配) "multi-card-slide"purpose清晰的单行描述 "多个内容项以卡片形式排列,3-5张卡片"best_for详细的理想场景数组 ["恰好3个相关功能", "包含3个步骤的流程"]avoid_when具体的不适用场景及替代方案 ["超过3个内容项 - 请改用multi-card-slide"]instructions可操作的正确使用提示 ["卡片标题必须简短:1-2个单词,最多15个字符"]可选但推荐的字段:字段 描述 示例 /max_*min_*内容项的硬性限制 ,max_cards = 3min_surrounding_items = 4*_max_chars文本的字符限制 card_title_max_chars = 15编写优质前置元数据:✅ 正确做法: 具体且可操作python# avoid_when = [ # "超过3个内容项 - 请改用multi-card-slide", # "卡片标题过长(超过15个字符) - 缩写或使用content-slide", # ] # instructions = [ # "必须恰好3张卡片 - 不能多也不能少", # "卡片标题必须简短:1-2个单词,最多15个字符", # "如果标题过长,请缩写或使用其他布局", # ]❌ 错误做法: 模糊或无用python# avoid_when = ["内容项过多", "内容不合适"] # instructions = ["正确使用", "遵循模式"]将前置元数据视为向同事传授知识 - 他们需要知道什么才能正确使用此布局而无需向您提问? -
保存到布局库:
.claude/skills/pptx-generator/cookbook/{布局名称}-slide.py -
通过生成示例测试新布局
Updating/Improving Layouts
编辑现有布局
When asked to improve layout quality:
-
Analyze current weaknesses:
- Is it visually engaging?
- Does it have enough decorative elements?
- Is there good visual hierarchy?
- Does it use space well?
-
Apply improvements:
- Add bold geometric shapes
- Improve color usage
- Add depth (shadows, overlapping)
- Better typography sizing
- More distinctive decorative elements
-
Preserve functionality - Don't break what works
-
Review and enhance frontmatter:
- Are and
best_forstill accurate?avoid_when - Do reflect any new constraints?
instructions - Add any lessons learned from the improvements
- Update limits if element sizes/counts changed
- Are
-
找到布局:
Glob: .claude/skills/pptx-generator/cookbook/*{名称}*.py -
读取并理解当前结构,包括前置元数据
-
进行修改,同时保留:
- 脚本头格式
- 品牌变量命名约定
- 文档字符串格式(LAYOUT、PURPOSE、CUSTOMIZE)
-
如果您的更改影响以下内容,请更新前置元数据:
- 布局的最佳适用场景()
best_for - 不适用场景()
avoid_when - 内容项限制(、
max_*)min_* - 使用说明()
instructions
- 布局的最佳适用场景(
-
保存到原文件
-
测试修改后的布局
Deleting Layouts
更新/优化布局
Simply remove the file:
bash
rm .claude/skills/pptx-generator/cookbook/{layout-name}.py当要求优化布局质量时:
-
分析当前弱点:
- 视觉吸引力强吗?
- 装饰元素足够吗?
- 视觉层次结构清晰吗?
- 空间使用合理吗?
-
进行优化:
- 添加粗体几何形状
- 改进颜色使用
- 增加层次感(阴影、重叠)
- 优化字体大小
- 添加更独特的装饰元素
-
保留功能 - 不要破坏现有可用功能
-
审查并增强前置元数据:
- 和
best_for仍然准确吗?avoid_when - 是否反映了任何新的约束?
instructions - 添加从优化中获得的经验教训
- 如果元素大小/数量发生变化,请更新限制
Editing Existing PPTX Files
删除布局
When user provides an existing PPTX:
-
Read the file:python
from pptx import Presentation prs = Presentation("path/to/existing.pptx") -
Analyze: Number of slides, styling, content structure
-
Apply changes: Add/remove slides, update content, modify styling
-
Save to output directory (don't overwrite original unless requested)
只需删除文件:
bash
rm .claude/skills/pptx-generator/cookbook/{布局名称}.pyTechnical Reference
编辑现有PPTX文件
Slide dimensions (16:9):
- Width: 13.333 inches
- Height: 7.5 inches
- Safe margins: 0.5 inches
Always use:
- Blank layout:
prs.slide_layouts[6] - python-pptx version: 1.0.2
Common imports:
python
from pptx import Presentation
from pptx.chart.data import CategoryChartData
from pptx.dml.color import RGBColor
from pptx.enum.chart import XL_CHART_TYPE, XL_LEGEND_POSITION
from pptx.enum.shapes import MSO_SHAPE
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.util import Inches, PtChart types available:
- - Pie chart
XL_CHART_TYPE.PIE - - Doughnut chart
XL_CHART_TYPE.DOUGHNUT - - Horizontal bars
XL_CHART_TYPE.BAR_CLUSTERED - - Vertical columns
XL_CHART_TYPE.COLUMN_CLUSTERED - - Line chart
XL_CHART_TYPE.LINE
Adding charts:
python
chart_data = CategoryChartData()
chart_data.categories = ["A", "B", "C"]
chart_data.add_series("Values", [10, 20, 30])
slide.shapes.add_chart(
XL_CHART_TYPE.DOUGHNUT,
Inches(x), Inches(y),
Inches(width), Inches(height),
chart_data
)Adding images:
python
slide.shapes.add_picture(
"path/to/image.png",
Inches(x), Inches(y),
width=Inches(w) # Height auto-calculated
)当用户提供现有PPTX文件时:
-
读取文件:python
from pptx import Presentation prs = Presentation("path/to/existing.pptx") -
分析: 幻灯片数量、样式、内容结构
-
应用更改: 添加/删除幻灯片、更新内容、修改样式
-
保存到输出目录(除非用户要求,否则不要覆盖原始文件)
Preview All Layouts
技术参考
To see all available layouts:
bash
uv run .claude/skills/pptx-generator/generate-cookbook-preview.pyThis generates with every layout.
cookbook-preview.pptx幻灯片尺寸(16:9):
- 宽度:13.333英寸
- 高度:7.5英寸
- 安全边距:0.5英寸
始终使用:
- 空白布局:
prs.slide_layouts[6] - python-pptx版本:1.0.2
常见导入:
python
from pptx import Presentation
from pptx.chart.data import CategoryChartData
from pptx.dml.color import RGBColor
from pptx.enum.chart import XL_CHART_TYPE, XL_LEGEND_POSITION
from pptx.enum.shapes import MSO_SHAPE
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.util import Inches, Pt可用图表类型:
- - 饼图
XL_CHART_TYPE.PIE - - 环形图
XL_CHART_TYPE.DOUGHNUT - - 水平条形图
XL_CHART_TYPE.BAR_CLUSTERED - - 垂直柱状图
XL_CHART_TYPE.COLUMN_CLUSTERED - - 折线图
XL_CHART_TYPE.LINE
添加图表:
python
chart_data = CategoryChartData()
chart_data.categories = ["A", "B", "C"]
chart_data.add_series("Values", [10, 20, 30])
slide.shapes.add_chart(
XL_CHART_TYPE.DOUGHNUT,
Inches(x), Inches(y),
Inches(width), Inches(height),
chart_data
)添加图片:
python
slide.shapes.add_picture(
"path/to/image.png",
Inches(x), Inches(y),
width=Inches(w) # 高度自动计算
)Checklist
预览所有布局
For Slide Generation:
- Read brand.json for colors/fonts
- Read config.json for output directory and settings
- Read markdown files for voice/tone
- Read ALL cookbook layout frontmatters (first 40 lines of each .py):
- Glob all
.claude/skills/pptx-generator/cookbook/*.py - Read every file to extract blocks
# /// layout - Build understanding of all ,
best_for, limitsavoid_when
- Glob all
- Then select layouts based on complete knowledge:
- Match content to criteria
best_for - Respect warnings
avoid_when - Check /
max_*limitsmin_* - Follow for chosen layouts
instructions
- Match content to
- Create slide plan table BEFORE generating:
- List all slides with layout, title, content
- Check for duplicate titles
- Verify logical flow
- Group into batches (max 5 per batch)
- VARIETY CHECK: Content-slide <25% of total
- VARIETY CHECK: No 3+ consecutive same-layout slides
- VARIETY CHECK: Visual layouts 50%+ of presentation
- VARIETY CHECK: Used decision tree to evaluate each content-slide
- Present plan briefly before proceeding
- Apply brand colors and fonts
- Write content in brand's voice
- Generate MAX 5 slides per batch (or from config)
slides_per_batch - Execute via UV REPL
- Validate output before continuing:
- No duplicate titles
- Proper spacing between elements
- Content fits within bounds
- Colors match brand
- No trailing punctuation on titles/bullets
- Save batch to output directory from config
- Repeat for next batch if needed
- Combine all batches into final PPTX (if is true)
auto_combine - Clean up part files (if is false)
keep_parts
For Creating Layouts:
- Study existing layouts for patterns
- Design with production-ready quality
- Include distinctive decorative elements
- Use charts/images/shapes appropriately
- Add TOML-style frontmatter with:
- ,
namepurpose - ,
best_forarraysavoid_when - array with usage tips
instructions - /
max_*limits as neededmin_*
-
- Write proper docstring (LAYOUT, PURPOSE, CUSTOMIZE)
- Test the new layout
要查看所有可用布局:
bash
uv run .claude/skills/pptx-generator/generate-cookbook-preview.py这将生成包含每个布局的文件。
cookbook-preview.pptx—
检查表
—
幻灯片生成:
- 读取brand.json获取颜色/字体
- 读取config.json获取输出目录和设置
- 读取Markdown文件获取语气/风格
- 读取所有布局库布局的前置元数据(每个.py文件的前40行):
- 遍历所有文件
.claude/skills/pptx-generator/cookbook/*.py - 读取每个文件以提取块
# /// layout - 建立对所有、
best_for、限制的理解avoid_when
- 遍历所有
- 然后基于完整认知选择布局:
- 将内容与标准匹配
best_for - 遵守警告
avoid_when - 检查/
max_*限制min_* - 遵循所选布局的
instructions
- 将内容与
- 生成前创建幻灯片规划表:
- 列出所有幻灯片及其布局、标题、内容
- 检查重复标题
- 验证逻辑流程
- 分组为批次(每批最多5张)
- 多样性检查:content-slide占比<25%
- 多样性检查:无连续3张以上使用同一布局的情况
- 多样性检查:视觉化布局占演示文稿的50%以上
- 多样性检查:使用决策树评估每个content-slide
- 生成前向用户简要展示规划
- 应用品牌颜色和字体
- 按照品牌语气撰写内容
- 每批最多生成5张幻灯片(或config中的)
slides_per_batch - 通过UV REPL执行
- 继续前验证输出:
- 无重复标题
- 元素间间距合适
- 内容在边界内
- 颜色与品牌匹配
- 标题/项目符号末尾无标点
- 保存批次到config指定的输出目录
- 如有需要,重复生成下一批
- 将所有批次合并为最终PPTX(如果为true)
auto_combine - 清理分批次文件(如果为false)
keep_parts
创建布局:
- 研究现有布局的模式
- 按照生产就绪级别设计
- 包含独特的装饰元素
- 适当使用图表/图片/形状
- 添加TOML风格的前置元数据,包含:
- 、
namepurpose - 、
best_for数组avoid_when - 数组,包含使用提示
instructions - 必要的/
max_*限制min_*
-
- 编写正确的文档字符串(LAYOUT、PURPOSE、CUSTOMIZE)
- 测试新布局