social-media-dashboard
Platform switcher + followers/engagement KPI + growth curve + Top post + trending topics
1How It Works & Mechanism
This template is purely data within a "folder-as-template" architecture: SKILL.md uses YAML frontmatter for the picker, and its body serves as layout directives for the agent; the repository writes no code for individual templates, and adding a new template simply means adding a folder.
SKILL.md — frontmatter (id, scenario, tags, …) + prompt body
At runtime, the host sandwiches this template's body between shared design directives and user content to assemble a single prompt — the template's "intelligence" resides entirely within this natural language, with zero executable code.
return `${SHARED_DESIGN_DIRECTIVES} ${opts.body.trim()}
After loading this template, the host's /api/convert delivers this text to a locally authenticated coding-agent CLI, streaming stdout back as HTML; the template itself initiates no network requests, reads no credentials, and writes no files.
prompt = assemblePrompt({ body: skill.body, content, format });
The accompanying 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 item-by-item into picker metadata (featured determines global sorting, recommended enters the top "★ Recommended" group, example_* generates example card copy), defining where it appears within category/scenario filters.
if (typeof fm.featured === "number") meta.featured = fm.featured;
The template's generative capabilities are fulfilled entirely by its own body: social-media-dashboard/SKILL.md describes only layout, color palette, typography, and content guidelines, without a single line instructing the agent to run tools, call endpoints, or fetch external data.
【模板: 社媒创作者仪表板】
The body defines fixed dashboard sections: platform switcher, KPIs, growth curve, Top post, and sidebar trends/comments.
【意图】面向博主 / 创作者的社媒数据看板。
The platform switcher lists five platforms—X / LinkedIn / YouTube / Instagram / TikTok—effectively demanding "reusing the same dashboard across different data sources".
- 顶部平台 switcher (X / LinkedIn / YouTube / Instagram / TikTok)
The KPI group is restricted to four social metrics: followers / engagement / likes / reposts.
- KPI 卡片 (followers / engagement / likes / reposts)
The example artifact uses inline JS to achieve platform switching and full-screen re-rendering (switching hero, KPIs, charts, Top post, and active highlight states).
function switchPlatform(platform) {
Charts are not static images: the example creates SVG line/area charts on the fly with JS, with annotation points also generated dynamically by script.
const line = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| network | Google Fonts(仅出现在产物示例 example.html) |
| network | 第三方头像图床(仅出现在产物示例 example.html 的内联脚本数据里) |
| cli | 本地 coding-agent CLI(宿主提供,模板自身不调用) |
4Recommended Governance & Evidence
- scripts/: Execute local script or command: inline <script> in example.html (browser-side: platform switching, KPI formatting, SVG line/area plotting, contributor grid) — only inside picker preview ifra
- 网络端点: Declare external network access: fonts.googleapis.com (<link> in example.html, font requested by the browser during preview)
5Second-Pass Verification
- [ok] skill 目录的脚本 / 网络 / 凭证 / 写盘面 — 目录仅 SKILL.md / example.html 2 个文件,无 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 的实际取值与之相符。
- [discrepancy] example.html 与 SKILL.md 的一致性(平台数量) — 正文写 '- 顶部平台 switcher (X / LinkedIn / YouTube / Instagram / TikTok)',示例 HTML 只渲染两个按钮(data-platform="x" 与 data-platform="github");内联 platformData 里确有 x/linkedin/youtube/instagram 四套数据,GitHub 走贡献者分支。只看示例会以为平台只有两个。
- [discrepancy] 外部图片 URL 与仓库共享指令相左 — shared.ts 的共享指令要求「不要引用任何外部图片 URL」,但本模板的 example.html 把 5 个 GitHub 头像写成 https://avatars.githubusercontent.com/u/… 绝对地址并在 <img src> 里加载,是该产物唯一会向第三方图床发请求的地方(作为示例产物可接受,但用户直接复用示例时会带上外部依赖)。
- [ok] 端点扫描(目录内) — 2 类端点:fonts.googleapis.com(Space Grotesk / Inter)与 avatars.githubusercontent.com(5 个头像);无 Tailwind CDN;SKILL.md 正文零 URL。
6Verdict & Scenarios
5c0986485a0bc508…