pptx-debug-workflow
What it does
This skill is a careful method for building .pptx presentations with the python-pptx library, with testing and debugging at each stage. It is for people writing deck-making code who want fewer errors.
When to use it
- ✓When I am writing Python code that creates a PowerPoint presentation.
- ✓When the deck script fails and I need to find the cause.
- ✓When I want to confirm python-pptx works before building a full deck.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pptx-debug-workflow/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Help me write a Python script that builds a PowerPoint with charts and several slides. Test the basics first so we avoid errors.”
5 new skills a week. 1 minute to read.
How it works
The AI checks that python-pptx is installed, runs a minimal test deck, then writes the full script to a file so errors show line numbers and the script can be re-run.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
PPTX Debugging Workflow
A systematic approach to creating and debugging PowerPoint presentations using the python-pptx library. This workflow ensures reliable presentation generation through iterative verification and error resolution.
Step 1: Verify Installation
Before writing any code, verify that python-pptx is installed:
pip show python-pptx
If not installed:
pip install python-pptx
Step 2: Test Minimal PPTX Creation
Create and run a minimal test script to verify the library works:
from pptx import Presentation
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Test Slide"
prs.save("test.pptx")
print("Test presentation created successfully")
Run this first to confirm basic functionality before building complex presentations.
Step 3: Write Full Script to File
Always write your presentation script to a .py file instead of using heredoc or inline execution. This enables:
- Better error messages with line numbers
- Easier iteration and debugging
- Preserved state between error fixes
Example structure:
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.enum.shapes import MSO_SHAPE
from pptx.enum.chart import XL_CHART_TYPE, XL_LEGEND_POSITION
from pptx.chart.data import CategoryChartData
def create_presentation():
prs = Presentation()
# Build slides here
prs.save("output.pptx")
print("Presentation saved successfully")
if __name__ == "__main__":
create_presentation()
Step 4: Execute and Capture Full Traceback
Run the script with full error output:
python your_script.py 2>&1 | tee debug_output.log
This captures the complete Python traceback including:
- Error type and message
- Line numbers where errors occurred
- Stack trace for debugging
Step 5: Fix API Errors Iteratively
Common python-pptx API patterns to remember:
Chart Legend Positioning
Use XL_LEGEND_POSITION (NOT XL_CHART_TYPE) for legend positioning:
from pptx.enum.chart import XL_LEGEND_POSITION
chart.chart.has_legend = True
chart.chart.legend.position = XL_LEGEND_POSITION.RIGHT
Table Cell Access
Access table cells through row iteration pattern:
table = slide.shapes.add_table(rows=5, cols=4, left=Inches(1), top=Inches(2), width=Inches(6), height=Inches(3)).table
# Correct pattern - iterate through rows, then cells
for row_idx, row in enumerate(table.rows):
for cell_idx, cell in enumerate(row.cells):
cell.text = f"Row {row_idx}, Cell {cell_idx}"
# Or direct access
table.rows[0].cells[0].text = "Header"
Chart Data Format
For pie charts, use category-based data:
chart_data = CategoryChartData()
chart_data.categories = ['Category A', 'Category B', 'Category C']
chart_data.add_series('Series 1', (30, 45, 25))
x, y, cx, cy = Inches(2), Inches(2), Inches(6), Inches(4.5)
slide.shapes.add_chart(XL_CHART_TYPE.PIE, x, y, cx, cy, chart_data)
Step 6: Validate Output
After successful execution:
- Verify the
.pptxfile was created - Open in PowerPoint or compatible viewer
- Check that all slides, tables, and charts render correctly
Common Troubleshooting
| Issue | Solution |
|---|---|
| Module not found | pip install python-pptx |
| AttributeError on chart | Check XL_LEGEND_POSITION vs XL_CHART_TYPE |
| Table cell access fails | Use table.rows[row].cells[cell] pattern |
| Chart doesn't display | Verify chart_data format matches chart type |
| Import errors | Check enum imports from pptx.enum.* |
Quick Reference Script Template
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.enum.chart import XL_CHART_TYPE, XL_LEGEND_POSITION
from pptx.chart.data import CategoryChartData
def main():
prs = Presentation()
# Add title slide
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Title"
# Add content slide with table
slide = prs.slides.add_slide(prs.slide_layouts[1])
table = slide.shapes.add_table(3, 3, Inches(1), Inches(2), Inches(8), Inches(2)).table
for row in table.rows:
for cell in row.cells:
cell.text = "Data"
prs.save("presentation.pptx")
print("Done!")
if __name__ == "__main__":
main()
FAQ
Why test a minimal deck first?
It confirms the library works before time is spent on the full presentation.
Why write the script to a file?
A file gives clearer error messages with line numbers and can be edited and re-run.
Can the deck include charts?
Yes, the example imports chart types and chart data classes from python-pptx.
Details
Original description by the author
Systematic debugging workflow for python-pptx presentation generation
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #12947
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.