ppt-generation-resilient
它能做什么
这项技能描述了制作 PowerPoint 演示文稿的两种途径,并优先使用辅助智能体路线。它适合需要幻灯片、并希望在第一条路线失败时有备用方案的人。
适用场景
- ✓当我需要以编程方式制作 PowerPoint 演示文稿的时候。
- ✓当辅助智能体可能失败或给出含糊错误的时候。
- ✓当演示文稿足够复杂,需要直接用 Python 控制的时候。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ppt-workflow-location-enhanced/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请制作一份关于我们产品路线图的 PowerPoint,每张幻灯片包含标题和要点。如果辅助工具失败,请直接用 Python 完成。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会请辅助智能体按清晰的规格制作演示文稿,要求其提供完整的文件路径;如果结果不理想,就直接使用 python-pptx 代码完成。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Resilient PowerPoint Generation Workflow
When to Use This Skill
Use this workflow when:
- You need to create PowerPoint presentations programmatically
- shell_agent may fail or produce opaque error messages
- You need robust error handling and debugging capabilities
- Output files may be created in unexpected nested directories
Overview
This workflow provides two paths:
- Primary: Use shell_agent with clear specifications (preferred for simple presentations)
- Fallback: Direct Python execution with python-pptx library (for complex or failed shell_agent attempts)
Both paths include automatic error capture and file location verification.
Path 1: shell_agent (Primary)
Step 1.1: Delegate with Clear Specifications
Use shell_agent to create a PowerPoint presentation with:
- Specify exact number of slides needed
- Define content/topic for each slide
- Request file saved with clear filename (e.g., presentation.pptx)
- Ask agent to confirm the full file path after creation
- Request agent report any errors with full output
Example task description:
Create a PowerPoint presentation with 10 slides covering [topic]. Each slide should have a title and bullet points. Save it as presentation.pptx in the current working directory and report the full file path. If you encounter any errors, show the complete error message.
Step 1.2: Verify shell_agent Success
Check if shell_agent completed successfully:
- Did it report a file path?
- Can you access the file at that path?
- Is the file size > 0 bytes?
If any check fails, proceed to Path 2 (Fallback).
Path 2: Direct Python with python-pptx (Fallback)
Step 2.1: Create Python Script File
First, write the PowerPoint generation script to a .py file (do NOT use inline execution):
# save as: generate_presentation.py
from pptx import Presentation
from pptx.util import Inches, Pt
import os
# CRITICAL: Explicitly set and verify working directory
working_dir = os.getcwd()
print(f"Working directory: {working_dir}")
# Create presentation
prs = Presentation()
# Example: Add slides with content
slides_content = [
{"title": "Slide 1 Title", "content": ["Bullet 1", "Bullet 2"]},
{"title": "Slide 2 Title", "content": ["Point A", "Point B", "Point C"]},
# Add more slides as needed
]
for slide_data in slides_content:
slide_layout = prs.slide_layouts[1] # Title and Content layout
slide = prs.slides.add_slide(slide_layout)
# Set title
title = slide.shapes.title
title.text = slide_data["title"]
# Set content
content = slide.placeholders[1]
tf = content.text_frame
tf.clear() # Clear existing content
for i, point in enumerate(slide_data["content"]):
if i == 0:
p = tf.paragraphs[0]
else:
p = tf.add_paragraph()
p.text = point
p.font.size = Pt(18)
# Save to current working directory with explicit path
output_filename = "presentation.pptx"
output_path = os.path.join(working_dir, output_filename)
prs.save(output_path)
print(f"Presentation saved to: {output_path}")
print(f"File exists: {os.path.exists(output_path)}")
print(f"File size: {os.path.getsize(output_path)} bytes")
Step 2.2: Execute with Error Output Capture
CRITICAL: Always redirect stderr to stdout to capture actual error messages:
# Execute the script with full error output
python generate_presentation.py 2>&1
# Or if using run_shell tool, ensure 2>&1 is included
Why this matters: Without 2>&1, Python exceptions are sent to stderr and you only see "unknown error" instead of the actual exception message.
Step 2.3: Debug Common Issues
If execution fails, add these debugging commands:
# Check if python-pptx is installed
python -c "import pptx; print(pptx.__version__)" 2>&1
# Check working directory
pwd
ls -la
# Check Python version
python --version
# Run with verbose error output
python -u generate_presentation.py 2>&1 | tee execution_log.txt
Step 3: Locate the Output File (Both Paths)
PowerPoint files may be in nested workspace directories. Always verify location:
# Find all .pptx files in workspace
find . -name "*.pptx" -type f 2>&1
# Or search for specific filename
find . -name "presentation.pptx" -type f 2>&1
# If not found locally, search broader (last resort)
find /workspace -name "*.pptx" -type f 2>/dev/null
Step 4: Copy to Working Direct
常见问题
哪种演示文稿适合辅助智能体路线?
指南建议对于只包含基础幻灯片的简单演示文稿,使用这条路线。
什么时候直接用 Python 更好?
指南建议用于复杂的演示文稿,或辅助智能体失败之后。
辅助智能体需要报告什么?
完整的文件路径,以及带有完整输出的任何错误信息。
详情
作者的原始描述
Resilient PowerPoint generation with shell_agent primary path and python-pptx fallback
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12945
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。