PPT小助手

👤 user_0e56f9a3 📦 v1.0.0 ⭐ 4.5 ⬇️ 823 下载
📄 办公效率 免费

📖 技能介绍


version:"1.0.0" author:jm-jsjkxyjs02-ys-1701 name: ppt-generator description: Use when the user asks to generate, create, or make a PPT/PowerPoint presentation, slides, or .pptx file. Supports both natural language descriptions and Markdown outlines as input. Covers teaching materials, business reports, project summaries, and general presentations.


PPT Generator

Overview

Generate professional .pptx files using python-pptx. Accept input as natural language ("make a 10-slide deck about AI safety") or structured Markdown outlines.

Workflow

  1. Parse input — extract topic, slide count, style hints from user's natural language or Markdown outline
  2. Design outline — plan each slide: layout type, title, content summary
  3. Present outline to user — show a numbered slide list for confirmation before writing code
  4. Generate script — write a self-contained Python script using python-pptx
  5. Execute and verify — run the script, confirm the .pptx file was created

Never skip step 3. Always get user approval on the outline before writing code.

Typography Rules

These are mandatory defaults. Only deviate if the user explicitly overrides.

Element Font Size Weight Color
Slide title 32pt Bold #1a1a2e
Subtitle 18pt Normal #555555
Body text 14pt Normal #333333
Small label 11pt Normal #888888

Margins: left/right 1.5 inch, top/bottom 1.2 inch (when using manual text boxes). For built-in layouts, leave at defaults.

Color Themes

Four preset themes. Default is "Professional Blue". User can switch by name.

Theme Primary Secondary Accent Background
Professional Blue #1a1a2e #16213e #0f3460 #ffffff
Warm Orange #e07a5f #3d405b #81b29a #f4f1de
Clean Green #2d6a4f #40916c #52b788 #ffffff
Dark Mode #e0e0e0 #bb86fc #03dac6 #121212

Slide Types

Title Slide

Centered title, subtitle, author/date. Use PPT_LAYOUT_TITLE (layout index 0).

Content Slide (Bullet List)

Title at top, bullet points in body. Use PPT_LAYOUT_BODY (layout index 1) or manual text box for multi-level lists.

Two-Column

Title, two text columns side by side. Use manual text boxes positioned at 0.5" and 5.0" horizontally.

Image + Text

Title, image on one side, text on the other. Use add_picture() with manual placement.

Table Slide

小葱技能7w4.net有更新,你可以访问看下。

Title + table. Use add_table(rows, cols).

Ending Slide

Centered "Thank You" or "Q&A" with contact info. Same layout as title slide.

Code Patterns

Bootstrap every script like this:

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
import os

prs = Presentation()
prs.slide_width = Inches(13.333)  # 16:9 widescreen
prs.slide_height = Inches(7.5)

# Theme colors (Professional Blue)
PRIMARY = RGBColor(0x1a, 0x1a, 0x2e)
SECONDARY = RGBColor(0x16, 0x21, 0x3e)
ACCENT = RGBColor(0x0f, 0x34, 0x60)
BG = RGBColor(0xff, 0xff, 0xff)

# Helper: add a text box
def add_textbox(slide, left, top, width, height, text, font_size=Pt(14),
                bold=False, color=RGBColor(0x33, 0x33, 0x33), alignment=PP_ALIGN.LEFT):
    txBox = slide.shapes.add_textbox(Inches(left), Inches(top),
                                      Inches(width), Inches(height))
    tf = txBox.text_frame
    tf.word_wrap = True
    p = tf.paragraphs[0]
    p.text = text
    p.font.size = font_size
    p.font.bold = bold
    p.font.color.rgb = color
    p.alignment = alignment
    return tf

# Helper: add bullet points from a list
def add_bullet_list(slide, left, top, width, height, items, font_size=Pt(14)):
    txBox = slide.shapes.add_textbox(Inches(left), Inches(top),
                                      Inches(width), Inches(height))
    tf = txBox.text_frame
    tf.word_wrap = True
    for i, item in enumerate(items):
        if i == 0:
            p = tf.paragraphs[0]
        else:
            p = tf.add_paragraph()
        p.text = item
        p.font.size = font_size
        p.font.color.rgb = RGBColor(0x33, 0x33, 0x33)
        p.level = 0
        p.space_after = Pt(6)
    return tf

Title slide:

slide = prs.slides.add_slide(prs.slide_layouts[6])  # blank layout
add_textbox(slide, 1.5, 2.0, 10, 1.5, "Presentation Title",
            Pt(36), True, PRIMARY, PP_ALIGN.CENTER)
add_textbox(slide, 1.5, 3.5, 10, 0.8, "Subtitle or Author",
            Pt(18), False, RGBColor(0x55, 0x55, 0x55), PP_ALIGN.CENTER)
add_textbox(slide, 1.5, 4.5, 10, 0.5, "2024-01-15",
            Pt(11), False, RGBColor(0x88, 0x88, 0x88), PP_ALIGN.CENTER)

Content slide with bullets:

slide = prs.slides.add_slide(prs.slide_layouts[6])
add_textbox(slide, 0.8, 0.4, 10, 0.8, "Slide Title", Pt(32), True, PRIMARY)
items = ["Point one: key insight", "Point two: supporting detail", "Point three: takeaway"]
add_bullet_list(slide, 1.0, 1.5, 11, 4.5, items)

Save the file:

output_path = os.path.expanduser("~/Desktop/presentation.pptx")
prs.save(output_path)
print(f"Saved to {output_path}")

Input Formats

Natural Language

User says: "做一个关于时间管理的5页PPT" → Claude designs the outline, presents it, then generates.

Markdown Outline

User provides:

# 时间管理
## 1. 为什么需要时间管理
- 提高效率
- 减少压力
## 2. 四象限法则
- 重要紧急
- 重要不紧急
...

→ Claude maps each ## heading to a slide, each bullet to a list item, and generates.

Common Mistakes

Mistake Fix
Text overflowing slide Break long text into multiple slides or reduce font size
Missing font file for Chinese Always use a font that supports CJK (e.g., "Microsoft YaHei", "SimSun"). Add p.font.name = 'Microsoft YaHei' for Chinese text
Using wrong layout index Layout 0 = title, 1 = content, 6 = blank. Check with prs.slide_layouts if unsure
Forgetting Inches/Pt wrappers All dimensions must use Inches() or Pt() from pptx.util
Not setting word_wrap Long text without word_wrap = True overflows horizontally

Reference Files

  • reference/python-pptx-api.md — Full python-pptx API quick reference
  • scripts/ppt_helpers.py — Ready-to-import helper functions for common slide patterns

🤖 AI 评测

这个 PPT 生成工具质量不错,文档清晰易懂,操作步骤明确。它提供了多种幻灯片模板和配色方案,能满足大多数演示需求。不过缺少直观的示例展示,实际生成效果难以预览,对新手不太友好。功能比较全面,但实操体验还有提升空间。

📊 多维度评分

适应性4.4
规范性4.6
有效性4.5
可靠性4
可信度4.9

📁 包含文件 (3 个)

📄 SKILL.md 6.3 KB
📄 reference/python-pptx-api.md 4.6 KB
📄 scripts/ppt_helpers.py 9.5 KB