card-xiaohongshu
Xiaohongshu (RED) style knowledge cards, arranged in multi-card sequences for swipeable browsing.
1How It Works & Mechanism
The template itself contains no executable code: the loader reads the frontmatter and body from src/lib/templates/skills/<id>/SKILL.md, and returns the body along with example content as LoadedSkill.
const raw = safeRead(path.join(dir, "SKILL.md"));
The host assembles the prompt in a fixed sequence before dispatch: the template body is sandwiched between the shared design directives SHARED_DESIGN_DIRECTIVES and [Input Format] / [User Content].
Wrap a per-template instruction body with the shared design directives and
Shared directives translate hard constraints into explicit prohibitions for the agent and enforce content-driven quantity (numbers in the template serve only as baseline minimums).
**禁止使用 Write / Edit / MultiEdit / Bash / Create / 任何文件系统工具**。
Actual execution is handled by the coding agent CLI already installed and authenticated on the user's local machine: the host spawns a child process, passes the prompt to it, and captures the HTML stream from stdout.
import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
/api/convert is the execution path for templates: it combines skill.body with user content into a prompt and passes it to invokeAgent.
prompt = assemblePrompt({ body: skill.body, content, format });
The output is a vertical flex column of N identical-sized cards, sized at 1080×1440 (3:4) per card, supporting both full-length continuous screenshots and individual slide captures.
- 输出 N 张连续卡片, 每张 `w-[1080px] h-[1440px]`, 用 flex 纵向排列方便整体截图也方便单张截图。
Card count is determined by content density, with platform limits and rule-of-thumb ranges provided (up to 18 images, typically optimal within 9, starting at 3-6 cards for short content, with one core point per card).
N 由【用户内容】信息量决定: 短内容 3-6 张起步
The card sequence features a clear narrative structure: a cover card (massive title + 1-line subtitle + catchy badge), intermediate cards each covering one core point (emoji + short phrase + 1-2 examples), and a concluding card with summary + call to action.
- 最后一张是总结 + 行动号召 (关注 / 收藏 / 评论)。
Mobile readability is enforced as a strict requirement: large font sizes, generous line heights, and high contrast, on the grounds that Xiaohongshu is read on mobile phones.
- 字号大、行距宽、对比强(小红书在手机上看, 小字根本看不清)。
Each card includes a bottom-right watermark (author name / date), implemented in the example as @HTMLAnything + page number.
- 每张卡片右下角小水印 (作者名 / 日期)。
Color palette and element styles are restricted to soft Morandi/pastel tones, rounded elements, and generous whitespace; the example implements this using a coordinated set of gradient backgrounds.
- 配色: 选择柔和的莫兰迪色或粉色系; 元素圆润, 大量留白。
2Core Capabilities
4Recommended Governance & Evidence
- SKILL.md: Pure prompt directives and rule text, without script execution or external impact
5Second-Pass Verification
- [ok] 张数一致性(输入分节 ↔ 输出卡数) — example.html 中 class="card" 出现 7 次,与 example.md 的封面 + 5 个观点卡 + 总结一致;SKILL.md 的「3-6 张起步 / 通常 9 张以内最佳」是区间指导,示例 7 张落在区间内。
- [ok] 封面徽标与结尾 CTA 是否落实 — 封面卡含「⚡ 建议收藏 · 干货预警」标签(对应吸引人的标签),末卡含「关注」「收藏」按钮样式(对应行动号召),均可逐字定位。
- [ok] 水印要求落地 — 7 张卡各有一个 .watermark 元素;封面带页码「@HTMLAnything · 5/11」,符合水印位(作者名 / 日期页码)设计。
- [ok] 端点与判级 — 目录内 http(s) 仅 cdn.tailwindcss.com 与 fonts.googleapis.com(产物期引用);SKILL.md 正文无端点要求,执行期零外发,维持 green。
- [ok] license / stars / commit 元数据 — GitHub API(api.github.com/repos/nexu-io/html-anything):spdx_id=Apache-2.0、stargazers_count=8827、pushed_at=2026-09-15T03:36:24Z;工作副本 git HEAD = 553ed98c283f9c0f489902d035416a972d6a9699(与任务表 pin 553ed98c283f 同源)。
- [ok] skill.path 与目录资产面 — pin 目录内该路径存在且含 SKILL.md;目录内文件清单已用 glob 全量核对(含隐藏文件),无 scripts/、无 references/、无二进制资产(competitive-teardown 的 assets/ 为纯 HTML,另行记录)。
6Verdict & Scenarios
f54e465c136dc217…