frontend-slides by zarazhangrui/frontend-slides
npx skills add https://github.com/zarazhangrui/frontend-slides --skill frontend-slides创建零依赖、动画丰富的 HTML 演示文稿,完全在浏览器中运行。
你倾向于收敛到通用的、“符合分布”的输出。在前端设计中,这会产生用户所谓的“AI 垃圾美学”。避免这种情况:创造有创意、独特、令人惊喜和愉悦的前端。
关注:
避免通用的 AI 生成美学:
创造性地解读,做出出人意料的选择,使其感觉真正为上下文而设计。在明暗主题、不同字体、不同美学之间变化。你仍然倾向于在多次生成中收敛于常见选择(例如 Space Grotesk)。避免这种情况:跳出框框思考至关重要!
这些不变式适用于每个演示文稿中的每一张幻灯片:
.slide 必须具有 广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
height: 100vh; height: 100dvh; overflow: hidden;clamp(min, preferred, max) — 永远不要使用固定的 px/remmax-height 约束max-height: min(50vh, 400px)prefers-reduced-motion 支持-clamp(), -min(), -max() 会被静默忽略)— 改用 calc(-1 * clamp(...))生成时,读取 viewport-base.css 并将其完整内容包含在每个演示文稿中。
| 幻灯片类型 | 最大内容 |
|---|---|
| 标题幻灯片 | 1 个标题 + 1 个副标题 + 可选标语 |
| 内容幻灯片 | 1 个标题 + 4-6 个要点 或 1 个标题 + 2 个段落 |
| 功能网格 | 1 个标题 + 最多 6 张卡片(2x3 或 3x2) |
| 代码幻灯片 | 1 个标题 + 8-10 行代码 |
| 引用幻灯片 | 1 条引用(最多 3 行)+ 出处 |
| 图片幻灯片 | 1 个标题 + 1 张图片(最大高度 60vh) |
内容超出限制?拆分成多张幻灯片。永远不要硬塞,永远不要滚动。
确定用户想要什么:
增强现有演示文稿时,视口适配是最大的风险:
max-height: min(50vh, 400px)。如果幻灯片已有最大内容量,则拆分成两张幻灯片.slide 有 overflow: hidden,新元素使用 clamp(),图片具有视口相关的最大高度,内容在 1280x720 分辨率下适配向现有幻灯片添加图片时: 先将图片移到新幻灯片或减少其他内容。永远不要在未检查现有内容是否已填满视口的情况下添加图片。
在一个 AskUserQuestion 调用中提出所有问题,以便用户一次性填写所有内容:
问题 1 — 目的(标题:"Purpose"):这个演示文稿是做什么用的?选项:推介演示 / 教学-教程 / 会议演讲 / 内部演示
问题 2 — 长度(标题:"Length"):大约多少张幻灯片?选项:短 5-10 / 中 10-20 / 长 20+
问题 3 — 内容(标题:"Content"):您准备好内容了吗?选项:所有内容已就绪 / 粗略笔记 / 仅主题
问题 4 — 内联编辑(标题:"Editing"):生成后您需要在浏览器中直接编辑文本吗?选项:
记住用户的编辑选择 — 它决定了阶段 3 中是否包含编辑相关代码。
如果用户有内容,请他们分享。
如果用户选择了“无图片” → 跳转到阶段 2。
如果用户提供了图片文件夹:
预览中的 Logo: 如果识别出可用的 Logo,将其(base64)嵌入到阶段 2 的每个样式预览中 — 用户将看到他们的品牌以三种不同的方式呈现。
这是“展示,而非描述”的阶段。 大多数人无法用语言表达设计偏好。
询问他们希望如何选择(标题:"Style"):
如果直接选择: 显示预设选择器并跳转到阶段 3。可用预设定义在 STYLE_PRESETS.md 中。
询问(标题:"Vibe", multiSelect: true, max 2):观众应该有什么感觉?选项:
基于氛围,生成 3 个不同的单幻灯片 HTML 预览,展示排版、颜色、动画和整体美学。阅读 STYLE_PRESETS.md 了解可用预设及其规格。
| 氛围 | 建议预设 |
|---|---|
| 印象深刻/自信 | Bold Signal, Electric Studio, Dark Botanical |
| 兴奋/充满活力 | Creative Voltage, Neon Cyber, Split Pastel |
| 平静/专注 | Notebook Tabs, Paper & Ink, Swiss Modern |
| 受启发/感动 | Dark Botanical, Vintage Editorial, Pastel Geometry |
将预览保存到 .claude-design/slide-previews/(style-a.html, style-b.html, style-c.html)。每个都应该是自包含的,约 50-100 行,展示一张带动画的标题幻灯片。
自动为用户打开每个预览。
询问(标题:"Style"):您更喜欢哪个样式预览?选项:样式 A:[名称] / 样式 B:[名称] / 样式 C:[名称] / 混合元素
如果选择“混合元素”,请询问具体细节。
使用阶段 1 的内容(文本,或文本 + 精选图片)和阶段 2 的样式生成完整的演示文稿。
如果提供了图片,幻灯片大纲已从步骤 1.2 开始整合它们。如果没有,CSS 生成的视觉效果(渐变、形状、图案)将提供视觉趣味 — 这是一个完全受支持的一流路径。
生成前,阅读这些支持文件:
关键要求:
<style> 块中包含 viewport-base.css 的完整内容/* === 部分名称 === */ 注释块转换 PowerPoint 文件时:
python scripts/extract-pptx.py <input.pptx> <output_dir>(如果需要,安装 python-pptx:pip install python-pptx).claude-design/slide-previews/open [filename].html 在浏览器中启动:root CSS 变量,用于排版的字体链接,用于动画的 .reveal 类交付后,询问用户: “您想分享这个演示文稿吗?我可以将其部署到实时 URL(可在包括手机在内的任何设备上工作)或导出为 PDF。”
选项:
如果用户拒绝,在此停止。如果他们选择一个或两个,继续以下步骤。
这将演示文稿部署到 Vercel — 一个免费的托管平台。该链接可在任何设备(手机、平板电脑、笔记本电脑)上工作,并保持在线直到用户将其删除。
如果用户从未部署过,请逐步指导他们:
检查是否安装了 Vercel CLI — 运行 npx vercel --version。如果未找到,请先安装 Node.js(在 macOS 上使用 brew install node,或从 https://nodejs.org 下载)。
检查用户是否已登录 — 运行 npx vercel whoami。
vercel login 并按照提示操作(它会打开一个浏览器窗口进行授权)vercel whoami 确认登录部署 — 运行部署脚本:
bash scripts/deploy.sh <path-to-presentation>
该脚本接受一个文件夹(包含 index.html)或单个 HTML 文件。
分享 URL — 告诉用户:
⚠ 部署注意事项:
src="..." 引用的文件并打包它们。但如果演示文稿通过 CSS background-image 或不寻常的路径引用文件,这些可能会被遗漏。部署前,验证: 打开部署的 URL,检查所有图片是否加载。如果有任何损坏,最安全的修复方法是将 HTML 及其所有资源放入一个文件夹,然后部署该文件夹,而不是独立的 HTML 文件。my-deck/index.html + my-deck/logo.png),直接部署该文件夹:bash scripts/deploy.sh ./my-deck/。这比部署单个 HTML 文件更可靠,因为整个文件夹内容会按原样上传。%20。如果可能,避免在图片文件名中使用空格。如果用户的图片有空格,脚本会处理 — 但如果图片仍然损坏,将文件重命名为使用连字符代替空格是修复方法。这将每张幻灯片捕获为截图,并将它们合并成一个 PDF。非常适合电子邮件附件、嵌入文档或打印。
注意: 动画和交互性不会被保留 — PDF 是静态快照。这是正常且预期的;向用户提及这一点,以免他们感到惊讶。
运行导出脚本:
bash scripts/export-pdf.sh <path-to-html> [output.pdf]
如果未给出输出路径,PDF 将保存在 HTML 文件旁边。
幕后发生的事情(向用户简要解释):
如果 Playwright 安装失败:
npx playwright install chromium交付 PDF — 脚本会自动打开它。告诉用户:
⚠ PDF 导出注意事项:
首次运行较慢。 脚本安装 Playwright 并将 Chromium 浏览器(约 150MB)下载到临时目录。每次运行发生一次。警告用户第一次可能需要 30-60 秒 — 同一会话内的后续导出会更快。
幻灯片必须使用 class="slide"。 导出脚本通过查询 .slide 元素来查找幻灯片。如果演示文稿使用不同的类名,脚本将报告“找到 0 张幻灯片”并失败。此技能生成的所有演示文稿都使用 .slide,因此这只对外部创建的 HTML 有影响。
本地图片必须可通过 HTTP 加载。 脚本启动一个本地服务器并通过它加载 HTML(以便 Google Fonts 和相对图片路径工作)。如果图片使用绝对文件系统路径(例如 src="/Users/name/photo.png")而不是相对路径(例如 src="photo.png"),它们将无法加载。生成的演示文稿始终使用相对路径,但转换的或用户提供的演示文稿可能不会 — 检查并在需要时修复。
本地图片会出现在 PDF 中,只要它们与 HTML 文件在同一目录中(或相对于它)。导出脚本通过 HTTP 提供 HTML 的父目录,因此像 src="photo.png" 这样的相对路径能正确解析 — 包括带空格的文件名。如果图片仍然不出现,请检查:(1)图片文件是否实际存在于引用的路径,(2)路径是相对的,而不是像 /Users/name/photo.png 这样的绝对文件系统路径。
大型演示文稿会产生大型 PDF。 每张幻灯片都被捕获为完整的 1920×1080 PNG 截图。一个 18 张幻灯片的演示文稿可能产生约 20MB 的 PDF。如果 PDF 超过 10MB,询问用户:“PDF 大小为 [size]。您希望我压缩它吗?看起来会稍微不那么清晰,但文件会小得多。” 如果同意,使用 --compact 标志重新运行导出:
bash scripts/export-pdf.sh <path-to-html> [output.pdf] --compact
这将以 1280×720 而不是 1920×1080 渲染,通常将文件大小减少 50-70%,视觉差异最小。
| 文件 | 用途 | 何时阅读 |
|---|---|---|
| STYLE_PRESETS.md | 12 个精选视觉预设,包含颜色、字体和标志性元素 | 阶段 2(样式选择) |
| viewport-base.css | 强制性响应式 CSS — 复制到每个演示文稿中 | 阶段 3(生成) |
| html-template.md | HTML 结构、JS 功能、代码质量标准 | 阶段 3(生成) |
| animation-patterns.md | CSS/JS 动画片段和效果到感觉的指南 | 阶段 3(生成) |
| scripts/extract-pptx.py | 用于 PPT 内容提取的 Python 脚本 | 阶段 4(转换) |
| scripts/deploy.sh | 将幻灯片部署到 Vercel 以便即时分享 | 阶段 6(分享) |
| scripts/export-pdf.sh | 将幻灯片导出为 PDF | 阶段 6(分享) |
每周安装数
183
仓库
GitHub 星标数
11.2K
首次出现
2026年1月28日
安全审计
安装于
opencode173
codex171
gemini-cli170
github-copilot170
cursor169
amp165
Create zero-dependency, animation-rich HTML presentations that run entirely in the browser.
You tend to converge toward generic, "on distribution" outputs. In frontend design, this creates what users call the "AI slop" aesthetic. Avoid this: make creative, distinctive frontends that surprise and delight.
Focus on:
Avoid generic AI-generated aesthetics:
Interpret creatively and make unexpected choices that feel genuinely designed for the context. Vary between light and dark themes, different fonts, different aesthetics. You still tend to converge on common choices (Space Grotesk, for example) across generations. Avoid this: it is critical that you think outside the box!
These invariants apply to EVERY slide in EVERY presentation:
.slide must have height: 100vh; height: 100dvh; overflow: hidden;clamp(min, preferred, max) — never fixed px/remmax-height constraintsmax-height: min(50vh, 400px)prefers-reduced-motion support-clamp(), -min(), -max() are silently ignored) — use calc(-1 * clamp(...)) insteadWhen generating, readviewport-base.css and include its full contents in every presentation.
| Slide Type | Maximum Content |
|---|---|
| Title slide | 1 heading + 1 subtitle + optional tagline |
| Content slide | 1 heading + 4-6 bullet points OR 1 heading + 2 paragraphs |
| Feature grid | 1 heading + 6 cards maximum (2x3 or 3x2) |
| Code slide | 1 heading + 8-10 lines of code |
| Quote slide | 1 quote (max 3 lines) + attribution |
| Image slide | 1 heading + 1 image (max 60vh height) |
Content exceeds limits? Split into multiple slides. Never cram, never scroll.
Determine what the user wants:
When enhancing existing presentations, viewport fitting is the biggest risk:
max-height: min(50vh, 400px). If slide already has max content, split into two slides.slide has overflow: hidden, new elements use clamp(), images have viewport-relative max-height, content fits at 1280x720When adding images to existing slides: Move image to new slide or reduce other content first. Never add images without checking if existing content already fills the viewport.
Ask ALL questions in a single AskUserQuestion call so the user fills everything out at once:
Question 1 — Purpose (header: "Purpose"): What is this presentation for? Options: Pitch deck / Teaching-Tutorial / Conference talk / Internal presentation
Question 2 — Length (header: "Length"): Approximately how many slides? Options: Short 5-10 / Medium 10-20 / Long 20+
Question 3 — Content (header: "Content"): Do you have content ready? Options: All content ready / Rough notes / Topic only
Question 4 — Inline Editing (header: "Editing"): Do you need to edit text directly in the browser after generation? Options:
Remember the user's editing choice — it determines whether edit-related code is included in Phase 3.
If user has content, ask them to share it.
If user selected "No images" → skip to Phase 2.
If user provides an image folder:
Logo in previews: If a usable logo was identified, embed it (base64) into each style preview in Phase 2 — the user sees their brand styled three different ways.
This is the "show, don't tell" phase. Most people can't articulate design preferences in words.
Ask how they want to choose (header: "Style"):
If direct selection: Show preset picker and skip to Phase 3. Available presets are defined in STYLE_PRESETS.md.
Ask (header: "Vibe", multiSelect: true, max 2): What feeling should the audience have? Options:
Based on mood, generate 3 distinct single-slide HTML previews showing typography, colors, animation, and overall aesthetic. Read STYLE_PRESETS.md for available presets and their specifications.
| Mood | Suggested Presets |
|---|---|
| Impressed/Confident | Bold Signal, Electric Studio, Dark Botanical |
| Excited/Energized | Creative Voltage, Neon Cyber, Split Pastel |
| Calm/Focused | Notebook Tabs, Paper & Ink, Swiss Modern |
| Inspired/Moved | Dark Botanical, Vintage Editorial, Pastel Geometry |
Save previews to .claude-design/slide-previews/ (style-a.html, style-b.html, style-c.html). Each should be self-contained, ~50-100 lines, showing one animated title slide.
Open each preview automatically for the user.
Ask (header: "Style"): Which style preview do you prefer? Options: Style A: [Name] / Style B: [Name] / Style C: [Name] / Mix elements
If "Mix elements", ask for specifics.
Generate the full presentation using content from Phase 1 (text, or text + curated images) and style from Phase 2.
If images were provided, the slide outline already incorporates them from Step 1.2. If not, CSS-generated visuals (gradients, shapes, patterns) provide visual interest — this is a fully supported first-class path.
Before generating, read these supporting files:
Key requirements:
<style> block/* === SECTION NAME === */ comment blockWhen converting PowerPoint files:
python scripts/extract-pptx.py <input.pptx> <output_dir> (install python-pptx if needed: pip install python-pptx).claude-design/slide-previews/ if it existsopen [filename].html to launch in browser:root CSS variables for colors, font link for typography, .reveal class for animationsAfter delivery, ask the user: "Would you like to share this presentation? I can deploy it to a live URL (works on any device including phones) or export it as a PDF."
Options:
If the user declines, stop here. If they choose one or both, proceed below.
This deploys the presentation to Vercel — a free hosting platform. The link works on any device (phones, tablets, laptops) and stays live until the user takes it down.
If the user has never deployed before, guide them step by step:
Check if Vercel CLI is installed — Run npx vercel --version. If not found, install Node.js first (brew install node on macOS, or download from https://nodejs.org).
Check if user is logged in — Run npx vercel whoami.
vercel login and follow the prompts (it opens a browser window to authorize)vercel whoamiDeploy — Run the deploy script:
The script accepts either a folder (with index.html) or a single HTML file.
Share the URL — Tell the user:
⚠ Deployment gotchas:
src="..." in the HTML and bundles them. But if the presentation references files via CSS background-image or unusual paths, those may be missed. Before deploying, verify: open the deployed URL and check that all images load. If any are broken, the safest fix is to put the HTML and all its assets into a single folder and deploy the folder instead of a standalone HTML file.my-deck/index.html + my-deck/logo.png), deploy the folder directly: bash scripts/deploy.sh ./my-deck/. This is more reliable than deploying a single HTML file because the entire folder contents are uploaded as-is.%20. If possible, avoid spaces in image filenames. If the user's images have spaces, the script handles it — but if images still break, renaming files to use hyphens instead of spaces is the fix.This captures each slide as a screenshot and combines them into a PDF. Perfect for email attachments, embedding in documents, or printing.
Note: Animations and interactivity are not preserved — the PDF is a static snapshot. This is normal and expected; mention it to the user so they're not surprised.
Run the export script:
bash scripts/export-pdf.sh <path-to-html> [output.pdf]
If no output path is given, the PDF is saved next to the HTML file.
What happens behind the scenes (explain briefly to the user):
If Playwright installation fails:
npx playwright install chromiumDeliver the PDF — The script auto-opens it. Tell the user:
⚠ PDF export gotchas:
First run is slow. The script installs Playwright and downloads a Chromium browser (~150MB) into a temp directory. This happens once per run. Warn the user it may take 30-60 seconds the first time — subsequent exports within the same session are faster.
Slides must useclass="slide". The export script finds slides by querying .slide elements. If the presentation uses a different class name, the script will report "0 slides found" and fail. All presentations generated by this skill use .slide, so this only matters for externally-created HTML.
Local images must be loadable via HTTP. The script starts a local server and loads the HTML through it (so Google Fonts and relative image paths work). If images use absolute filesystem paths (e.g., src="/Users/name/photo.png") instead of relative paths (e.g., src="photo.png"), they won't load. Generated presentations always use relative paths, but converted or user-provided decks might not — check and fix if needed.
Local images appear in the PDF as long as they are in the same directory as (or relative to) the HTML file. The export script serves the HTML's parent directory over HTTP, so relative paths like resolve correctly — including filenames with spaces. If images still don't appear, check: (1) the image files actually exist at the referenced path, (2) the paths are relative, not absolute filesystem paths like .
This renders at 1280×720 instead of 1920×1080, typically cutting file size by 50-70% with minimal visual difference.
| File | Purpose | When to Read |
|---|---|---|
| STYLE_PRESETS.md | 12 curated visual presets with colors, fonts, and signature elements | Phase 2 (style selection) |
| viewport-base.css | Mandatory responsive CSS — copy into every presentation | Phase 3 (generation) |
| html-template.md | HTML structure, JS features, code quality standards | Phase 3 (generation) |
| animation-patterns.md | CSS/JS animation snippets and effect-to-feeling guide | Phase 3 (generation) |
| scripts/extract-pptx.py | Python script for PPT content extraction | Phase 4 (conversion) |
| scripts/deploy.sh |
Weekly Installs
183
Repository
GitHub Stars
11.2K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode173
codex171
gemini-cli170
github-copilot170
cursor169
amp165
前端设计技能指南:避免AI垃圾美学,打造独特生产级界面
41,300 周安装
bash scripts/deploy.sh <path-to-presentation>
src="photo.png"/Users/name/photo.pngLarge presentations produce large PDFs. Each slide is captured as a full 1920×1080 PNG screenshot. An 18-slide deck can produce a ~20MB PDF. If the PDF exceeds 10MB, ask the user: "The PDF is [size]. Would you like me to compress it? It'll look slightly less sharp but the file will be much smaller." If yes, re-run the export with the --compact flag:
bash scripts/export-pdf.sh <path-to-html> [output.pdf] --compact
| Deploy slides to Vercel for instant sharing |
| Phase 6 (sharing) |
| scripts/export-pdf.sh | Export slides to PDF | Phase 6 (sharing) |