Skip to content

guanyang/open-agent-hub / skills/pptx

Use 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.

FileKindSize
LICENSE.txtmarkdown11.1 KB
SKILL.mdskill md27.7 KB
editing.mdmarkdown6.7 KB
html2pptx.mdmarkdown19.4 KB
ooxml.mdmarkdown10.1 KB
ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsdother73.2 KB
ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsdother6.8 KB
ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsdother50.1 KB
ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsdother624 B
ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsdother148.5 KB
ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsdother1.2 KB
ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsdother8.7 KB
ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsdother14.4 KB
ooxml/schemas/ISO-IEC29500-4_2016/pml.xsdother81.7 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsdother1.2 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsdother7.2 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsdother6.2 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsdother1.2 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsdother880 B
ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsdother2.5 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsdother3.4 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsdother7.3 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsdother22.8 KB
ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsdother1.3 KB
ooxml/schemas/ISO-IEC29500-4_2016/sml.xsdother236.6 KB
ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsdother25.5 KB
ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsdother24.7 KB
ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsdother535 B
ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsdother5.6 KB
ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsdother3.9 KB
ooxml/schemas/ISO-IEC29500-4_2016/wml.xsdother167.4 KB
ooxml/schemas/ISO-IEC29500-4_2016/xml.xsdother4.5 KB
ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsdother1.9 KB
ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsdother2.5 KB
ooxml/schemas/ecma/fouth-edition/opc-digSig.xsdother2.8 KB
ooxml/schemas/ecma/fouth-edition/opc-relationships.xsdother1.3 KB
ooxml/schemas/mce/mc.xsdother3.1 KB
ooxml/schemas/microsoft/wml-2010.xsdother25.9 KB
ooxml/schemas/microsoft/wml-2012.xsdother3.7 KB
ooxml/schemas/microsoft/wml-2018.xsdother901 B
ooxml/schemas/microsoft/wml-cex-2018.xsdother1.7 KB
ooxml/schemas/microsoft/wml-cid-2016.xsdother1002 B
ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsdother600 B
ooxml/schemas/microsoft/wml-symex-2015.xsdother745 B
ooxml/scripts/pack.pyexecutablescript5.5 KB
ooxml/scripts/unpack.pyexecutablescript1.0 KB
ooxml/scripts/validate.pyexecutablescript1.9 KB
ooxml/scripts/validation/__init__.pyscript336 B
ooxml/scripts/validation/base.pyscript39.0 KB
ooxml/scripts/validation/docx.pyscript9.8 KB
ooxml/scripts/validation/pptx.pyscript12.0 KB
ooxml/scripts/validation/redlining.pyscript10.9 KB
pptxgenjs.mdmarkdown12.5 KB
scripts/__init__.pyscript0 B
scripts/add_slide.pyexecutablescript18.4 KB
scripts/apply_theme.jsscript7.1 KB
scripts/clean.pyexecutablescript10.2 KB
scripts/html2pptx.jsexecutablescript36.9 KB
scripts/inventory.pyexecutablescript37.2 KB
scripts/office/helpers/__init__.pyscript3.9 KB
scripts/office/helpers/merge_runs.pyscript5.4 KB
scripts/office/helpers/pptx_chart.pyscript9.7 KB
scripts/office/helpers/pptx_slide.pyscript3.3 KB
scripts/office/helpers/pptx_theme.pyscript3.4 KB
scripts/office/helpers/simplify_redlines.pyscript5.6 KB
scripts/office/pack.pyexecutablescript4.9 KB
scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsdother73.2 KB
scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsdother6.8 KB
scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsdother50.1 KB
scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsdother624 B
scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsdother148.5 KB
scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsdother1.2 KB
scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsdother8.7 KB
scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsdother14.4 KB
scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsdother81.7 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsdother1.2 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsdother7.2 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsdother6.2 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsdother1.2 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsdother880 B
scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsdother2.5 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsdother3.4 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsdother7.3 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsdother22.8 KB
scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsdother1.3 KB
scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsdother236.6 KB
scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsdother25.5 KB
scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsdother24.7 KB
scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsdother535 B
scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsdother5.6 KB
scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsdother3.9 KB
scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsdother167.4 KB
scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsdother4.5 KB
scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsdother1.9 KB
scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsdother2.5 KB
scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsdother2.8 KB
scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsdother1.3 KB
scripts/office/schemas/mce/mc.xsdother3.1 KB
scripts/office/schemas/microsoft/wml-2010.xsdother25.9 KB
scripts/office/schemas/microsoft/wml-2012.xsdother3.7 KB
scripts/office/schemas/microsoft/wml-2018.xsdother901 B
scripts/office/schemas/microsoft/wml-cex-2018.xsdother1.7 KB
scripts/office/schemas/microsoft/wml-cid-2016.xsdother1002 B
scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsdother600 B
scripts/office/schemas/microsoft/wml-symex-2015.xsdother745 B
scripts/office/soffice.pyscript8.9 KB
scripts/office/unpack.pyexecutablescript4.0 KB
scripts/office/validate.pyexecutablescript7.6 KB
scripts/office/validators/__init__.pyscript336 B
scripts/office/validators/base.pyscript33.6 KB
scripts/office/validators/docx.pyscript19.3 KB
scripts/office/validators/pptx.pyscript20.6 KB
scripts/office/validators/redlining.pyscript18.5 KB
scripts/rearrange.pyexecutablescript8.3 KB
scripts/replace.pyexecutablescript13.3 KB
scripts/slide_text.pyexecutablescript4.3 KB
scripts/thumbnail.pyexecutablescript9.6 KB

