본문으로 건너뛰기
cccskills
무료GitHub에 공개

ppt-generation-resilient

Create PowerPoint presentations with shell_agent, then switch to Python and python-pptx if generation fails. The workflow captures error details, locates output files, and checks that the presentation opens and contains the expected slides.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Resilient PowerPoint generation with shell_agent primary path and python-pptx fallback

연동 도구PowerPoint
설치 방법 보기

이럴 때 유용합니다

  • Creating slides from a specified outline
  • Recovering from presentation generation errors
  • Locating PowerPoint files saved in unexpected folders
  • Checking generated files and slide counts

포함된 파일(2)

  • SKILL.md9.3 KB
  • .skill_id44 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Resilient PowerPoint Generation Workflow

When to Use This Skill

Use this workflow when:

  • You need to create PowerPoint presentations programmatically
  • shell_agent may fail or produce opaque error messages
  • You need robust error handling and debugging capabilities
  • Output files may be created in unexpected nested directories

Overview

This workflow provides two paths:

  1. Primary: Use shell_agent with clear specifications (preferred for simple presentations)
  2. Fallback: Direct Python execution with python-pptx library (for complex or failed shell_agent attempts)

Both paths include automatic error capture and file location verification.


Path 1: shell_agent (Primary)

Step 1.1: Delegate with Clear Specifications

Use shell_agent to create a PowerPoint presentation with:
- Specify exact number of slides needed
- Define content/topic for each slide
- Request file saved with clear filename (e.g., presentation.pptx)
- Ask agent to confirm the full file path after creation
- Request agent report any errors with full output

Example task description:

Create a PowerPoint presentation with 10 slides covering [topic]. Each slide should have a title and bullet points. Save it as presentation.pptx in the current working directory and report the full file path. If you encounter any errors, show the complete error message.

Step 1.2: Verify shell_agent Success

Check if shell_agent completed successfully:

  • Did it report a file path?
  • Can you access the file at that path?
  • Is the file size > 0 bytes?

If any check fails, proceed to Path 2 (Fallback).


Path 2: Direct Python with python-pptx (Fallback)

Step 2.1: Create Python Script File

First, write the PowerPoint generation script to a .py file (do NOT use inline execution):

# save as: generate_presentation.py
from pptx import Presentation
from pptx.util import Inches, Pt
import os

# CRITICAL: Explicitly set and verify working directory
working_dir = os.getcwd()
print(f"Working directory: {working_dir}")

# Create presentation
prs = Presentation()

# Example: Add slides with content
slides_content = [
    {"title": "Slide 1 Title", "content": ["Bullet 1", "Bullet 2"]},
    {"title": "Slide 2 Title", "content": ["Point A", "Point B", "Point C"]},
    # Add more slides as needed
]

for slide_data in slides_content:
    slide_layout = prs.slide_layouts[1]  # Title and Content layout
    slide = prs.slides.add_slide(slide_layout)
    
    # Set title
    title = slide.shapes.title
    title.text = slide_data["title"]
    
    # Set content
    content = slide.placeholders[1]
    tf = content.text_frame
    tf.clear()  # Clear existing content
    
    for i, point in enumerate(slide_data["content"]):
        if i == 0:
            p = tf.paragraphs[0]
        else:
            p = tf.add_paragraph()
        p.text = point
        p.font.size = Pt(18)

# Save to current working directory with explicit path
output_filename = "presentation.pptx"
output_path = os.path.join(working_dir, output_filename)
prs.save(output_path)

print(f"Presentation saved to: {output_path}")
print(f"File exists: {os.path.exists(output_path)}")
print(f"File size: {os.path.getsize(output_path)} bytes")

Step 2.2: Execute with Error Output Capture

CRITICAL: Always redirect stderr to stdout to capture actual error messages:

# Execute the script with full error output
python generate_presentation.py 2>&1

# Or if using run_shell tool, ensure 2>&1 is included

Why this matters: Without 2>&1, Python exceptions are sent to stderr and you only see "unknown error" instead of the actual exception message.

Step 2.3: Debug Common Issues

If execution fails, add these debugging commands:

# Check if python-pptx is installed
python -c "import pptx; print(pptx.__version__)" 2>&1

# Check working directory
pwd
ls -la

# Check Python version
python --version

# Run with verbose error output
python -u generate_presentation.py 2>&1 | tee execution_log.txt

Step 3: Locate the Output File (Both Paths)

PowerPoint files may be in nested workspace directories. Always verify location:

# Find all .pptx files in workspace
find . -name "*.pptx" -type f 2>&1

# Or search for specific filename
find . -name "presentation.pptx" -type f 2>&1

# If not found locally, search broader (last resort)
find /workspace -name "*.pptx" -type f 2>/dev/null

Step 4: Copy to Working Directory

Once located, copy the file to your working directory:

# Get the full path from find output
FILE_PATH=$(find . -name "presentation.pptx" -type f | head -1)

# Copy to current directory
cp "$FILE_PATH" . 2>&1

# Or move it
mv "$FILE_PATH" . 2>&1

Step 5: Verify the File

Confirm the file exists and is valid:

# List file with details
ls -la presentation.pptx

# Check file size (should NOT be 0 bytes)
file presentation.pptx
stat presentation.pptx | grep Size

