social-spotify-card
Spotify Now Playing style card: album art + progress bar + playback controls, adapted for video overlays and personal homepages.
1How It Works & Mechanism
This template is purely data within a "folder-as-template" architecture: SKILL.md uses YAML frontmatter for the picker, while the body text provides layout directives for the agent; the repository contains no specific code for individual templates, meaning adding a new template is simply adding a new folder.
SKILL.md — frontmatter (id, scenario, tags, …) + prompt body
At runtime, the host sandwiches the template body between shared design directives and user content to construct a single prompt—the template's "intelligence" resides entirely within this natural language text, with no executable code.
return `${SHARED_DESIGN_DIRECTIVES} ${opts.body.trim()}
After loading this template, the host's /api/convert passes the text to a locally authenticated coding-agent CLI, streaming stdout back as HTML; the template itself performs no network requests, credential reading, or file writes.
prompt = assemblePrompt({ body: skill.body, content, format });
The bundled example.html is a "pre-rendered example" served as-is by the preview endpoint into the picker and gallery iframe—it determines whether the template card has a visual preview and does not participate in content generation.
Returns the skill's `example.html` verbatim so it can be loaded into an
Frontmatter fields are mapped one-to-one into picker metadata (featured determines overall ranking, recommended routes to the top "★ Recommended" group, example_* generates sample card copy) and determine its placement in category/scenario filters.
if (typeof fm.featured === "number") meta.featured = fm.featured;
The generation capability of this template is delivered entirely by its own body text: social-spotify-card/SKILL.md describes only layout, color scheme, typography, and content guidelines, without instructing the agent to run tools, call endpoints, or read external data.
【模板: Spotify Now-Playing 卡】
The intent is to render a song, a podcast excerpt, or a personal bio as a Spotify Now Playing card, noting inspiration from hyperframes' spotify-card.
【意图】把一首歌、一段播客、或一段个人介绍渲染成 Spotify 正在播放卡, 适合 video overlay / 个人 about page / 创作者 hero。Inspired by hyperframes spotify-card。
The body text provides two canvas options: a 1280×720 horizontal video overlay slot and a 600×200 compact horizontal banner widget.
- 紧凑横条 widget: 600×200, 可嵌入到任何 hero。
The card layout consists of a header label, track title, artist, progress bar, timestamps, and a playback control row; the progress bar requires timestamps at both ends.
- 进度条: 4px 高, 圆角, 灰色背景 + 白色 fill (`width: 38%`); 两端时间戳 `1:24 / 3:42` (mono, 11px, 灰)。
Works with non-music input as well: treats "Title" as track name, "Subtitle/Author" as artist, defaulting duration to 3:42.
- 若用户输入是文本/标题 → 把 "标题" 当歌名, "副标/作者" 当艺人, 估算"时长" 3:42 默认。
Demands restrained, toggleable motion effects: sound waves use @keyframes and can be disabled via prefers-reduced-motion.
- 微动效: 音波动效用 `@keyframes`, 可被 `prefers-reduced-motion` 关闭。
The example artifact reproduces sound waves using three bars + animation: wave, with timestamps 1:24 / 3:42 consistent with the body text.
.wave i { display:inline-block; width:3px; margin-right:2px; background:#1DB954; transform-origin:bottom; animation: wave 1s ease-in-out infinite; }
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| network | Tailwind CDN(仅出现在产物示例 example.html,运行时不要求) |
| network | Google Fonts(仅出现在产物示例 example.html) |
| network | 灵感出处标注(frontmatter example_source_url,非运行时调用) |
| cli | 本地 coding-agent CLI(宿主提供,模板自身不调用) |
4Recommended Governance & Evidence
- 网络端点: Declared external network access: cdn.tailwindcss.com (example.html <script src>, requested by the browser during picker preview/local inspection)
5Second-Pass Verification
- [ok] skill 目录的脚本 / 网络 / 凭证 / 写盘面 — 目录仅 SKILL.md / example.html / example.md 3 个文件,无 scripts/references/数据目录;token 扫描(curl / wget / fetch / exec / spawn / process.env / API_KEY / token / secret / write / save / delete)在该目录的 SKILL.md 中零命中;无自带可执行脚本。
- [ok] 运行时链路复核 — 重读 loader.ts / shared.ts / app/api/convert/route.ts / app/api/templates/[id]/preview/route.ts:模板正文只作为 prompt body 被 assemblePrompt 拼装,宿主 spawn 本地 CLI 并捕获 stdout;模板不参与任何执行。
- [ok] commit 与元数据 — 工作副本 git HEAD = 553ed98c283f9c0f489902d035416a972d6a9699(=任务表 pin 的 full 40 位);GitHub API nexu-io/html-anything:stars 8827、license spdx Apache-2.0、pushed_at 2026-09-15T03:36:24Z(与本地 HEAD 提交时间 2026-09-15 11:36:24 +0800 一致)。
- [discrepancy] README 与源码的 frontmatter schema 漂移(仓库级) — README 第 213 / 217 / 468 行称模板 frontmatter 必须含 mode · scenario · surface · preview · design_system;但在 next/src/lib/templates/skills/ 下 '^mode:'、'^surface:'、'^design_system:' 全部零命中,实际字段是 category / scenario / aspect_hint / featured / recommended + example_*(loader.ts 的 SkillFrontmatter)。文档滞后于代码,不影响本模板运行,但照 README 新写模板会踩空。
- [ok] frontmatter 元数据映射 — loader.ts fmToMeta 逐字段映射 zhName / enName / emoji / description / category / scenario / aspectHint / tags + featured / recommended + example 卡;本模板取自 SKILL.md 的实际取值与之相符。
- [ok] example.html 与 SKILL.md 的一致性 — 固定色 #1DB954、时间戳 1:24 / 3:42、音波动效(animation: wave)均在示例实现;专辑封面为 CSS 绘制,无外链图片,符合正文「不能外链图片」。
- [ok] 端点扫描(目录内) — 3 处:cdn.tailwindcss.com、fonts.googleapis.com(均在 example.html)+ frontmatter 的 hyperframes.heygen.com 出处标注;SKILL.md 正文无 URL。
- [discrepancy] 「prefers-reduced-motion 可关闭」核对 — 正文要求 "- 微动效: 音波动效用 `@keyframes`, 可被 `prefers-reduced-motion` 关闭",但 example.html 中只有 animation: wave 的定义,未找到 @media (prefers-reduced-motion: reduce) 规则——无障碍承诺在示例里没兑现(规格要求,示例未实现)。
6Verdict & Scenarios
80174180f4c38b73…