Skip to content

JunfengRan/PPTWork / ppt

Build PPT / PowerPoint / 演示文稿 / slide decks end-to-end via a .pptwork/<deck>/ filesystem contract. Use when the user wants to plan, author, screenshot, or export a slide deck. Provides Node scripts for deck CRUD, headless screenshot, and editable PPTX export. Covers clarification, story planning, single-page authoring (via the ppt-html-authoring skill), visual QC, and export troubleshooting.

FileKindSize
SKILL.mdskill md13.2 KB
assets/claude-warm/_preview/bento-asymmetric/slide.htmlother3.6 KB
assets/claude-warm/_preview/bento-asymmetric/thumbnail.pngbinary65.2 KB
assets/claude-warm/_preview/cover-editorial/slide.htmlother2.0 KB
assets/claude-warm/_preview/cover-editorial/thumbnail.pngbinary43.0 KB
assets/claude-warm/_preview/flow-timeline/slide.htmlother3.1 KB
assets/claude-warm/_preview/flow-timeline/thumbnail.pngbinary30.3 KB
assets/claude-warm/_preview/quote-highlight/slide.htmlother1.7 KB
assets/claude-warm/_preview/quote-highlight/thumbnail.pngbinary33.6 KB
assets/claude-warm/_preview/section-divider/slide.htmlother1.8 KB
assets/claude-warm/_preview/section-divider/thumbnail.pngbinary35.6 KB
assets/claude-warm/html/bento-asymmetric.htmlother3.6 KB
assets/claude-warm/html/cover-editorial.htmlother2.0 KB
assets/claude-warm/html/flow-timeline.htmlother3.1 KB
assets/claude-warm/html/quote-highlight.htmlother1.7 KB
assets/claude-warm/html/section-divider.htmlother1.8 KB
assets/claude-warm/index.jsonconfig1.8 KB
assets/corporate-light/_preview/agenda-grid/slide.htmlother3.2 KB
assets/corporate-light/_preview/agenda-grid/thumbnail.pngbinary53.5 KB
assets/corporate-light/_preview/closing-cta/slide.htmlother2.2 KB
assets/corporate-light/_preview/closing-cta/thumbnail.pngbinary91.8 KB
assets/corporate-light/_preview/cover-hero/slide.htmlother2.4 KB
assets/corporate-light/_preview/cover-hero/thumbnail.pngbinary198.9 KB
assets/corporate-light/_preview/kpi-stat-row/slide.htmlother2.4 KB
assets/corporate-light/_preview/kpi-stat-row/thumbnail.pngbinary127.6 KB
assets/corporate-light/_preview/two-column-insight/slide.htmlother3.6 KB
assets/corporate-light/_preview/two-column-insight/thumbnail.pngbinary42.5 KB
assets/corporate-light/html/agenda-grid.htmlother3.2 KB
assets/corporate-light/html/closing-cta.htmlother2.2 KB
assets/corporate-light/html/cover-hero.htmlother2.4 KB
assets/corporate-light/html/kpi-stat-row.htmlother2.4 KB
assets/corporate-light/html/two-column-insight.htmlother3.6 KB
assets/corporate-light/index.jsonconfig2.0 KB
package.jsonmanifest484 B
references/disk-layout.mdmarkdown2.2 KB
references/editable-html-rules.mdmarkdown2.0 KB
references/export-troubleshooting.mdmarkdown5.8 KB
references/material-digest.mdmarkdown2.0 KB
references/research.mdmarkdown2.7 KB
references/story-planning.mdmarkdown5.2 KB
references/visual-qc.mdmarkdown4.4 KB
scripts/deck.mjsscript9.5 KB
scripts/export.mjsscript8.0 KB
scripts/import-reference.mjsscript1.2 KB
scripts/lib/deck.mjsscript2.1 KB
scripts/lib/find-browser.mjsscript1.7 KB
scripts/lib/render.mjsscript12.6 KB
scripts/screenshot.mjsscript2.5 KB
test/smoke.mjsscript10.1 KB

test/smoke.mjs

