social-reddit-card
Realistic Reddit post card with up/down voting and comment count, suitable for video overlays and story sharing
1How It Works & Mechanism
This template is purely data within a "folder-as-a-template" structure: SKILL.md uses YAML frontmatter for selectors, and the body contains layout instructions for the agent; the repository writes no code for individual templates, where adding a new template equals adding a new folder.
SKILL.md — frontmatter (id, scenario, tags, …) + prompt body
At runtime, the host sandwiches this template body between shared design directives and user content to assemble a prompt—the template's "intelligence" resides entirely within this natural language, without any 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 and retrieves stdout as an HTML stream; 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 selector and gallery iframes—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
Fields in the frontmatter are mapped one-by-one into selector metadata (featured determines overall sorting, recommended places it in the top "★ Recommended" group, example_* generates example card copy) and decide where it appears in category/scenario filters.
if (typeof fm.featured === "number") meta.featured = fm.featured;
All generation capabilities of this template are fulfilled by its own body: social-reddit-card/SKILL.md describes only layout, color palettes, fonts, and content discipline, without a single instruction telling the agent to run tools, call APIs, or read external data.
【模板: Reddit 帖子卡】
The intent is to render a story, question, or joke into a Reddit post card for video overlays or social media sharing, noted as inspired by hyperframes' reddit-post.
【意图】把一段故事 / 提问 / 段子, 渲染成 Reddit 帖子卡片, 用于视频叠加、社媒故事分享。Inspired by hyperframes reddit-post。
The card structure is anchored by the left vote rail (40-56px wide), which is the core of Reddit's visual identity.
- 左侧 **vote rail** (40-56px 宽):
Vote count colors are specified as a three-tier gradient: positive orange, negative blue, and neutral gray, requiring large numbers to be formatted as 12.3k.
- 票数 (Inter, 17px, weight 700, 居中, 颜色: 0 灰 / 正橙 / 负蓝); 大数字用 `12.3k` 格式。
Content discipline: User-provided content must be used; only reasonable subreddit names, usernames, and vote counts may be generated automatically.
- 必须用用户提供的内容; 自动生成合理的 subreddit / username / 票数。
Asset constraints: External image links are strictly prohibited; image placeholders must use CSS gradients with descriptions.
- 严禁外链图片; 图片占位用 CSS 渐变 + 描述。
The example artifact demonstrates dark mode + 12.3k upvotes + 1.2k comments + r/programming color scheme.
<span class="font-bold text-[15px]" style="color:#ff4500">12.3k</span>
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 (<script src> in example.html, requested by the browser during selector preview or local viewing)
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 的一致性 — vote rail 三色、r/subreddit 元数据行、评论数 action row 均在示例实现(#ff4500 票数 12.3k / r/programming / 1.2k Comments);配色与正文 dark 模式给定值一致。
- [ok] 「严禁外链图片」自证 — example.html 除 Tailwind 与 Google Fonts 两个资源端点外没有任何图片 URL;票数、图标全为文本 + 内联 SVG,符合正文禁止条款。
- [ok] 端点扫描(目录内) — 3 处:cdn.tailwindcss.com 与 fonts.googleapis.com 在 example.html,hyperframes.heygen.com 仅在 frontmatter 出处标注;SKILL.md 正文与 example.md 无其它 URL。
6Verdict & Scenarios
13bf26ccd190a3b6…