slides by colonelpanic8/dotfiles
npx skills add https://github.com/colonelpanic8/dotfiles --skill slides当用户希望使用 artifacts 工具创建或修改演示文稿时,请使用此技能。
artifacts 工具。type、interface 或 import type。import { ... } from "@oai/artifact-tool"。@oai/artifact-tool 模块的接口已预加载到 globalThis 上。Presentation、、、 和 可直接使用。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
PresentationFileFileBlobAutoLayoutAlignAutoLayoutDirectionartifactTool、artifacts 和 codexArtifacts 访问。node:fs/promises。artifacts/quarterly-update.pptx 或 artifacts/slide-1.png。const presentation = Presentation.create({
slideSize: { width: 960, height: 540 },
});
const slide = presentation.slides.add();
slide.background.fill = "background1";
const title = slide.shapes.add({
geometry: "roundRect",
position: { left: 80, top: 72, width: 800, height: 96 },
fill: "accent1",
});
title.text = "Q2 Product Update";
const subtitle = slide.shapes.add({
geometry: "rect",
position: { left: 80, top: 196, width: 800, height: 48 },
});
subtitle.text = "Launch status, reliability, and next milestones";
const pptxBlob = await PresentationFile.exportPptx(presentation);
await pptxBlob.save("artifacts/q2-product-update.pptx");
slide.elements.charts.add("line", { position: ... })。运行时图表接口是基于元素的;slide.charts.add(...) 不是在此技能中创作新图表的可靠入口点。const chart = slide.elements.charts.add("line", {
position: { left: 80, top: 180, width: 640, height: 320 },
});
chart.title = "Horsepower";
chart.categories = ["1964", "1973", "1989", "2024"];
const series = chart.series.add("911");
series.values = [130, 210, 247, 518];
chart.hasLegend = false;
ArrayBuffer 加上 contentType:const fs = await import("node:fs/promises");
const source = await fs.readFile("artifacts/porsche.jpg");
const imageBuffer = source.buffer.slice(
source.byteOffset,
source.byteOffset + source.byteLength,
);
slide.elements.images.add({
blob: imageBuffer,
contentType: "image/jpeg",
position: { left: 500, top: 0, width: 460, height: 540 },
fit: "cover",
});
ArrayBuffer 传递给 slide.elements.images.add(...)。不要假设 path、url、src 或 Node 的 Buffer 能正确预览。Title 1、Subtitle 2、日期/页脚占位符或 PowerPoint 的 单击此处添加标题 框。如果演示文稿需要完全自定义,请在最终导出前移除占位符形状:const placeholderNames = new Set([
"Title 1",
"Subtitle 2",
"Date Placeholder 3",
"Footer Placeholder 4",
"Slide Number Placeholder 5",
]);
for (const slide of presentation.slides.items) {
const toDelete = slide.shapes.items.filter((shape) => {
const name = shape.name ?? "";
return placeholderNames.has(name) || Boolean(shape.placeholderType);
});
for (const shape of toDelete) {
shape.delete();
}
}
Presentation.create({ slideSize }) 创建新的演示文稿。await PresentationFile.importPptx(await FileBlob.load("deck.pptx")) 导入现有的演示文稿。presentation.slides.add() 或 presentation.slides.insert({ after, layout }) 添加幻灯片。slide.shapes.add(...)、slide.tables.add(...)、slide.elements.charts.add(...) 和 slide.elements.images.add(...)(当需要预览安全的嵌入图像时)添加内容。await presentation.export({ slide, format: "png", scale: 2 }) 渲染预览,然后使用 node:fs/promises 写入 new Uint8Array(await blob.arrayBuffer())。await PresentationFile.exportPptx(presentation) 导出 .pptx 文件。artifacts 工具已准备就绪,立即开始创作;仅在工具在您的幻灯片代码运行之前失败时,才调查运行时安装或打包问题。text 或 textStyle,导出一个 PNG,并在扩展到整个演示文稿之前检查结果。.pptx 文件,以便用户检查输出。placeholderType 的形状。slide.autoLayout(...),而不是手动调整每个坐标。.pptx 导回运行时并检查往返对象更可靠的快速检查方法。单击此处添加... 占位符,请在交付前修复布局或删除继承的占位符形状并重新导出。.pptx。references/presentation.md 用于核心的 Presentation 和 PresentationFile 生命周期。references/auto-layout.md 用于确定性布局辅助工具和对齐枚举。每周安装次数
1
代码仓库
GitHub 星标数
210
首次出现
今天
安全审计
已安装于
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
Use this skill when the user wants to create or modify presentation decks with the artifacts tool.
artifacts tool.type, interface, or import type.import { ... } from "@oai/artifact-tool". The @oai/artifact-tool module surface is already preloaded on globalThis.Presentation, PresentationFile, FileBlob, AutoLayoutAlign, and AutoLayoutDirection are available directly.artifactTool, artifacts, and codexArtifacts.node:fs/promises when you need to write preview bytes to disk.artifacts/quarterly-update.pptx or artifacts/slide-1.png.const presentation = Presentation.create({
slideSize: { width: 960, height: 540 },
});
const slide = presentation.slides.add();
slide.background.fill = "background1";
const title = slide.shapes.add({
geometry: "roundRect",
position: { left: 80, top: 72, width: 800, height: 96 },
fill: "accent1",
});
title.text = "Q2 Product Update";
const subtitle = slide.shapes.add({
geometry: "rect",
position: { left: 80, top: 196, width: 800, height: 48 },
});
subtitle.text = "Launch status, reliability, and next milestones";
const pptxBlob = await PresentationFile.exportPptx(presentation);
await pptxBlob.save("artifacts/q2-product-update.pptx");
Prefer slide.elements.charts.add("line", { position: ... }) for charts. The runtime chart surface is element-based; slide.charts.add(...) is not the reliable entry point for authoring new charts in this skill.
After creating a chart element, set properties on the returned chart object:
const chart = slide.elements.charts.add("line", { position: { left: 80, top: 180, width: 640, height: 320 }, }); chart.title = "Horsepower"; chart.categories = ["1964", "1973", "1989", "2024"]; const series = chart.series.add("911"); series.values = [130, 210, 247, 518]; chart.hasLegend = false;
For local or fetched images that must survive preview rendering, embed bytes rather than passing only a file path or URL. The most reliable pattern is an ArrayBuffer plus contentType:
const fs = await import("node:fs/promises"); const source = await fs.readFile("artifacts/porsche.jpg"); const imageBuffer = source.buffer.slice( source.byteOffset, source.byteOffset + source.byteLength, );
slide.elements.images.add({ blob: imageBuffer, contentType: "image/jpeg", position: { left: 500, top: 0, width: 460, height: 540 }, fit: "cover", });
If you fetch an image in-script, save or convert it to bytes first, then pass the ArrayBuffer into . Do not assume , , , or a Node will preview correctly.
Presentation.create({ slideSize }).await PresentationFile.importPptx(await FileBlob.load("deck.pptx")).presentation.slides.add() or presentation.slides.insert({ after, layout }).slide.shapes.add(...), slide.tables.add(...), slide.elements.charts.add(...), and slide.elements.images.add(...) when you need preview-safe embedded images.await presentation.export({ slide, format: "png", scale: 2 }), then write with .artifacts tool is ready and start authoring immediately; only investigate runtime installation or packaging if the tool fails before your slide code runs.text or textStyle, export one PNG, and inspect the result before scaling up to the full deck..pptx after meaningful milestones so the user can inspect output.references/presentation.md for the core Presentation and PresentationFile lifecycle.references/auto-layout.md for deterministic layout helpers and alignment enums.Weekly Installs
1
Repository
GitHub Stars
210
First Seen
Today
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
31,600 周安装
slide.elements.images.add(...)pathurlsrcBufferPPTX export can still inherit layout placeholders such as Title 1, Subtitle 2, date/footer placeholders, or PowerPoint's Click to add title boxes. If the deck is meant to be fully custom, strip placeholder shapes before final export:
const placeholderNames = new Set([ "Title 1", "Subtitle 2", "Date Placeholder 3", "Footer Placeholder 4", "Slide Number Placeholder 5", ]);
for (const slide of presentation.slides.items) { const toDelete = slide.shapes.items.filter((shape) => { const name = shape.name ?? ""; return placeholderNames.has(name) || Boolean(shape.placeholderType); }); for (const shape of toDelete) { shape.delete(); } }
new Uint8Array(await blob.arrayBuffer())node:fs/promises.pptx with await PresentationFile.exportPptx(presentation).placeholderType.slide.autoLayout(...) rather than hand-tuning every coordinate..pptx back into the runtime and inspecting round-tripped objects.Click to add ... placeholders, fix the layout or delete the inherited placeholder shapes and re-export before handoff..pptx.