View on GitHub
#!/usr/bin/env node
// End-to-end smoke test for the standalone ppt skill scripts.
//
// Spins up a temp project dir, drives deck.mjs / screenshot.mjs / export.mjs
// via spawnSync, asserts files appeared and tags ([Done], etc.) showed up,
// then cleans up. No LLM in the loop — just verifies the scripts work.
//
// Run from anywhere:
//   node skills/ppt/test/smoke.mjs

import { spawnSync } from "node:child_process";
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { tmpdir } from "node:os";
import { inflateRawSync } from "node:zlib";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const SKILL_ROOT = path.resolve(__dirname, "..");
const SCRIPTS = path.join(SKILL_ROOT, "scripts");

const HAS_PLAYWRIGHT = await (async () => {
  try {
    await import("playwright-core");
    return true;
  } catch {
    return false;
  }
})();

const HAS_PPTXGEN = await (async () => {
  try {
    const { createRequire } = await import("node:module");
    const req = createRequire(import.meta.url);
    req.resolve("pptxgenjs");
    return true;
  } catch {
    return false;
  }
})();

const HAS_HTML2PPTX_PRO = await (async () => {
  try {
    const { createRequire } = await import("node:module");
    const req = createRequire(import.meta.url);
    req.resolve("html2pptx-pro");
    return true;
  } catch {
    return false;
  }
})();

const HAS_DOM_TO_PPTX = await (async () => {
  try {
    const { createRequire } = await import("node:module");
    const req = createRequire(import.meta.url);
    req.resolve("dom-to-pptx");
    return true;
  } catch {
    return false;
  }
})();

let pass = 0;
let fail = 0;
const log = (s) => process.stdout.write(s + "\n");

function step(name, ok, detail) {
  if (ok) {
    pass++;
    log(`  PASS  ${name}` + (detail ? `  (${detail})` : ""));
  } else {
    fail++;
    log(`  FAIL  ${name}` + (detail ? `  (${detail})` : ""));
  }
}

function run(scriptName, args, cwd) {
  const r = spawnSync(
    process.execPath,
    [path.join(SCRIPTS, scriptName), ...args],
    { cwd, encoding: "utf-8", env: { ...process.env, PPT_DEBUG: "" } },
  );
  return {
    code: r.status ?? -1,
    stdout: r.stdout || "",
    stderr: r.stderr || "",
  };
}

