Pptx

From zhixuli0406/DuDuClaw · View interactive version

Pptx is an AI agent skill from the GitHub repository zhixuli0406/DuDuClaw. Read, create, and convert Microsoft PowerPoint (.pptx) presentations — extract slide text to JSON/markdown, build decks from JSON/markdown outlines, and export to PDF.

How to use this skill

Skill file

PowerPoint (.pptx) 簡報處理

處理簡報的三件事:讀取抽取、建立、轉換 PDF。腳本用 uv run 執行,依賴以

PEP 723 inline metadata 宣告(python-pptx);uv 不存在時改用

pip install python-pptx==1.0.2 後 python3 執行。

何時使用

腳本

腳本位於本技能的 scripts/ 目錄。兩種執行路徑,依你有沒有 Bash 工具擇一:

改用 office_script MCP 工具執行主程式內嵌、通過雜湊驗證的腳本(Linux/macOS):

例(把大綱做成簡報):

```json

{"skill": "pptx", "script": "create",

"args": ["outline.md", "--out", "/你的agent目錄/attachments/deck.pptx"]}

```

工具在私有目錄執行內嵌腳本,技能目錄中的腳本不會執行;個人/部門/公司層只能覆蓋提示文字。

旗標和值必須分開(拒絕 --out=...),輸出須為你的 agent 目錄內的新檔案,父目錄須已存在;

輸入拒絕符號連結與硬連結,輸出不覆寫既有檔案。成功後工具回傳實際輸出路徑;

產出檔案後務必依下方 📎DELIVER 協定交付。

1. 讀取抽取 — `extract.py`

uv run scripts/extract.py <input.pptx> --format json   # 每張投影片 → 文字段落陣列
uv run scripts/extract.py <input.pptx> --format md      # 每張投影片 → markdown 段落

JSON 輸出 {"slides": [{"index": 1, "texts": [...]}, ...]}。

2. 建立 — `create.py`

從 markdown 大綱或 JSON 建立 .pptx(每個 # 標題起一張新投影片,- 為條列):

來源型別依副檔名判定(.json → JSON,其餘 → markdown):

uv run scripts/create.py outline.md --out /abs/out.pptx
uv run scripts/create.py deck.json  --out /abs/out.pptx

JSON schema:{"slides": [{"title": str, "bullets": [str, ...]}, ...]}。

3. 轉 PDF — `to_pdf.py`

uv run scripts/to_pdf.py <input.pptx> --outdir <dir>

未安裝 LibreOffice(soffice)時明確回報未安裝、僅轉換功能不可用(優雅降級)。

交付檔案給使用者(📎DELIVER 協定)

產出後在回覆最後另起一行:

📎DELIVER:/絕對路徑/deck.pptx

路徑須為絕對路徑且位於你的 agent 工作目錄(或其 attachments/)下;標記行不顯示給

使用者,請另用文字說明。

API 模式同樣適用:用 office_script 產出檔案後,一樣在回覆最後一行輸出

📎DELIVER:<絕對路徑>,gateway 才會把 .pptx 傳回使用者——只回文字大綱不算完成。

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.