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

pptx-file-validation

它能做什么

这项技能通过 python-pptx 读取幻灯片,来检查 .pptx 文件的内容。它适合在使用演示文稿之前,需要确认其幻灯片是否正确的人。

适用场景

  • ✓当文件读取器无法读取 PowerPoint 文件的时候。
  • ✓当我需要确认演示文稿的幻灯片数量和标题的时候。
  • ✓当我希望检查演示文稿的结构是否完整的时候。

技能链接

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pptx-file-validation/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“我的文件读取器无法打开这份 PowerPoint。请检查它有多少张幻灯片,并列出每张幻灯片的标题。”

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

工作原理

AI 会在 shell 中运行一段简短的 Python 命令,加载演示文稿,统计幻灯片数量并打印每张幻灯片的标题,然后报告任何缺失的项目。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

PPTX File Validation Workflow

This skill provides a reliable method to validate PowerPoint (.pptx) files when the built-in read_file function fails or returns insufficient information.

When to Use

  • read_file fails to read a .pptx file
  • You need to verify presentation contents (slide count, titles, structure)
  • Standard file readers return incomplete or unreadable data

Step-by-Step Instructions

Step 1: Detect read_file Failure

Attempt to read the PowerPoint file using read_file. If it fails, returns garbled content, or doesn't provide the structural information you need, proceed to Step 2.

Step 2: Use run_shell with python-pptx

Execute a Python script using run_shell with the python-pptx library to inspect the presentation:

python3 -c "
from pptx import Presentation
prs = Presentation('path/to/file.pptx')
print(f'Total slides: {len(prs.slides)}')
for i, slide in enumerate(prs.slides, 1):
    print(f'Slide {i}: {slide.shapes.title.text if slide.shapes.title else \"[No Title]\"}')
"

Step 3: Parse and Validate Output

Analyze the output to verify:

  • Slide count matches expected number
  • Slide titles align with required topics
  • Structure is complete and properly formatted

Step 4: Report Validation Results

Document the validation findings, including:

  • Total number of slides
  • List of slide titles
  • Any missing or problematic content

Example Usage

# In your agent workflow
run_shell(command="python3 -c \"from pptx import Presentation; prs = Presentation('output.pptx'); print(f'Slides: {len(prs.slides)}'); [print(f'{i}: {s.shapes.title.text}') for i, s in enumerate(prs.slides, 1) if s.shapes.title]\"")

Prerequisites

Ensure python-pptx is available in the environment:

pip install python-pptx

Benefits

  • Reliable: Works when built-in readers fail
  • Detailed: Provides slide-by-slide breakdown
  • Programmatic: Easy to parse and validate against requirements
  • Lightweight: No need for PowerPoint software installation
常见问题

检查会报告什么?

幻灯片的总数,以及每张幻灯片的标题。

缺少标题时如何显示?

示例会为没有标题的幻灯片打印占位文字 No Title。

这项检查是只读的吗?

是的。示例只读取演示文稿,不会修改它。

详情

作者的原始描述

Validate PowerPoint files using python-pptx when standard file readers fail

repo: HKUDS/AgentPilot

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能