# Verify it's a valid PowerPoint file
python -c "from pptx import Presentation; prs = Presentation('presentation.pptx'); print(f'Slides: {len(prs.slides)}')" 2>&1

Common Pitfalls & Solutions

ProblemSolution
shell_agent returns "unknown error"Switch to Path 2 (direct Python) immediately
Python script fails silentlyAdd 2>&1 to capture stderr; use python -u for unbuffered output
File not found after generationUse find . -name "*.pptx" - don't assume current directory
File is 0 bytesRe-run generation; check for exceptions in error output
Working directory confusionAlways print(os.getcwd()) in Python scripts; use absolute paths
Module not found (pptx)Install with pip install python-pptx or use alternative environment
Permission deniedCheck directory permissions: ls -la on parent dirs; use /workspace/ prefix

Decision Tree

Start
  │
  └─→ Try shell_agent with clear specs
        │
        ├─→ Success + File path reported? ──→ Verify file → Done
        │
        └─→ Failed or opaque error?
              │
              └─→ Switch to direct Python (Path 2)
                    │
                    ├─→ Write script to .py file
                    ├─→ Execute with 2>&1 redirect
                    ├─→ Capture and analyze errors
                    ├─→ Fix and retry (max 3 attempts)
                    │
                    └─→ Success? → Locate → Copy → Verify → Done
                    └─→ Still failing? → Report actual error messages

Example: Complete Workflow

# Attempt 1: shell_agent (via task delegation)
# [Agent creates presentation, reports path or error]

# If shell_agent failed, proceed to Path 2:

# Step 1: Write Python script
cat > generate_presentation.py << 'EOF'
from pptx import Presentation
import os
print(f"Working directory: {os.getcwd()}")
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Title Slide"
prs.save("presentation.pptx")
print(f"Saved: presentation.pptx")
EOF

# Step 2: Execute with error capture
python generate_presentation.py 2>&1
# Output: Working directory: /workspace/task_123
#         Saved: presentation.pptx

# Step 3: Locate (in case it's nested)
find . -name "presentation.pptx" -type f
# Output: ./presentation.pptx

# Step 4: Verify
ls -la presentation.pptx
# Output: -rw-r--r-- 1 user user 45632 Jan 15 10:30 presentation.pptx

python -c "from pptx import Presentation; print(len(Presentation('presentation.pptx').slides))"
# Output: 1

Troubleshooting: Detailed Error Diagnosis

When you see "unknown error" from run_shell:

# This is NOT helpful - stderr is hidden
python script.py

# This CAPTURES the actual error
python script.py 2>&1

# This CAPTURES and LOGS for analysis
python script.py 2>&1 | tee error_log.txt

When working directory is unclear:

# Always include this at script start
import os
print(f"CWD: {os.getcwd()}")
print(f"Files in CWD: {os.listdir('.')}")

# Use absolute paths for output
output_path = os.path.join(os.getcwd(), "presentation.pptx")

When multiple .pptx files exist:

# Find most recently created
find . -name "*.pptx" -type f -printf '%T@ %p\n' | sort -n | tail -1

# Or find by name pattern
find . -name "*presentation*.pptx" -type f

Tool-Specific Notes

run_shell

  • ALWAYS include 2>&1 to capture Python exceptions
  • Consider python -u for unbuffered output (real-time error display)
  • Use | tee logfile.txt to preserve error output for analysis

shell_agent

  • Request explicit file path confirmation in task description
  • Ask agent to report full error messages if generation fails
  • Be prepared to switch to Path 2 if errors are opaque

execute_code_sandbox

  • May have module availability issues (e.g., missing python-pptx)
  • Prefer run_shell with explicit script file for complex tasks
  • Verify module availability before relying on this tool

Success Criteria

A successful PowerPoint generation workflow:

  • File exists at known path
  • File size > 0 bytes (typically > 10KB for multi-slide)
  • File can be opened by python-pptx without errors
  • Expected number of slides present
  • Slide titles match specifications *** End Files

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Prepare audio stems, the separate parts of a track, for mixing by matching their durations with silence, loops, or crossfades. Verify each generated and processed file before moving to the next production step.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Match audio parts with different durations
  • Extend drums and melodic parts using suitable methods
  • Check audio specifications before mixing
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Produce audio in separate stems, meaning individual instrument tracks, and verify each output as you go. Align track lengths with silence, loops, or crossfades, then apply effects, mix a master, and package the files.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Align instrument tracks to a reference audio file
  • Choose how to extend tracks that are too short
  • Verify audio properties after generation and effects
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Produce a master track and separate audio parts through a structured Python workflow. Apply filters and reverb, export WAV files with consistent settings, package them in a ZIP archive, and check that the deliverables meet the requested specifications.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Export a master track with separate audio parts
  • Apply filters and reverb to audio
  • Check duration and format across deliverables
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

When Python execution repeatedly fails in execute_code_sandbox, use a file-based alternative: save the script, run it through the shell, and capture results or errors. The guidance covers paths, imports, timeouts, structured output, and optional cleanup.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Retry Python work through the shell after repeated sandbox failures
  • Run longer tasks with an adjusted timeout
  • Execute Python work that needs multiple files or system utilities
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

HKUDS의 스킬 모두 보기

이 스킬의 문제 신고