Skip to content

Akxan/ppt-agent-skill

ppt-agent

Verified

专业 PPT 演示文稿全流程 AI 生成助手。模拟顶级 PPT 设计公司的完整工作流(需求调研 -> 资料搜集 -> 大纲策划 -> 策划稿 -> 设计稿),输出高质量 HTML 格式演示文稿。当用户提到制作 PPT、做演示文稿、做 slides、做幻灯片、做汇报材料、做培训课件、做路演 deck、做产品介绍页面时触发此技能。即使用户只说"帮我做个关于 X 的介绍"或"我要给老板汇报 Y",只要暗示需要结构化的多页演示内容,都应该触发。也适用于用户说"帮我把这篇文档做成 PPT"、"把这个主题做成演示"等需要将内容转化为演示格式的场景。

FileKindSize
SKILL.mdskill md20.3 KB
assets/architecture.pngbinary2.0 MB
assets/architecture.svgother17.7 KB
assets/hero-all.pngbinary1.3 MB
assets/hero-cultural-oriental.pngbinary250.3 KB
assets/hero-dark-professional.pngbinary585.1 KB
assets/hero-light-premium.pngbinary639.5 KB
assets/hero-natural-retro.pngbinary403.2 KB
assets/hero-vibrant.pngbinary279.1 KB
assets/logo.svgother1.7 KB
references/README.mdmarkdown2.9 KB
references/bento-grid.mdmarkdown6.2 KB
references/blocks/README.mdmarkdown2.1 KB
references/blocks/card-styles.mdmarkdown5.6 KB
references/blocks/comparison.mdmarkdown1.8 KB
references/blocks/diagram.mdmarkdown1.9 KB
references/blocks/image-hero.mdmarkdown1.9 KB
references/blocks/matrix-chart.mdmarkdown1.9 KB
references/blocks/people.mdmarkdown1.6 KB
references/blocks/quote.mdmarkdown1.6 KB
references/blocks/timeline.mdmarkdown1.7 KB
references/charts/advanced.mdmarkdown39.0 KB
references/charts/basic.mdmarkdown57.9 KB
references/charts/complex.mdmarkdown83.7 KB
references/charts/index.mdmarkdown4.9 KB
references/design-runtime/css-weapons.mdmarkdown10.9 KB
references/design-runtime/data-type-visual-mapping.mdmarkdown7.9 KB
references/layouts/README.mdmarkdown4.8 KB
references/layouts/asymmetric.mdmarkdown1.2 KB
references/layouts/hero-top.mdmarkdown2.0 KB
references/layouts/l-shape.mdmarkdown1.6 KB
references/layouts/mixed-grid.mdmarkdown2.3 KB
references/layouts/primary-secondary.mdmarkdown1.8 KB
references/layouts/single-focus.mdmarkdown1.5 KB
references/layouts/symmetric.mdmarkdown1.5 KB
references/layouts/t-shape.mdmarkdown1.4 KB
references/layouts/three-column.mdmarkdown1.5 KB
references/layouts/waterfall.mdmarkdown1.3 KB
references/method.mdmarkdown2.8 KB
references/page-templates/cover.mdmarkdown2.4 KB
references/page-templates/end.mdmarkdown2.3 KB
references/page-templates/section.mdmarkdown1.9 KB
references/page-templates/toc.mdmarkdown1.9 KB
references/pipeline-compat.mdmarkdown7.5 KB
references/principles/README.mdmarkdown2.1 KB
references/principles/cognitive-load.mdmarkdown2.2 KB
references/principles/color-psychology.mdmarkdown2.2 KB
references/principles/composition.mdmarkdown2.6 KB
references/principles/data-visualization.mdmarkdown2.1 KB
references/principles/failure-modes.mdmarkdown4.9 KB
references/principles/narrative-arc.mdmarkdown2.7 KB
references/principles/visual-hierarchy.mdmarkdown2.9 KB
references/prompts.mdmarkdown32.8 KB
references/strict-mode.mdmarkdown6.4 KB
references/styles/cultural.mdmarkdown8.3 KB
references/styles/dark.mdmarkdown21.3 KB
references/styles/index.mdmarkdown11.8 KB
references/styles/light.mdmarkdown21.9 KB
references/styles/natural.mdmarkdown11.1 KB
references/styles/vibrant.mdmarkdown10.6 KB
references/typography.mdmarkdown8.6 KB
scripts/README.mdmarkdown2.3 KB
scripts/build_hero.pyscript7.2 KB
scripts/contracts.pyscript12.8 KB
scripts/gallery.pyscript10.3 KB
scripts/html2png.pyscript2.9 KB
scripts/html2svg.pyscript24.2 KB
scripts/html_packager.pyscript10.1 KB
scripts/png2pptx.pyscript2.4 KB
scripts/pptx_motion.pyscript8.8 KB
scripts/resource_loader.pyscript7.0 KB
scripts/smoke_test.pyscript16.3 KB
scripts/svg2pptx.pyscript45.3 KB
scripts/validate.pyscript23.0 KB

