ppt-agent
Verified专业 PPT 演示文稿全流程 AI 生成助手。模拟顶级 PPT 设计公司的完整工作流(需求调研 -> 资料搜集 -> 大纲策划 -> 策划稿 -> 设计稿),输出高质量 HTML 格式演示文稿。当用户提到制作 PPT、做演示文稿、做 slides、做幻灯片、做汇报材料、做培训课件、做路演 deck、做产品介绍页面时触发此技能。即使用户只说"帮我做个关于 X 的介绍"或"我要给老板汇报 Y",只要暗示需要结构化的多页演示内容,都应该触发。也适用于用户说"帮我把这篇文档做成 PPT"、"把这个主题做成演示"等需要将内容转化为演示格式的场景。
scripts/build_hero.py
View on GitHub#!/usr/bin/env python3
"""build_hero.py -- 把 26 张风格截图拼成 5 板块 hero 拼图
输出:
assets/hero-all.png 总览:26 风格 5 板块网格(适合 README 顶部)
assets/hero-<category>.png 每个板块单独一张
"""
from __future__ import annotations
import sys
from pathlib import Path
try:
from PIL import Image, ImageDraw, ImageFont
except ImportError:
print("Pillow not installed. Run: pip install Pillow", file=sys.stderr)
sys.exit(1)
import contracts as C
GALLERY = C.SKILL_DIR / "ppt-output" / "style-gallery"
ASSETS = C.SKILL_DIR / "assets"
ASSETS.mkdir(exist_ok=True)
def load_categories() -> dict:
"""板块 -> {cn, en, ids},顺序与内容都取自风格库。"""
categories = {key: {"cn": label["cn"], "en": label["en"], "ids": []}
for key, label in C.STYLE_CATEGORIES.items()}
for style in C.load_styles():
categories[style["category"]]["ids"].append(style["style_id"])
return categories
CATEGORIES = load_categories()
THUMB_W, THUMB_H = 480, 270 # 16:9 缩略图
GAP = 20
PADDING = 60
LABEL_HEIGHT = 60
BG_COLOR = (10, 10, 12)
LABEL_COLOR = (255, 255, 255)
def get_font(size: int, bold: bool = False, cjk: bool = False):
"""获取字体。cjk=True 优先选含中文字符的字体。"""
if cjk:
candidates = [
"/System/Library/Fonts/STHeiti Medium.ttc",
"/System/Library/Fonts/Hiragino Sans GB.ttc",
"/System/Library/Fonts/PingFang.ttc",
"/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
]
else:
candidates = [
"/System/Library/Fonts/HelveticaNeue.ttc",
"/System/Library/Fonts/SFNS.ttf",
"/System/Library/Fonts/Helvetica.ttc",
"/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" if bold else "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
]
for c in candidates:
if Path(c).exists():
try:
return ImageFont.truetype(c, size)
except OSError:
continue
return ImageFont.load_default()
def make_thumbnail(img_path: Path, w: int = THUMB_W, h: int = THUMB_H) -> Image.Image:
if not img_path.exists():
thumb = Image.new("RGB", (w, h), (40, 40, 48))
return thumb
img = Image.open(img_path).convert("RGB")
img.thumbnail((w * 2, h * 2)) # high-res first
img = img.resize((w, h), Image.LANCZOS)
return img
def build_category_image(cat_key: str, cat_data: dict) -> Image.Image:
ids = cat_data["ids"]
n = len(ids)
cols = 4 if n >= 6 else (3 if n >= 4 else n)
rows = (n + cols - 1) // cols
width = PADDING * 2 + cols * THUMB_W + (cols - 1) * GAP
height = PADDING + LABEL_HEIGHT + rows * THUMB_H + (rows - 1) * GAP + PADDING
canvas = Image.new("RGB", (width, height), BG_COLOR)
draw = ImageDraw.Draw(canvas)
title_font = get_font(28, bold=True, cjk=True)
caption_font = get_font(12)
accent_font = get_font(11, bold=True)
draw.text((PADDING, PADDING - 10), cat_data["cn"], fill=LABEL_COLOR, font=title_font)
sub_text = f"{cat_data['en'].upper()} · {n} STYLES"
draw.text((PADDING, PADDING + 26), sub_text, fill=(110, 200, 230), font=accent_font)
accent_y = PADDING + 22
draw.line([(PADDING + len(cat_data["cn"]) * 30 + 12, accent_y), (PADDING + len(cat_data["cn"]) * 30 + 60, accent_y)], fill=(34, 211, 238), width=2)
for i, sid in enumerate(ids):
row = i // cols
col = i % cols
x = PADDING + col * (THUMB_W + GAP)
y = PADDING + LABEL_HEIGHT + row * (THUMB_H + GAP)
thumb = make_thumbnail(GALLERY / f"{sid}.png")
canvas.paste(thumb, (x, y))
draw.rectangle([(x, y), (x + THUMB_W - 1, y + THUMB_H - 1)], outline=(40, 50, 65), width=1)
label_overlay = Image.new("RGBA", (THUMB_W, 28), (0, 0, 0, 180))
canvas.paste(label_overlay, (x, y + THUMB_H - 28), label_overlay)
draw.text((x + 10, y + THUMB_H - 22), sid, fill=(220, 230, 240), font=caption_font)
return canvas
def build_all_categories_grid() -> Image.Image:
total_styles = sum(len(c["ids"]) for c in CATEGORIES.values())
cols = 5
n = total_styles
rows = (n + cols - 1) // cols
thumb_w, thumb_h = 360, 202
gap = 14
padding = 80
header = 200
width = padding * 2 + cols * thumb_w + (cols - 1) * gap
height = padding + header + rows * thumb_h + (rows - 1) * gap + padding
canvas = Image.new("RGB", (width, height), BG_COLOR)
draw = ImageDraw.Draw(canvas)
overlay = Image.new("RGBA", (width, height), (0, 0, 0, 0))
odraw = ImageDraw.Draw(overlay)
for x_pos, y_pos, color, radius in [
(int(width * 0.85), 100, (99, 102, 241, 80), 400),
(int(width * 0.15), height - 200, (34, 211, 238, 60), 350),
]:
for r in range(radius, 0, -8):
alpha = int(color[3] * (1 - r / radius) * 0.3)
odraw.ellipse([(x_pos - r, y_pos - r), (x_pos + r, y_pos + r)],
fill=(color[0], color[1], color[2], alpha))
canvas = Image.alpha_composite(canvas.convert("RGBA"), overlay).convert("RGB")
draw = ImageDraw.Draw(canvas)
title_font = get_font(56, bold=True, cjk=True)
sub_font = get_font(20, cjk=True)
accent_font = get_font(13, bold=True)
caption_font = get_font(11)
draw.ellipse([(padding, padding + 10), (padding + 12, padding + 22)], fill=(34, 211, 238))
draw.text((padding + 24, padding + 8), "PPT AGENT SKILL · WORLD-CLASS", fill=(34, 211, 238), font=accent_font)
draw.text((padding, padding + 50), f"{total_styles} 风格预览画廊", fill=(255, 255, 255), font=title_font)
draw.text((padding, padding + 130),
f"{len(CATEGORIES)} 板块 · {len(C.CHARTS)} 图表 · 世界级排版 · Linear / Anthropic / Stripe / Apple / NYT 标杆",
fill=(180, 200, 220), font=sub_font)
all_styles = []
for cat in CATEGORIES.values():
all_styles.extend(cat["ids"])
for i, sid in enumerate(all_styles):
row = i // cols
col = i % cols
x = padding + col * (thumb_w + gap)
y = padding + header + row * (thumb_h + gap)
thumb = make_thumbnail(GALLERY / f"{sid}.png", thumb_w, thumb_h)
canvas.paste(thumb, (x, y))
draw.rectangle([(x, y), (x + thumb_w - 1, y + thumb_h - 1)], outline=(40, 50, 65), width=1)
label_h = 24
label_overlay = Image.new("RGBA", (thumb_w, label_h), (0, 0, 0, 200))
canvas.paste(label_overlay, (x, y + thumb_h - label_h), label_overlay)
draw.text((x + 8, y + thumb_h - label_h + 6), sid, fill=(220, 230, 240), font=caption_font)
return canvas
def main():
print("Building category images...")
for cat_key, cat_data in CATEGORIES.items():
img = build_category_image(cat_key, cat_data)
out = ASSETS / f"hero-{cat_key.replace('_', '-')}.png"
img.save(out, optimize=True)
print(f" ✓ {out.name} ({img.width}x{img.height})")
print("\nBuilding overall grid...")
grid = build_all_categories_grid()
out = ASSETS / "hero-all.png"
grid.save(out, optimize=True)
print(f" ✓ {out.name} ({grid.width}x{grid.height})")
print(f"\nDone. Outputs in {ASSETS}/")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |