pptx-shell-verify
它能做什么
这项技能说明,当内置工具无法读取时,如何用 python-pptx 检查 .pptx 演示文稿。它适合需要获得演示文稿内容结构化报告的人。
适用场景
- ✓当 read_file 或其他工具无法读取 PowerPoint 文件的时候。
- ✓当我需要确认演示文稿的结构和内容的时候。
- ✓当环境中有 Python,但该库可能需要先安装的时候。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pptx-shell-verify/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查我的演示文稿内容,包括幻灯片数量和标题。如果缺少该库,请先安装。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会先尝试正常读取,检查 python-pptx 是否可用,不可用则安装它,然后运行一个验证脚本,以 JSON 格式输出幻灯片数量和每张幻灯片的详细信息。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
PowerPoint Shell Verification
When to Use This Skill
Use this skill when:
read_fileor other built-in tools fail to read PowerPoint (.pptx) files- You need to verify presentation structure (slide count, titles, content)
- Standard file inspection methods return errors or incomplete data
Prerequisites
- Python 3.x installed in the execution environment
python-pptxlibrary available (install if needed)
Step-by-Step Instructions
Step 1: Attempt Standard File Read
First, try to read the file using standard methods:
read_file: path/to/presentation.pptx
If this fails or returns unusable data, proceed to Step 2.
Step 2: Verify python-pptx Availability
Check if the library is installed:
run_shell: python -c "import pptx; print('pptx available')"
If not available, install it:
run_shell: pip install python-pptx
Step 3: Create Verification Script
Create a Python script to extract presentation metadata:
# verify_pptx.py
from pptx import Presentation
import sys
import json
def verify_presentation(filepath):
try:
prs = Presentation(filepath)
data = {
"slide_count": len(prs.slides),
"slides": []
}
for i, slide in enumerate(prs.slides):
slide_data = {
"slide_number": i + 1,
"title": None,
"shapes_count": len(slide.shapes)
}
# Extract title if present
if slide.shapes.title:
slide_data["title"] = slide.shapes.title.text
data["slides"].append(slide_data)
print(json.dumps(data, indent=2))
return True
except Exception as e:
print(f"ERROR: {str(e)}", file=sys.stderr)
return False
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python verify_pptx.py <file.pptx>", file=sys.stderr)
sys.exit(1)
success = verify_presentation(sys.argv[1])
sys.exit(0 if success else 1)
Step 4: Execute Verification
Run the verification script:
run_shell: python verify_pptx.py path/to/presentation.pptx
Step 5: Interpret Results
Expected output format:
{
"slide_count": 10,
"slides": [
{
"slide_number": 1,
"title": "Introduction",
"shapes_count": 3
},
...
]
}
Use this data to:
- Confirm expected slide count matches
- Verify slide titles are present
- Validate presentation structure before delivery
Example Validation Checks
# Check slide count matches requirement
assert data["slide_count"] >= expected_min_slides
# Check all slides have titles
for slide in data["slides"]:
assert slide["title"] is not None, f"Slide {slide['slide_number']} missing title"
Troubleshooting
| Issue | Solution |
|---|---|
| Corrupted file | Verify file was created successfully, check file size |
| Permission denied | Ensure file path is accessible, check read permissions |
| Library not found | Install with pip install python-pptx |
| Empty presentation | File may be 0 bytes or incomplete write |
Best Practices
- Always verify after creation: Run verification immediately after generating a PowerPoint file
- Keep verification script reusable: Store the script for future presentations
- Validate before delivery: Never deliver a presentation without confirming structure
- Log verification results: Keep verification output for audit trails
常见问题
输出是什么格式?
示例脚本会以 JSON 格式打印幻灯片数据。
首先检查什么?
指南在使用 python-pptx 之前,会先尝试标准的文件读取。
脚本收集哪些内容?
幻灯片的数量,以及每张幻灯片的编号和标题等详细信息。
详情
作者的原始描述
Verify PowerPoint presentation contents using python-pptx via shell when standard file readers fail
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12949
- 许可证
- 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帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。