scripts/pptx_motion.py

View on GitHub
#!/usr/bin/env python3
"""PPTX 动效:页间切换(p:transition)与形状入场动画(p:timing)。

python-pptx 不提供动画 API,这里直接写 PresentationML。只使用基础命名空间里的
切换与动画节点,PowerPoint 2010+ 均可识别;WPS / Keynote / Google Slides 支持不完整。

供 svg2pptx.py / png2pptx.py 调用:
    apply_transition(slide, "fade")
    apply_entrance(slide, [shape_id, ...], effect="fade", trigger="click")
"""

from __future__ import annotations

from lxml import etree

P_NS = "http://schemas.openxmlformats.org/presentationml/2006/main"


def _p(tag: str, attrib: dict | None = None, children: list | None = None):
    el = etree.Element(f"{{{P_NS}}}{tag}")
    for key, value in (attrib or {}).items():
        el.set(key, str(value))
    for child in children or []:
        el.append(child)
    return el


# ── 页间切换 ────────────────────────────────────────────────────────────────

TRANSITIONS = {
    "fade": lambda: _p("fade"),
    "push": lambda: _p("push", {"dir": "l"}),
    "wipe": lambda: _p("wipe", {"dir": "l"}),
    "cover": lambda: _p("cover", {"dir": "l"}),
    "split": lambda: _p("split", {"orient": "vert", "dir": "out"}),
    "zoom": lambda: _p("zoom", {"dir": "in"}),
    "dissolve": lambda: _p("dissolve"),
}
TRANSITION_SPEEDS = ("slow", "med", "fast")


def _insert_in_slide_order(slide_el, node) -> None:
    """按 CT_Slide 的子元素顺序插入:cSld, clrMapOvr, transition, timing, extLst。"""
    order = ["cSld", "clrMapOvr", "transition", "timing", "extLst"]
    rank = order.index(etree.QName(node).localname)
    for existing in slide_el.findall(f"{{{P_NS}}}{etree.QName(node).localname}"):
        slide_el.remove(existing)
    for child in slide_el:
        if order.index(etree.QName(child).localname) > rank:
            child.addprevious(node)
            return
    slide_el.append(node)


def apply_transition(slide, kind: str = "fade", speed: str = "med", advance_after: float | None = None) -> None:
    """给一页幻灯片设置进入时的切换效果。advance_after 为秒数时自动翻页。"""
    if kind == "none":
        return
    if kind not in TRANSITIONS:
        raise ValueError(f"unknown transition '{kind}', expected one of {sorted(TRANSITIONS)} or 'none'")
    attrs = {"spd": speed if speed in TRANSITION_SPEEDS else "med", "advClick": "1"}
    if advance_after is not None:
        attrs["advTm"] = str(int(advance_after * 1000))
    _insert_in_slide_order(slide._element, _p("transition", attrs, [TRANSITIONS[kind]()]))


# ── 入场动画 ────────────────────────────────────────────────────────────────

# effect -> (presetID, presetSubtype),仅影响 PowerPoint 动画窗格里显示的名称
ENTRANCE_EFFECTS = {
    "fade": (10, 0),     # 淡入
    "wipe": (22, 8),     # 自左擦除
    "rise": (42, 0),     # 上浮
    "zoom": (53, 16),    # 缩放
}


class _Ids:
    def __init__(self, start: int = 1):
        self.value = start - 1

    def next(self) -> int:
        self.value += 1
        return self.value


def _ctn(ids: _Ids, attrib: dict | None = None, delay: str | None = None, children: list | None = None):
    """p:cTn,可带起始条件与子时间节点。"""
    node = _p("cTn", {"id": ids.next(), **(attrib or {})})
    if delay is not None:
        node.append(_p("stCondLst", children=[_p("cond", {"delay": delay})]))
    if children is not None:
        node.append(_p("childTnLst", children=children))
    return node


def _target(spid: int):
    return _p("tgtEl", children=[_p("spTgt", {"spid": spid})])


def _set_visible(ids: _Ids, spid: int):
    return _p("set", children=[
        _p("cBhvr", children=[
            _ctn(ids, {"dur": "1", "fill": "hold"}, delay="0"),
            _target(spid),
            _p("attrNameLst", children=[_text_node("attrName", "style.visibility")]),
        ]),
        _p("to", children=[_p("strVal", {"val": "visible"})]),
    ])


def _text_node(tag: str, text: str):
    node = _p(tag)
    node.text = text
    return node


def _anim_effect(ids: _Ids, spid: int, filter_name: str, duration: int):
    return _p("animEffect", {"transition": "in", "filter": filter_name}, [
        _p("cBhvr", children=[_ctn(ids, {"dur": duration}), _target(spid)]),
    ])


