跳到正文
Skillpedia
PDF、Word 与幻灯片7.8k · #12943

ppt-reliable-creation

它能做什么

这项技能提供两种途径制作 .pptx 演示文稿:辅助智能体路线和直接的 Python 路线。它适合需要幻灯片文件并希望结果可靠的人。

适用场景

  • ✓当我需要一份指定页数和内容的 PowerPoint 演示文稿的时候。
  • ✓当辅助智能体在制作演示文稿时可能失败或返回含糊错误的时候。
  • ✓当输出文件可能保存在意外文件夹中的时候。

技能链接

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ppt-workflow-location-enhanced-72b4a5/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ppt-workflow-location-enhanced-72b4a5/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请为我们的项目计划制作一份 10 页的 PowerPoint。如果辅助工具失败,就改用 Python 制作,并告诉我完整的文件路径。”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会记录当前文件夹,请辅助智能体制作幻灯片;如果失败,就自己编写 python-pptx 脚本,然后确认 .pptx 文件的保存位置。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Reliable PowerPoint Creation Workflow

When to Use This Skill

Use this workflow when:

  • You need to create PowerPoint presentations with specific slide content and structure
  • shell_agent may fail or produce opaque error messages
  • Output files may be created in unexpected nested directories
  • You need a reliable fallback when primary generation methods fail

Overview: Dual-Path Strategy

This skill provides two paths:

  1. Primary Path: shell_agent delegation (simpler, but may fail)
  2. Fallback Path: Direct Python execution with python-pptx (more reliable, more control)

Step 0: Pre-Check Working Directory

Before any generation, verify your current working directory:

# Check and record current directory
pwd
# Output should be saved for later reference

# List current contents to establish baseline
ls -la

Important: Save the pwd output. You'll need this to verify where files are created.

Step 1: Primary Path - shell_agent Generation

Attempt PowerPoint creation via shell_agent first (quickest if successful):

Use shell_agent to create a PowerPoint presentation with:
- Specify the exact number of slides needed
- Define the content/topic for each slide
- Request the file be saved with a clear filename (e.g., presentation.pptx)
- Ask the agent to confirm the full file path after creation

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 and tell me the full file path where you saved it.

shell_agent Error Handling

If shell_agent returns "unknown error" or fails:

# Capture actual error by adding stderr redirect
# Re-run the task or check previous error output
# Add 2>&1 to any shell commands to see real errors

After 2 failures or opaque errors, switch to Fallback Path (Step 2).

Step 2: Fallback Path - Direct Python with python-pptx

When shell_agent fails, use direct Python execution. Always write script to file first, then execute.

2a: Create the Python Script

Write a complete Python script using python-pptx:

from pptx import Presentation
from pptx.util import Inches, Pt

# Create presentation
prs = Presentation()

# Slide 1: Title slide
slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Title Here"
subtitle.text = "Subtitle Here"

# Slide 2+: Content slides
for i in range(2, 11):
    slide_layout = prs.slide_layouts[1]
    slide = prs.slides.add_slide(slide_layout)
    title = slide.shapes.title
    title.text = f"Slide {i} Title"
    
    # Add content
    content = slide.placeholders[1]
    content.text = f"Content for slide {i}"

# Save to current working directory
prs.save('presentation.pptx')
print("File saved to:", os.path.abspath('presentation.pptx'))

Save this script as: create_presentation.py

2b: Execute with Error Capture

# Write script to file first, then execute with stderr capture
python create_presentation.py 2>&1 | tee execution_log.txt

# Check for success
if [ -f "presentation.pptx" ]; then
    echo "SUCCESS: File created in current directory"
    ls -la presentation.pptx
else
    echo "FAILED: Check execution_log.txt for errors"
    cat execution_log.txt
fi

2c: Verify Working Directory Match

# Confirm file is where expected
CURRENT_PWD=$(pwd)
FILE_PATH=$(realpath presentation.pptx 2>/dev/null)

if [[ "$FILE_PATH" == "$CURRENT_PWD"* ]]; then
    echo "✓ File is in expected directory"
else
    echo "⚠ File created elsewhere: $FILE_PATH"
    echo "Current directory: $CURRENT_PWD"
fi

Step 3: Locate the Output File

PowerPoint files may be created in nested directories. Always search before assuming location:

# Search for all .pptx files in workspace
find . -name "*.pptx" -type f 2>/dev/null

# Search for specific filename
find . -name "presentation.pptx" -type f 2>/dev/null

# If not found, broaden search
find . -name "*.pptx" -type f -mmin -5 2>/dev/null

Step 4: Copy to Working Directory

Once located, bring the file to your known working directory:

# Found path example: ./workspace/task_123/output/presentation.pptx
FOUND_PATH=$(find . -name "presentation.pptx" -type f | head -1)

if [ -n "$FOUND_PATH" ]; then
    cp "$FOUND_PATH" .
    echo "Copied from: $FOUND_PATH"
else
    echo "ERROR: File not found
常见问题

第一条途径是什么?

由辅助智能体根据清晰的描述制作演示文稿。

备用方案是什么?

由 AI 编写并运行的、使用 python-pptx 的 Python 脚本。

为什么要记录当前文件夹?

文件可能会被保存到嵌套的文件夹中,记录它有助于确认文件的位置。

详情

作者的原始描述

Robust PowerPoint generation with shell_agent primary and python-pptx fallback, including directory verification and error debugging

repo: HKUDS/AgentPilot

热度

GitHub 星标
7.8k
排名
#12943
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能