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/resource_loader.py

View on GitHub
#!/usr/bin/env python3
"""资源路由:按策划稿字段从 references/ 取出需要的版式 / 组件 / 图表 / 页面模板说明。

  menu     列出全部可选资源(id + 一句话说明),Step 4 写策划稿时选型用
  resolve  取出策划稿引用到的资源正文,Step 5c 写某一页 HTML 前读取

路由规则(枚举与图表注册表见 scripts/contracts.py):
  layout_hint -> references/layouts/<版式>.md
  page_type   -> references/page-templates/<类型>.md(content 页没有模板)
  card_type   -> references/blocks/<组件>.md(text/data/list 等基础卡片见 bento-grid.md,无单独文件)
  chart_type  -> references/charts/{basic,advanced,complex}.md 里对应的小节
  card_style  -> references/blocks/card-styles.md

用法:
  python3 resource_loader.py menu
  python3 resource_loader.py resolve --planning OUTPUT_DIR/planning.json --page 3
"""

from __future__ import annotations

import argparse
import sys
from pathlib import Path

import contracts as C
from validate import card_chart, page_number, planning_pages


def read_resource(path: Path) -> tuple[str, str, str]:
    """资源文件 -> (标题, 引用块摘要, 正文)。约定:首个 # 标题,其后紧跟 > 引用块。"""
    title, quote, body = "", [], []
    state = "head"
    for line in path.read_text(encoding="utf-8").splitlines():
        stripped = line.strip()
        if state == "head":
            if stripped.startswith("# "):
                title, state = stripped[2:].strip(), "quote"
        elif state == "quote":
            if stripped.startswith(">"):
                quote.append(stripped[1:].strip())
            elif stripped or quote:
                state = "body"
                body.append(line)
        else:
            body.append(line)
    return title, "\n".join(quote).strip(), "\n".join(body).strip()


def generate_menu(refs_dir: Path = C.REFS_DIR) -> str:
    sections = []
    for directory, field in (("layouts", "layout_hint"), ("blocks", "card_type"), ("page-templates", "page_type")):
        lines = [f"### {directory}/  ({field})"]
        for path in sorted((refs_dir / directory).glob("*.md")):
            if path.name.lower() == "readme.md":
                continue
            title, quote, _ = read_resource(path)
            summary = quote.splitlines()[0] if quote else ""
            lines.append(f"- `{path.stem.replace('-', '_') if directory == 'blocks' else path.stem}` {title}"
                         + (f" — {summary}" if summary else ""))
        sections.append("\n".join(lines))

    lines = ["### charts/  (chart_type)"]
    for chart_id, spec in C.CHARTS.items():
        lines.append(f"- `{chart_id}` {spec['name']}({spec['file']})")
    sections.append("\n".join(lines))

    lines = ["### styles/  (style_id)"]
    for style in C.load_styles(refs_dir):
        category = C.STYLE_CATEGORIES[style["category"]]["cn"]
        lines.append(f"- `{style['style_id']}` {style['style_name']} — {category} · {style.get('inspiration', '')}")
    sections.append("\n".join(lines))
    return "\n\n".join(sections)


def resolve_resources(pages: list[dict], refs_dir: Path = C.REFS_DIR) -> tuple[str, list[str]]:
    """-> (拼接好的资源正文, 找不到资源的引用列表)"""
    files: dict[Path, None] = {}          # 保持首次出现的顺序
    charts: dict[str, None] = {}
    unresolved: list[str] = []

    def want(path: Path, ref: str, required: bool = True) -> None:
        if path.exists():
            files.setdefault(path)
        elif required:
            unresolved.append(ref)

    for page in pages:
        page_type = page.get("page_type")
        if page_type in C.PAGE_TYPES and page_type != "content":
            want(refs_dir / "page-templates" / f"{page_type}.md", f"page_type={page_type}")
        if page.get("layout_hint"):
            layout = C.normalize_layout(page["layout_hint"])
            if layout:
                want(refs_dir / "layouts" / f"{layout}.md", f"layout_hint={layout}")
            else:
                unresolved.append(f"layout_hint={page['layout_hint']}")
        for card in page.get("cards") or []:
            if not isinstance(card, dict):
                continue
            card_type = card.get("card_type")
            if isinstance(card_type, str):
                # 基础卡片类型没有单独文件,不算缺失
                want(refs_dir / "blocks" / f"{card_type.replace('_', '-')}.md", f"card_type={card_type}",
                     required=card_type in C.BLOCK_CARD_TYPES)
            if card.get("card_style"):
                want(refs_dir / "blocks" / "card-styles.md", "card_style")
            chart = card_chart(card)
            if chart:
                chart_id = C.normalize_chart(chart)
                if chart_id:
                    charts.setdefault(chart_id)
                else:
                    unresolved.append(f"chart_type={chart}")

    sections = []
    for path in files:
        title, _, body = read_resource(path)
        sections.append(f"# {title}\n\n{body}")
    for chart_id in charts:
        title, body = C.chart_section(chart_id, refs_dir)
        sections.append(f"# 图表:{title}\n\n{body}")
    return "\n\n---\n\n".join(sections), unresolved


def main() -> int:
    parser = argparse.ArgumentParser(description="按策划稿字段加载 references/ 资源")
    sub = parser.add_subparsers(dest="mode", required=True)
    for name in ("menu", "resolve"):
        cmd = sub.add_parser(name)
        cmd.add_argument("--refs-dir", default=str(C.REFS_DIR), help="references 目录(默认取 skill 自带的)")
        cmd.add_argument("--output", help="写入文件(默认输出到 stdout)")
    resolve = sub.choices["resolve"]
    resolve.add_argument("--planning", required=True, help="planning.json")
    resolve.add_argument("--page", type=int, help="只取某一页的资源(默认整份策划稿)")
    args = parser.parse_args()

    refs_dir = Path(args.refs_dir)
    if not refs_dir.is_dir():
        print(f"ERROR: references 目录不存在:{refs_dir}", file=sys.stderr)
        return 1

    if args.mode == "menu":
        result = generate_menu(refs_dir)
    else:
        try:
            pages = planning_pages(C.load_json(Path(args.planning)))
        except (OSError, ValueError) as exc:
            print(f"ERROR: {exc}", file=sys.stderr)
            return 1
        if args.page is not None:
            pages = [page for page in pages if page_number(page) == args.page]
        if not pages:
            print("ERROR: 策划稿里没有匹配的页面", file=sys.stderr)
            return 1
        result, unresolved = resolve_resources(pages, refs_dir)
        for ref in unresolved:
            print(f"WARN: 找不到资源 {ref}", file=sys.stderr)

    if args.output:
        Path(args.output).parent.mkdir(parents=True, exist_ok=True)
        Path(args.output).write_text(result, encoding="utf-8")
        print(f"Written to {args.output} ({len(result)} chars)", file=sys.stderr)
    else:
        print(result)
    return 0


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