Skip to content

OpenSenseNova/SenseNova-Skills / skills/sn-ppt-creative

sn-ppt-creative

Verified

Use when a prepared PPT task with a current outline.md should be generated as an image-first presentation with one 16:9 image per slide and optional PPTX packaging.

FileKindSize
SKILL.mdskill md8.0 KB
requirements.txtmanifest20 B
scripts/build_pptx.pyscript3.7 KB
scripts/resume_scan.pyscript1.5 KB
scripts/sanitize_prompt.pyscript4.6 KB

scripts/build_pptx.py

View on GitHub
"""Assemble creative-mode PNGs into a single 16:9 PPTX, one image per slide, full-bleed.

Usage:
    python3 build_pptx.py --deck-dir <deck_dir> [--output <path>]

Default output: <deck_dir>/<deck_id>.pptx (deck_id from task_pack.json).

Behavior:
- Reads task_pack.json for page_count and deck_id.
- Reads a legacy outline.json (if present) to order old tasks by page_no;
  otherwise uses task_pack page_count. Accepts both the current flat
  pages/page_NNN.png layout and the legacy nested pages/page_NNN/page_NNN.png.
- Missing PNGs are skipped with a warning line on stderr; they do NOT abort.
- Each slide is 16:9 (13.333 x 7.5 inches). Images are stretched to fill the slide.
- Emits a single JSON line on stdout summarizing the result.
"""
from __future__ import annotations

import argparse
import json
import sys
from pathlib import Path

from pptx import Presentation
from pptx.util import Inches


SLIDE_W = Inches(13.333)
SLIDE_H = Inches(7.5)


def resolve_page_order(deck: Path, page_count: int) -> list[tuple[int, Path]]:
    outline_path = deck / "outline.json"
    pages_dir = deck / "pages"
    ordered: list[tuple[int, Path]] = []
    if outline_path.exists():
        data = json.loads(outline_path.read_text(encoding="utf-8"))
        for page in data.get("pages", []):
            n = int(page["page_no"])
            png = resolve_page_png(pages_dir, n)
            ordered.append((n, png))
        ordered.sort(key=lambda x: x[0])
    else:
        for n in range(1, page_count + 1):
            ordered.append((n, resolve_page_png(pages_dir, n)))
    return ordered


def resolve_page_png(pages_dir: Path, page_no: int) -> Path:
    name = f"page_{page_no:03d}"
    flat = pages_dir / f"{name}.png"
    if flat.exists():
        return flat
    return pages_dir / name / f"{name}.png"


def build(deck: Path, output: Path) -> dict:
    tp = json.loads((deck / "task_pack.json").read_text(encoding="utf-8"))
    deck_id = tp.get("deck_id") or deck.name
    page_count = int(tp["params"]["page_count"])

    prs = Presentation()
    prs.slide_width = SLIDE_W
    prs.slide_height = SLIDE_H
    blank_layout = prs.slide_layouts[6]

    included: list[int] = []
    missing: list[int] = []
    for n, png in resolve_page_order(deck, page_count):
        slide = prs.slides.add_slide(blank_layout)
        if png.exists():
            slide.shapes.add_picture(str(png), 0, 0, width=SLIDE_W, height=SLIDE_H)
            included.append(n)
        else:
            missing.append(n)
            print(f"[build_pptx] page_{n:03d}.png missing, inserting blank slide", file=sys.stderr)

    output.parent.mkdir(parents=True, exist_ok=True)
    prs.save(str(output))

    return {
        "deck_id": deck_id,
        "output": str(output),
        "total_slides": len(included) + len(missing),
        "included_pages": included,
        "missing_pages": missing,
    }


def main(argv: list[str] | None = None) -> int:
    p = argparse.ArgumentParser()
    p.add_argument("--deck-dir", type=Path, required=True)
    p.add_argument("--output", type=Path, default=None,
                   help="Output .pptx path. Default: <deck_dir>/<deck_id>.pptx")
    args = p.parse_args(argv)

    deck = args.deck_dir.expanduser().resolve()
    if not (deck / "task_pack.json").exists():
        print(json.dumps({"error": f"task_pack.json missing in {deck}"}, ensure_ascii=False))
        return 2

    if args.output is None:
        tp = json.loads((deck / "task_pack.json").read_text(encoding="utf-8"))
        deck_id = tp.get("deck_id") or deck.name
        output = deck / f"{deck_id}.pptx"
    else:
        output = args.output.expanduser().resolve()

    result = build(deck, output)
    print(json.dumps(result, ensure_ascii=False))
    return 0


if __name__ == "__main__":
    sys.exit(main())
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall