pptx-validation-fallback
它能做什么
这项技能是用 python-pptx 检查 .pptx 文件的备用方案。它适合需要确认文件读取器无法处理的演示文稿的幻灯片数量和标题的人。
适用场景
- ✓当 read_file 在 PowerPoint 文件上失败或返回信息不完整的时候。
- ✓当我需要确认演示文稿是否有预期数量的幻灯片的时候。
- ✓当我希望列出幻灯片标题以便检查的时候。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pptx-validation-fallback/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查我的演示文稿是否有十张幻灯片,并列出每一张的标题。普通的文件读取器无法处理它。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会在 shell 中运行一个 python-pptx 脚本,加载演示文稿,打印幻灯片数量和每一张的标题,并将数量与预期数字进行比较。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
PowerPoint Validation Fallback
When to Use
Use this skill when read_file fails to properly read or validate PowerPoint (.pptx) files. This provides a reliable alternative for verifying presentation contents including slide count, titles, and structure.
Procedure
Step 1: Check if read_file Failed
If read_file with filetype pptx returns errors, incomplete content, or cannot extract slide information, proceed to the fallback method.
Step 2: Use run_shell with python-pptx
Execute Python code via run_shell using the python-pptx library to inspect the presentation:
from pptx import Presentation
# Load the presentation
prs = Presentation('path/to/file.pptx')
# Get basic info
slide_count = len(prs.slides)
print(f"Total slides: {slide_count}")
# Extract slide titles
for i, slide in enumerate(prs.slides):
if slide.shapes.title:
title = slide.shapes.title.text
print(f"Slide {i+1}: {title}")
else:
print(f"Slide {i+1}: [No title]")
Step 3: Validate Structure
Check that the presentation meets expected requirements:
from pptx import Presentation
prs = Presentation('path/to/file.pptx')
# Validation checks
expected_slides = 10 # Adjust based on requirements
actual_slides = len(prs.slides)
if actual_slides >= expected_slides:
print(f"✓ Slide count OK: {actual_slides} slides")
else:
print(f"✗ Insufficient slides: {actual_slides}/{expected_slides}")
# Check for content on each slide
for i, slide in enumerate(prs.slides):
has_title = slide.shapes.title is not None
has_content = len(slide.shapes) > 1
print(f"Slide {i+1}: title={has_title}, content={has_content}")
Step 4: Extract Detailed Content (Optional)
For deeper validation, extract text content from all shapes:
from pptx import Presentation
prs = Presentation('path/to/file.pptx')
for i, slide in enumerate(prs.slides):
print(f"\n=== Slide {i+1} ===")
for shape in slide.shapes:
if hasattr(shape, "text") and shape.text.strip():
print(shape.text)
Expected Output
Successful validation should provide:
- Confirmed slide count
- List of slide titles
- Verification that each slide has expected content structure
Common Use Cases
- Verifying generated presentations have correct number of slides
- Confirming slide titles match required topics
- Validating presentation structure before delivery
- Debugging why read_file cannot parse a .pptx file
Dependencies
The python-pptx library must be available in the execution environment. Most Python environments support it via pip:
pip install python-pptx
常见问题
没有标题的幻灯片如何处理?
脚本会打印一条说明,表明该幻灯片没有标题。
幻灯片数量如何检查?
脚本会将实际数量与预期数量进行比较,并报告是否通过。
使用哪个库读取文件?
由 python-pptx 读取演示文稿。
详情
热度
- GitHub 星标
- 7.8k
- 排名
- #12950
- 许可证
- 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帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。