const MIN_SLIDE_HTML = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Smoke Test Slide</title>
<style>
  html, body { margin: 0; padding: 0; width: 1280px; height: 720px; overflow: hidden; background: #0b1d3a; color: #fff; font: 24px system-ui, sans-serif; }
  body { display: flex; align-items: center; justify-content: center; }
  h1 { font-size: 64px; margin: 0; letter-spacing: -1px; }
</style>
</head>
<body>
  <h1>Hello from ppt skill smoke test</h1>
  <script type="application/json" id="ppt-speaker-notes-json">"This is a smoke-test slide."</script>
  <script>window.__PPT_READY__ = true;</script>
</body>
</html>
`;

async function main() {
  log("ppt skill smoke test");
  log(`  skill root:        ${SKILL_ROOT}`);
  log(`  playwright-core:   ${HAS_PLAYWRIGHT ? "installed" : "MISSING"}`);
  log(`  pptxgenjs:         ${HAS_PPTXGEN ? "installed" : "MISSING"}`);
  log(`  html2pptx-pro:     ${HAS_HTML2PPTX_PRO ? "installed" : "MISSING"}`);
  log(`  dom-to-pptx:       ${HAS_DOM_TO_PPTX ? "installed" : "MISSING"}`);

  const tmp = await fs.mkdtemp(path.join(tmpdir(), "ppt-smoke-"));
  log(`  tmp project root:  ${tmp}`);
  log("");

  // 0. built-in template buckets
  {
    const corporateIndex = path.join(SKILL_ROOT, "assets", "corporate-light", "index.json");
    const claudeIndex = path.join(SKILL_ROOT, "assets", "claude-warm", "index.json");
    let corporate = null;
    let claude = null;
    try {
      corporate = JSON.parse(await fs.readFile(corporateIndex, "utf-8"));
      claude = JSON.parse(await fs.readFile(claudeIndex, "utf-8"));
    } catch {
      /* handled below */
    }
    const ok =
      Array.isArray(corporate) &&
      corporate.length === 5 &&
      Array.isArray(claude) &&
      claude.length === 5 &&
      corporate.every((e) => e.id && e.pageType && e.htmlPath) &&
      claude.every((e) => e.id && e.pageType && e.htmlPath);
    step("built-in template buckets (corporate-light + claude-warm)", ok,
      ok ? "5 layouts each" : "missing or malformed index.json under ppt/assets/");
  }

  try {
    // 1. deck init
    {
      const r = run("deck.mjs", ["init", "demo"], tmp);
      const ok =
        r.code === 0 &&
        /\[Done\] Created deck "demo"/.test(r.stdout) &&
        (await fs.stat(path.join(tmp, ".pptwork", "demo", "deck.json"))
          .then(() => true)
          .catch(() => false));
      const deckJson = ok
        ? JSON.parse(await fs.readFile(path.join(tmp, ".pptwork", "demo", "deck.json"), "utf-8"))
        : null;
      step("deck.mjs init demo",
        ok && deckJson.exportMode === "editable",
        ok ? `deck.json exportMode=${deckJson.exportMode}` : `code=${r.code} ${r.stdout.split("\n")[0]}`);
    }

    // 1b. deck init with editable preference
    {
      const r = run("deck.mjs", ["init", "editable-demo", "--mode", "editable"], tmp);
      const deckJson = await fs
        .readFile(path.join(tmp, ".pptwork", "editable-demo", "deck.json"), "utf-8")
        .then((s) => JSON.parse(s))
        .catch(() => null);
      step("deck.mjs init editable-demo --mode editable",
        r.code === 0 && deckJson?.exportMode === "editable",
        deckJson ? `exportMode=${deckJson.exportMode}` : `code=${r.code}`);
    }

    // 2. init-slide
    {
      const r = run("deck.mjs", ["init-slide", "demo", "cover"], tmp);
      const designOk = await fs
        .stat(path.join(tmp, ".pptwork", "demo", "cover", "design.md"))
        .then(() => true)
        .catch(() => false);
      const deckJson = JSON.parse(
        await fs.readFile(path.join(tmp, ".pptwork", "demo", "deck.json"), "utf-8"),
      );
      const ok =
        r.code === 0 &&
        /\[Done\] Created slide "cover"/.test(r.stdout) &&
        designOk &&
        deckJson.slides.length === 1 &&
        deckJson.slides[0] === "cover";
      step("deck.mjs init-slide demo cover", ok,
        ok ? "design.md created, deck.json.slides=[cover]" : `code=${r.code} stdout=${r.stdout.slice(0, 200)}`);
    }

    // 3. write minimal slide.html
    const slideHtmlPath = path.join(tmp, ".pptwork", "demo", "cover", "slide.html");
    await fs.writeFile(slideHtmlPath, MIN_SLIDE_HTML, "utf-8");
    step("write minimal slide.html", true, `${MIN_SLIDE_HTML.length} bytes`);

    // 4. screenshot
    if (!HAS_PLAYWRIGHT) {
      step("screenshot.mjs demo cover", false, "playwright-core not installed; run `npm install` in skills/ppt");
    } else {
      const r = run("screenshot.mjs", ["demo", "cover"], tmp);
      const thumbPath = path.join(tmp, ".pptwork", "demo", "cover", "thumbnail.png");
      const stat = await fs.stat(thumbPath).catch(() => null);
      const ok =
        r.code === 0 &&
        /\[Done\] Re-rendered slide PNG\./.test(r.stdout) &&
        stat &&
        stat.size > 1000; // PNG should be at least 1KB
      step("screenshot.mjs demo cover", ok,
        ok ? `thumbnail.png ${stat.size} bytes` :
          `code=${r.code} stderr=${r.stderr.slice(0, 200)} stdout=${r.stdout.slice(0, 200)}`);
    }

    // 5a. export (default = editable via html2pptx-pro)
    if (!HAS_PLAYWRIGHT || !HAS_PPTXGEN || !HAS_HTML2PPTX_PRO) {
      step("export.mjs demo (default editable)", false, "missing dependency: " +
        [HAS_PLAYWRIGHT ? null : "playwright-core", HAS_PPTXGEN ? null : "pptxgenjs", HAS_HTML2PPTX_PRO ? null : "html2pptx-pro"].filter(Boolean).join(", "));
      step("export.mjs demo --mode editable", false, "skipped (deps missing)");
    } else {
      const r = run("export.mjs", ["demo"], tmp);
      const pptxPath = path.join(tmp, ".pptwork", "demo", "demo.pptx");
      const stat = await fs.stat(pptxPath).catch(() => null);
      const ok =
        r.code === 0 &&
        /\[Done\] Exported 1 slide/.test(r.stdout) &&
        /\[Mode\] editable/.test(r.stdout) &&
        stat &&
        stat.size > 5000;
      step("export.mjs demo (default editable)", ok,
        ok ? `demo.pptx ${stat.size} bytes (editable)` :
          `code=${r.code} stderr=${r.stderr.slice(0, 200)} stdout=${r.stdout.slice(0, 200)}`);

      // 5b. export editable (opt-in)
      const r2 = run("export.mjs", ["demo", "--mode", "editable", "--output", "demo-editable.pptx"], tmp);
      const pptx2 = path.join(tmp, "demo-editable.pptx");
      const stat2 = await fs.stat(pptx2).catch(() => null);
      const ok2 =
        r2.code === 0 &&
        /\[Mode\] editable/.test(r2.stdout) &&
        stat2 &&
        stat2.size > 5000;
      step("export.mjs demo --mode editable", ok2,
        ok2 ? `demo-editable.pptx ${stat2.size} bytes` :
          `code=${r2.code} stderr=${r2.stderr.slice(0, 200)} stdout=${r2.stdout.slice(0, 200)}`);

      const r3 = run("deck.mjs", ["init-slide", "editable-demo", "cover"], tmp);
      const editableSlideHtmlPath = path.join(tmp, ".pptwork", "editable-demo", "cover", "slide.html");
      await fs.writeFile(editableSlideHtmlPath, MIN_SLIDE_HTML, "utf-8");
      const r4 = run("export.mjs", ["editable-demo", "--output", "editable-demo-default.pptx"], tmp);
      const pptx3 = path.join(tmp, "editable-demo-default.pptx");
      const stat3 = await fs.stat(pptx3).catch(() => null);
      const ok3 =
        r3.code === 0 &&
        r4.code === 0 &&
        /\[Mode\] editable/.test(r4.stdout) &&
        stat3 &&
        stat3.size > 5000;
      step("export.mjs uses deck exportMode when --mode omitted", ok3,
        ok3 ? `editable-demo-default.pptx ${stat3.size} bytes` :
          `init=${r3.code} export=${r4.code} stdout=${r4.stdout.slice(0, 200)}`);
    }

    // 6. delete (cleanup-via-cli sanity)
    {
      const r = run("deck.mjs", ["delete", "demo", "cover"], tmp);
      const ok = r.code === 0 && /\[Done\] Deleted 1 slide/.test(r.stdout);
      step("deck.mjs delete demo cover", ok, ok ? "" : `code=${r.code} ${r.stdout.split("\n")[0]}`);
    }
  } finally {
    await fs.rm(tmp, { recursive: true, force: true }).catch(() => {});
  }

  log("");
  log(`Result: ${pass} passed, ${fail} failed`);
  process.exit(fail === 0 ? 0 : 1);
}

main().catch((e) => {
  log("FATAL: " + (e?.stack || e?.message || String(e)));
  process.exit(1);
});
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: 197kUpdated 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: 197kUpdated 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: 197kUpdated 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: 197kUpdated Claude CodeCodexVerifiedInstall