关于 pptx-author
pptx-author 是使用 python-pptx 生成 PowerPoint 文件的轻量技能,面向基于模型数据的金融演示文稿。它强调让每个数字都能追溯到源工作簿,并将成品写入磁盘。
主要功能
- 01使用 python-pptx 创建 .pptx 文件
- 02将数字追溯到工作簿单元格
- 03加载已挂载的公司模板
- 04将工作簿图表嵌入为 PNG
- 05将输出写入 ./out/
适用场景
- 01根据财务模型制作推介演示文稿
- 02准备投资委员会备忘录演示文稿
- 03将业绩说明整理为 PowerPoint 文件
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ nousresearch/ hermes-agent --skill pptx-author安装后在 Claude Code 中输入/pptx-author确认已加载。
详细介绍
pptx-author
使用 python-pptx 在磁盘上生成 .pptx 文件。当你需要交付文件形式的演示文稿,而不是操控实时 PowerPoint 会话时使用。
改编自 Anthropic 的 pptx-author 和 pitch-deck 技能,来源为 anthropics/financial-services。原版中的 MCP / Office-JS 分支已移除——此技能假设使用无头 Python。
如需了解更全面、已推出的 PowerPoint 编写技能(幻灯片、演讲者备注、嵌入内容、媒体),请参阅内置的 powerpoint 技能。此技能采用更轻量的模式,专为模型支持的演示文稿(推介演示文稿、IC 备忘录、财报简报)设计,要求每个数字都能追溯到源工作簿。
输出约定
- 写入
./out/<name>.pptx。如果./out/不存在,则创建它。 - 在最终消息中返回相对路径。
设置
pip install "python-pptx>=0.6"
核心约定
每张幻灯片只讲一个要点
标题应阐明结论;正文应为其提供支撑。标题为“Q3 Revenue”的幻灯片较弱;“Q3 营收同比增长加速至 14%”则更有力。
每个数字都能追溯到模型
如果幻灯片上的数字来自 ./out/model.xlsx,请在脚注中标明工作表和单元格。
Revenue: $1,250M (Source: model.xlsx, Inputs!C3)
切勿凭记忆或摘要转录数字——打开工作簿,读取命名区域,并尽可能通过编程将演示文稿中的数值与其绑定。
有公司模板时使用公司模板
如果存在 ./templates/firm-template.pptx,请加载它,以便演示文稿继承品牌颜色、字体和母版版式。
from pptx import Presentation
from pathlib import Path
template = Path("./templates/firm-template.pptx")
prs = Presentation(str(template)) if template.exists() else Presentation()
图表:从模型导出 PNG 优于原生 pptx 图表
当保真度很重要(模型中的图表样式必须与演示文稿完全一致)时,请将源工作簿中的图表渲染为 PNG 并嵌入图片。原生 pptx.chart 图表不稳定,且往往不符合公司的惯例。
from pptx.util import Inches
slide.shapes.add_picture("./out/charts/football_field.png",
Inches(1), Inches(2),
width=Inches(8))
不向外部发送
此技能只写入文件,不会发送电子邮件、上传或发布内容。交付由编排层处理。
框架
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pathlib import Path
template = Path("./templates/firm-template.pptx")
prs = Presentation(str(template)) if template.exists() else Presentation()
# Title slide
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Project Aurora — Strategic Alternatives"
slide.placeholders[1].text = "Preliminary Discussion Materials"
# Valuation summary slide (title-only layout)
slide = prs.slides.add_slide(prs.slide_layouts[5])
slide.shapes.title.text = "Valuation implies $38–$52 per share across methodologies"
# Add a table bound to model outputs
rows, cols = 5, 4
tbl_shape = slide.shapes.add_table(rows, cols,
Inches(0.5), Inches(1.5),
Inches(9), Inches(3))
tbl = tbl_shape.table
headers = ["Methodology", "Low ($)", "Mid ($)", "High ($)"]
for c, h in enumerate(headers):
tbl.cell(0, c).text = h
# In a real deck, read these from the model workbook with openpyxl
data = [
("Trading comps", "35", "41", "48"),
("Precedent M&A", "39", "45", "52"),
("DCF (base)", "36", "43", "51"),
("LBO (10% IRR)", "33", "38", "44"),
]
for r, row in enumerate(data, start=1):
for c, val in enumerate(row):
tbl.cell(r, c).text = val
# Embed a chart rendered from the model
slide = prs.slides.add_slide(prs.slide_layouts[5])
slide.shapes.title.text = "Football field — current price $42"
slide.shapes.add_picture("./out/charts/football_field.png",
Inches(1), Inches(1.8), width=Inches(8))
Path("./out").mkdir(exist_ok=True)
prs.save("./out/pitch-aurora.pptx")
将演示文稿中的数字绑定到源工作簿
从 Excel 模型中读取命名区域或特定单元格,确保演示文稿中的数字始终一致。
from openpyxl import load_workbook
wb = load_workbook("./out/model.xlsx", data_only=True)
def nr(name):
"""Resolve a named range to its current computed value."""
rng = wb.defined_names[name]
sheet, coord = next(rng.destinations)
return wb[sheet][coord].value
revenue_fy24 = nr("RevenueFY24")
implied_mid = nr("ImpliedSharePriceBase")
然后使用这些值构建演示文稿内容:
slide.shapes.title.text = f"Implied share price of ${implied_mid:.2f} (base case)"
请记得在读取工作簿前重新计算它——只有在工作表已计算过的情况下,openpyxl 才能读取计算值。先运行 excel-author 技能中的重新计算辅助工具,或通过真实的 Excel 会话打开并保存工作簿。
推介演示文稿的幻灯片类型清单
典型的投行推介演示文稿遵循以下结构。此结构并非硬性要求,但可作为起始框架:
- 封面/标题
- 免责声明
- 目录
- 现状概览
- 公司简介(目标公司)
- 市场/行业背景
- 估值汇总(足球场图)——核心页面
- 可比公司交易详情
- 先例交易详情
- DCF 汇总
- 示意性 LBO/赞助方案例
- 流程注意事项
- 附录
不应使用此技能的情况
- 用户正在进行实时 PowerPoint 会话,且有可用的 Office MCP——直接操作其实时文档。
- 非金融类幻灯片材料(季度全员大会、营销演示文稿)——使用更全面的
powerpoint技能。 - 包含大量动画、切换效果或演讲者备注的演示文稿——使用更全面的
powerpoint技能。
署名
约定改编自 Anthropic 的 Claude for Financial Services 插件套件,采用 Apache-2.0 许可证。原文:https://github.com/anthropics/financial-services/tree/main/plugins/agent-plugins/pitch-agent/skills/pptx-author