scripts/slide_text.py

View on GitHub
"""Print each slide of a .pptx, .pptm, .potx or .ppsx as markdown under `<!-- Slide number: N -->`.

Title, text, tables, chart data, picture alt text and speaker notes; shapes top to bottom.

Usage: python slide_text.py deck.pptx
"""

import os
import re
import sys
import zipfile

from pptx.package import Package


def _position(shape):
    try:
        return (shape.top or 0, shape.left or 0)
    except Exception:
        return (0, 0)


def _one_line(text) -> str:
    return " ".join(str(text).split())


def _table(rows) -> list[str]:
    lines = ["| " + " | ".join(_one_line(c).replace("|", "\\|") for c in r) + " |" for r in rows]
    if lines:
        lines.insert(1, "|" + " --- |" * len(rows[0]))
    return lines


def _chart(chart) -> list[str]:
    heading = "### Chart"
    try:
        if chart.has_title and chart.chart_title.has_text_frame:
            heading += ": " + _one_line(chart.chart_title.text_frame.text)
        categories = [c.label for c in chart.plots[0].categories]
        series = [(s.name, list(s.values)) for s in chart.series]
    except Exception as e:
        return [
            heading,
            f"[chart data not readable ({type(e).__name__}): render the slide to see it]",
        ]
    rows = [["Category", *(name for name, _ in series)]]
    for i, category in enumerate(categories):
        rows.append([category, *(v[i] if i < len(v) else "" for _, v in series)])
    return [heading, "", *_table(rows)]


def _shape(shape) -> list[str]:
    tag = shape._element.tag
    if tag.endswith("}grpSp"):
        return _shapes(shape.shapes)
    if tag.endswith("}pic"):
        alt = _one_line(shape._element._nvXxPr.cNvPr.get("descr", ""))
        return [f"![{alt}]({shape.name})"]
    if getattr(shape, "has_table", False):
        return ["", *_table([[c.text for c in r.cells] for r in shape.table.rows]), ""]
    if getattr(shape, "has_chart", False):
        return ["", *_chart(shape.chart), ""]
    if shape.has_text_frame and shape.text_frame.text.strip():
        text = shape.text_frame.text.replace("\v", "\n")
        is_title = shape.is_placeholder and shape.placeholder_format.idx == 0
        return ["# " + text.lstrip() if is_title else text]
    return []


def _members(shapes) -> list:
    try:
        return list(shapes)
    except Exception:
        pass
    members = []
    for i in range(len(shapes)):
        try:
            members.append(shapes[i])
        except Exception as e:
            members.append(e)
    return members


def _shapes(shapes) -> list[str]:
    lines = []
    for shape in sorted(_members(shapes), key=_position):
        try:
            if isinstance(shape, Exception):
                raise shape
            lines += _shape(shape)
        except Exception as e:
            lines.append(f"[shape not readable ({type(e).__name__}): render the slide to see it]")
    return lines


def slide_text(slide, number: int) -> str:
    lines = [f"<!-- Slide number: {number} -->", *_shapes(slide.shapes)]
    try:
        notes = slide.notes_slide.notes_text_frame if slide.has_notes_slide else None
        if notes is not None and notes.text.strip():
            lines += ["", "### Notes:", notes.text.replace("\v", "\n")]
    except Exception as e:
        lines += ["", f"[notes not readable ({type(e).__name__})]"]
    return re.sub(r"\n{3,}", "\n\n", "\n".join(lines).strip())


def main() -> None:
    if len(sys.argv) != 2:
        sys.exit("Usage: python slide_text.py deck.pptx")
    path = sys.argv[1]
    if not os.path.isfile(path):
        sys.exit(f"Error: {path} {'is not a file' if os.path.exists(path) else 'does not exist'}")
    if not zipfile.is_zipfile(path):
        sys.exit(
            f"Error: {path} is corrupt, password-protected, or an old .ppt (not a zip archive)"
        )
    try:
        deck = getattr(Package.open(path).main_document_part, "presentation", None)
    except Exception as e:
        sys.exit(f"Error: cannot read {path}: {e}")
    if deck is None:
        sys.exit(f"Error: {path} is not a .pptx, .pptm, .potx or .ppsx file")
    sys.stdout.reconfigure(errors="replace")
    try:
        blocks = [slide_text(s, n) for n, s in enumerate(deck.slides, 1)]
        print("\n\n".join(blocks) or "[no slides; layouts and masters are not printed]", flush=True)
    except BrokenPipeError:
        os.dup2(os.open(os.devnull, os.O_WRONLY), sys.stdout.fileno())


if __name__ == "__main__":
    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