Automate PPT Creation with CodeBuddy AI Skills: A Hands‑On Guide

This article walks through the common pain points of manual PPT preparation and shows how CodeBuddy’s document‑skills PPTX skill can automate slide generation, editing, and templating through step‑by‑step installation, configuration, and practical examples, including code snippets and visual results.

Tencent Technical Engineering
Tencent Technical Engineering
Tencent Technical Engineering
Automate PPT Creation with CodeBuddy AI Skills: A Hands‑On Guide

Why PPT creation is painful

Typical issues include missing templates, unclear structure, costly professional designs, and insufficient time, which lead to rushed and low‑quality slides.

Quick start with CodeBuddy

Install CodeBuddy

Download the IDE from https://copilot.tencent.com/ide or install the CLI version with

npm install -g @tencent-ai/codebuddy-code & codebuddy update

Install the document‑skills package

Add the Skills marketplace and install the document-skills plugin:

/plugin marketplace add anthropics/skills
/plugin install document-skills@anthropic-agent-skills

The document-skills package supports docx, pptx, pdf and xlsx formats.

First interaction

面向非专业开发者,基于 https://copilot.tencent.com 网站内容,写一份介绍 PPT ,背景色采用 腾讯蓝 #0161FF,PPT 命名为腾讯蓝版本

Scenario‑based practice

No‑template PPT generation

Prompt example for a music‑app prototype:

我想开发一个酷炫的音乐APP,现在需要采用 skill 输出高保真的原型图,最终需要 PPT 保留,请通过以下方式帮我完成所有界面的原型设计,并确保这些原型界面可以直接用于开发:

The skill renders HTML prototypes with Playwright, extracts DOM positions, converts CSS units (1 px = 0.75 pt) and generates a .pptx file.

Template‑based PPT generation

Prompt example for a CEO report:

采用 Skills,按照该模版,帮我做一份面向 CEO 的汇报 CodeBuddy 的 PPT,数据就用这几个指标:周活跃用户数5万+、AI 代码生成占比超 50%、 人均编码时间缩短40%、人均千行bug率降低 31.5%,其他内容你来推荐写。

The skill analyses the supplied template, copies/re‑orders slides, and replaces placeholder text with the generated content.

Converting existing documents to PPT

Command to convert a Word or HTML file:

采用文档 skills 帮我进行读取该文件并进行生成一份 PPT

The skill extracts text and layout information from the source document and creates a matching slide deck.

Deep dive into the PPT skill architecture

Overview

The document‑skills pptx skill combines three multi‑modal workflows:

HTML‑to‑PPT: AI creates an HTML slide, Playwright renders it headlessly, DOM elements are extracted, CSS is parsed, positions are converted to PowerPoint units, and a .pptx file is generated.

OOXML editing: The existing .pptx is unzipped, slide XML files are edited directly, validated against the Office Open XML schema, and re‑zipped.

Template system: The skill analyses a template, builds a content map, copies or reorders slides, replaces placeholder text, and validates the visual output.

Key algorithms

Unit conversion : 1 px = 0.75 pt, 1 inch = 96 px = 72 pt = 914400 EMU.

Overflow detection : Checks whether extracted element dimensions exceed slide margins (0.5 inch bottom margin).

OOXML unpack/pack : Uses Python zipfile to extract .pptx (a ZIP archive), modifies slideN.xml and related parts, validates with XSD schemas, then re‑zips.

Template analysis : Generates thumbnails, extracts text placeholders, creates a mapping {slide‑id → shape‑id}, and performs smart text replacement.

# Example Python unpacker
import zipfile
from pathlib import Path

def unpack_document(office_file, output_dir):
    output_dir = Path(output_dir)
    output_dir.mkdir(parents=True, exist_ok=True)
    with zipfile.ZipFile(office_file, 'r') as zf:
        zf.extractall(output_dir)
    print(f"Unpacked {office_file} to {output_dir}")

Design principles

HTML‑first : Leverages AI familiarity with HTML/CSS for slide creation.

Validation‑first : Multi‑layer checks (HTML syntax, layout constraints, OOXML schema, final file integrity).

Tool‑chain modularity : Separate scripts for thumbnail generation, inventory extraction, rearrangement, replacement, validation and packing.

Built‑in 18 professional colour palettes and a set of web‑safe fonts (Arial, Helvetica, Times New Roman, Georgia, Courier New, Verdana, Tahoma, Trebuchet MS, Impact).

Layout optimisation algorithm selects single‑column or two‑column layouts based on content type.

Performance and error handling

Parallel slide processing is limited by a configurable concurrency level (default = 3). The workflow includes progressive degradation (fallback to a basic slide when HTML conversion fails), batch validation, automatic backups before editing, and rollback on failure.

async function processSlidesParallel(htmlFiles, pptx) {
    const concurrency = 3;
    const chunks = chunkArray(htmlFiles, concurrency);
    for (const chunk of chunks) {
        const promises = chunk.map(htmlFile =>
            html2pptx(htmlFile, pptx)
                .then(res => typeof res === 'object' && res !== null ? { ...res, file: htmlFile } : { result: res, file: htmlFile })
                .catch(error => ({ error: error.message, file: htmlFile }))
        );
        const results = await Promise.all(promises);
        handleProcessingResults(results);
    }
    console.log('
All processing completed.');
}

Quality‑assurance system

Validation layers include:

HTML validation (tag nesting, CSS compliance, size limits).

Layout validation (position, margin, alignment).

Content validation (text overflow, font compatibility, colour contrast).

Output validation (file integrity, readability).

A thumbnail grid is generated for visual inspection:

def generate_thumbnail_grid(pptx_path, output_prefix, cols=5):
    try:
        pdf_path = convert_pptx_to_pdf(pptx_path)
        images = convert_pdf_to_images(pdf_path)
        grid = create_image_grid(images, cols)
        output_filename = f"{output_prefix}.jpg"
        grid.save(output_filename, quality=85)
        print(f"✅ Check result saved: {output_filename}")
    except Exception as e:
        print(f"❌ Process aborted: {e}")
        sys.exit(1)

Advantages and limitations

Technical advantages

Supports three distinct workflows (HTML‑first, OOXML edit, template reuse) for flexible use cases.

Pixel‑level conversion ensures visual fidelity between web layouts and PowerPoint slides.

Enterprise‑grade batch processing with configurable concurrency.

Modular architecture enables easy extension and integration of new features.

Current limitations

CSS features such as gradients, complex animations, and deeply nested layouts are not fully supported.

Only web‑safe fonts are guaranteed; custom fonts may not render correctly.

Large‑scale documents (thousands of slides) can incur noticeable processing time and memory usage.

Practical tips for using CodeBuddy

Express requirements clearly and break tasks into orthogonal sub‑tasks.

Iterate on one small goal per round; use multi‑turn dialogue with the AI.

Back up work frequently with Git (e.g.,

git init
git add .
git commit -m "Add search component"

).

Provide images and detailed context to avoid AI drift.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AIworkflowtutorialpresentationCodeBuddyPPT automationdocument-skills
Tencent Technical Engineering
Written by

Tencent Technical Engineering

Official account of Tencent Technology. A platform for publishing and analyzing Tencent's technological innovations and cutting-edge developments.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.