def _anim_property(ids: _Ids, spid: int, prop: str, start: str, end: str, duration: int):
    """属性补间:ppt_x / ppt_y / ppt_w / ppt_h,取值可用 #ppt_x 这类公式。"""
    return _p("anim", {"calcmode": "lin", "valueType": "num"}, [
        _p("cBhvr", {"additive": "base"}, [
            _ctn(ids, {"dur": duration, "fill": "hold"}),
            _target(spid),
            _p("attrNameLst", children=[_text_node("attrName", prop)]),
        ]),
        _p("tavLst", children=[
            _p("tav", {"tm": "0"}, [_p("val", children=[_p("strVal", {"val": start})])]),
            _p("tav", {"tm": "100000"}, [_p("val", children=[_p("strVal", {"val": end})])]),
        ]),
    ])


def _behaviors(ids: _Ids, spid: int, effect: str, duration: int) -> list:
    nodes = [_set_visible(ids, spid)]
    if effect == "wipe":
        nodes.append(_anim_effect(ids, spid, "wipe(left)", duration))
    elif effect == "rise":
        nodes.append(_anim_property(ids, spid, "ppt_y", "#ppt_y+.06", "#ppt_y", duration))
        nodes.append(_anim_effect(ids, spid, "fade", duration))
    elif effect == "zoom":
        nodes.append(_anim_property(ids, spid, "ppt_w", "#ppt_w*0.85", "#ppt_w", duration))
        nodes.append(_anim_property(ids, spid, "ppt_h", "#ppt_h*0.85", "#ppt_h", duration))
        nodes.append(_anim_effect(ids, spid, "fade", duration))
    else:
        nodes.append(_anim_effect(ids, spid, "fade", duration))
    return nodes


def _effect_par(ids: _Ids, spid: int, effect: str, duration: int, node_type: str, delay: int):
    """一个效果:外层 par 控制它在本步内的起始延迟,内层 cTn 带预设信息。"""
    preset_id, subtype = ENTRANCE_EFFECTS[effect]
    inner = _ctn(ids, {
        "presetID": preset_id, "presetClass": "entr", "presetSubtype": subtype,
        "fill": "hold", "nodeType": node_type,
    }, delay="0")
    inner.append(_p("childTnLst", children=_behaviors(ids, spid, effect, duration)))
    return _p("par", children=[
        _ctn(ids, {"fill": "hold"}, delay=str(delay), children=[_p("par", children=[inner])]),
    ])


def apply_entrance(slide, shape_ids: list[int], effect: str = "fade", trigger: str = "click",
                   duration: int = 500, stagger: int = 150) -> int:
    """按顺序给形状加入场动画,返回实际添加的效果数。

    trigger="click":每次点击出现一个;trigger="auto":进入本页后依次自动出现。
    """
    if effect not in ENTRANCE_EFFECTS:
        raise ValueError(f"unknown entrance effect '{effect}', expected one of {sorted(ENTRANCE_EFFECTS)}")
    if trigger not in ("click", "auto"):
        raise ValueError("trigger must be 'click' or 'auto'")
    if not shape_ids:
        return 0

    ids = _Ids()
    root_ctn = _p("cTn", {"id": ids.next(), "dur": "indefinite", "restart": "never", "nodeType": "tmRoot"})
    main_ctn = _p("cTn", {"id": ids.next(), "dur": "indefinite", "nodeType": "mainSeq"})
    main_seq_id = main_ctn.get("id")
    steps = []

    if trigger == "click":
        for spid in shape_ids:
            step = _ctn(ids, {"fill": "hold"}, delay="indefinite")
            step.append(_p("childTnLst", children=[
                _effect_par(ids, spid, effect, duration, "clickEffect", 0)]))
            steps.append(_p("par", children=[step]))
    else:
        step = _p("cTn", {"id": ids.next(), "fill": "hold"})
        step.append(_p("stCondLst", children=[
            _p("cond", {"delay": "indefinite"}),
            _p("cond", {"evt": "onBegin", "delay": "0"}, [_p("tn", {"val": main_seq_id})]),
        ]))
        step.append(_p("childTnLst", children=[
            _effect_par(ids, spid, effect, duration, "afterEffect", index * (duration + stagger))
            for index, spid in enumerate(shape_ids)
        ]))
        steps.append(_p("par", children=[step]))

    main_ctn.append(_p("childTnLst", children=steps))
    slide_target = lambda: _p("tgtEl", children=[_p("sldTgt")])  # noqa: E731
    sequence = _p("seq", {"concurrent": "1", "nextAc": "seek"}, [
        main_ctn,
        _p("prevCondLst", children=[_p("cond", {"evt": "onPrev", "delay": "0"}, [slide_target()])]),
        _p("nextCondLst", children=[_p("cond", {"evt": "onNext", "delay": "0"}, [slide_target()])]),
    ])
    root_ctn.append(_p("childTnLst", children=[sequence]))
    timing = _p("timing", children=[_p("tnLst", children=[_p("par", children=[root_ctn])])])
    _insert_in_slide_order(slide._element, timing)
    return len(shape_ids)
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