social-media-matrix
Cinematic multi-platform social media analytics: interactive charts, hover insights, range comparisons, and dark/light themes
1How It Works & Mechanism
This template is purely data within a "folder-as-template" architecture: SKILL.md uses YAML frontmatter for selectors, and its body contains layout instructions for the agent; the repository contains no code for individual templates, meaning adding a template simply equals 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 compose a prompt — the template's "intelligence" resides entirely within this natural language, with zero executable code.
return `${SHARED_DESIGN_DIRECTIVES} ${opts.body.trim()}
The host's /api/convert loads this template and hands these texts to a locally authenticated coding-agent CLI, streaming back stdout purely as HTML; the template itself initiates no network requests, reads no credentials, and writes no files.
prompt = assemblePrompt({ body: skill.body, content, format });
The example.html bundled with the template is a "pre-rendered example" served as-is by the preview endpoint into the iframe of selectors and galleries — it determines whether the template card displays 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-by-one into selector metadata (featured determines overall sorting, recommended pushes it to the top "★ Recommended" group, example_* generates copy for example cards) and determine where it appears in category/scenario filters.
if (typeof fm.featured === "number") meta.featured = fm.featured;
The generation capabilities of this template are fulfilled entirely by its own body text: social-media-matrix/SKILL.md only describes layout, color palette, typography, and content guidelines, without a single command instructing the agent to run tools, fetch APIs, or read external data.
【模板: 社媒矩阵追踪 (Social Matrix Tracker)】
The goal is to turn social media data into a cinematic, data-dense multi-platform dashboard.
【意图】电影感、数据密集的多平台社媒看板。
The core is a platform × metric KPI matrix rather than single-platform metric cards.
- Multi-platform KPI matrix (横 platform × 纵 metric)
Charts require interactivity: hover tooltips and range comparisons.
- 交互式 charts (hover tooltip + range compare)
Theme and fallback data handling are also embedded in the body: dark / light switching, with data backed by seed fallbacks.
- dark / light 切换; 数据用 seed 兜底
The example uses canvas + inline JS to implement interactive charts (tooltips, pinning, drag-to-range, Shift+Drag to save multiple ranges, double-click to reset).
<div class="sub">Hover: details · Click: pin point · Drag: interval stats · Shift+Drag: save multi ranges · Double click: reset</div>
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| cli | 本地 coding-agent CLI(宿主提供,模板自身不调用) |
4Recommended Governance & Evidence
- scripts/: Executes local scripts or commands: example.html inline <script> (browser-side: canvas line/stacked/donut rendering, hover tooltips, click pinning, drag-to-select range statistics, S
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 的实际取值与之相符。
- [ok] 端点扫描(目录内) — social-media-matrix 目录 2 个文件中无任何 http(s) 字面量:无 CDN、无 Google Fonts、无外链图片;字体仅以字族名声明。
- [ok] example.html 与 SKILL.md 的一致性 — 正文五条要求均有对应实现:data-theme + setTheme()(主题切换)、.platforms 矩阵、canvas 图表 + .chart-tooltip(交互图表)、.insights-panel(洞察抽屉)、Top posts 卡片。
- [unlocatable] 「数据用 seed 兜底」 — 正文写 '- dark / light 切换; 数据用 seed 兜底',但在 SKILL.md 与 example.html 中都找不到任何确定性随机种子机制:示例是写死的静态数据字面量(data = { x:{…}, linkedin:{…} … }),只有装饰性 sparkline 用 Math.random()。该措辞更像是「缺数据时自造合理数据」的要求,无代码级对应物,故不写成能力。
6Verdict & Scenarios
64db2953e2b6de77…