pptx-debug-workflow
Qué hace
Esta skill es un método cuidadoso para crear archivos .pptx con la biblioteca python-pptx, con pruebas y depuración en cada etapa. Está pensada para quienes escriben código para generar presentaciones y quieren menos errores.
Cuándo usarla
- ✓Cuando estoy escribiendo código Python que crea una presentación de PowerPoint.
- ✓Cuando el script de la presentación falla y necesito encontrar la causa.
- ✓Cuando quiero confirmar que python-pptx funciona antes de crear una presentación completa.
Link de la skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pptx-debug-workflow/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Ayúdame a escribir un script de Python que cree un PowerPoint con gráficos y varias diapositivas. Prueba primero lo básico para evitar errores.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La IA comprueba que python-pptx está instalado, ejecuta una presentación mínima de prueba y después escribe el script completo en un archivo, para que los errores muestren números de línea y el script pueda volver a ejecutarse.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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()
Preguntas frecuentes
¿Por qué probar primero una presentación mínima?
Confirma que la biblioteca funciona antes de dedicar tiempo a la presentación completa.
¿Por qué escribir el script en un archivo?
Un archivo da mensajes de error más claros con números de línea, y puede editarse y volver a ejecutarse.
¿La presentación puede incluir gráficos?
Sí. El ejemplo importa tipos de gráfico y clases de datos de gráfico de python-pptx.
Detalles
Descripción original del autor
Systematic debugging workflow for python-pptx presentation generation
repo: HKUDS/AgentPilot
Popularidad
- Estrellas en GitHub
- 7,8 mil
- Posición en el ranking
- #12947
- Licencia
- MIT
- Actualizada
- 1/11/2026
Comentarios
- …
Más skills de este repositorio
agentpilot
7,8 milAyuda a tu agente a mejorar un proyecto paso a paso, preparando una tarea y ejecutando el bucle de AgentPilot que propone, prueba y puntúa cambios.
openspace
7,8 milAyuda a tu agente a configurar OpenSpace, una herramienta que guarda y recupera skills de agentes, y a conectarla a tu app de IA mediante MCP.
rsi-arena
7,8 milAyuda a tu agente a configurar y ejecutar pruebas de referencia de IA conocidas, como AIME y Terminal-Bench, para comparar distintos métodos de mejora.
experiment-guide
7,8 milAyuda a tu agente a planificar experimentos pequeños, leer sus resultados y anotar conclusiones mientras investiga cómo mejorar un programa.
Skills parecidas
feishu-doc
394 milAyuda a tu agente a leer, crear y editar documentos en la nube de Feishu, incluidos texto, imágenes y tablas, usando la herramienta de documentos.
feishu-drive
394 milPermite que tu agente explore, organice y comente archivos de una carpeta de la nube de Feishu que se haya compartido con el bot.
feishu-perm
394 milAyuda a tu agente a revisar y cambiar quién puede acceder a un archivo de Feishu, eligiendo el permiso más pequeño que cumpla tu petición.