pptx-template-clean-rebuild

Repairs blank python-pptx output by deduplicating zip slide parts and rewriting presentation.xml.rels.

1|Updated Jul 13, 2026
One-click install
npx skills add https://github.com/HalseyYang/Skills-HY --skill pptx-template-clean-rebuild-halseyyang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pptx-template-clean-rebuild
Source: https://github.com/HalseyYang/Skills-HY/tree/main/pptx-template-clean-rebuild
Command: npx skills add https://github.com/HalseyYang/Skills-HY --skill pptx-template-clean-rebuild-halseyyang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires python-pptx.

What problem does it solve? When you use python-pptx to open a template that already contains slides, clear the slide list, and add new pages, the saved .pptx renders blank in PowerPoint and strict preview engines. This happens because orphan slide parts duplicate zip entries and stale relationship IDs leak into presentation.xml.rels. ## Core Features & Use Cases - Zip Deduplication: Removes duplicate slide part entries in the .pptx zip archive, keeping only the last written copy. - Relationship Rebuild: Rewrites ppt/_rels/presentation.xml.rels so slide rIds are continuous, unique, and never collide with non-slide relationships like notesMaster or presProps. - sldIdLst Reconstruction: Rebuilds the slide ID list in presentation.xml to reference only valid new rIds. - Use Case: You generate a 30-page clinical lecture deck from a branded template and PowerPoint shows pages 2-29 as blank. Run the rebuild script after prs.save() to produce a clean, openable file. ## Quick Start Fix my generated pptx file that opens blank in PowerPoint by deduplicating its slide parts and rebuilding the presentation relationships.

Frequently Asked Questions about pptx-template-clean-rebuild

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why is my python-pptx generated file blank in PowerPoint?

Blank output usually means duplicate slide parts in the zip or duplicate slide references in presentation.xml.rels, caused by clearing a template's slides without removing their parts. LibreOffice tolerates this, but PowerPoint's strict parser rejects the package.

How do I fix duplicate slide entries in a pptx file?

Open the .pptx as a zip, keep only the last-written entry for each duplicated filename, and rewrite the archive. Then rebuild presentation.xml.rels so each slide has one unique relationship ID referenced by sldIdLst.

Why are only some slides blank in my generated PowerPoint file?

Partial blanking happens when newly assigned slide rIds collide with non-slide relationships like notesMaster or presProps that occupy high rId numbers. Assign slide rIds starting above the maximum non-slide relationship ID to avoid collisions.

Does LibreOffice opening the file mean my pptx is valid?

No. LibreOffice is lenient with malformed packages, so a file can render there while PowerPoint and strict preview engines show it as blank. Treat LibreOffice-normal plus PowerPoint-blank as a sign of package structure problems, not data loss.

When should I run the pptx cleanup in my generation script?

Run the deduplication and rels rebuild as a post-processing step immediately after prs.save(), wrapped in a finalize function. This guarantees every generated file from a slide-containing template is clean without manual intervention.