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.
next/src/lib/templates/loader.tsconst raw = safeRead(path.join(dir, "SKILL.md"));
What is happening here: SKILL.md is the sole source of behavior—frontmatter is used by the selector for rendering (zh_name/emoji/aspect_hint/tags/example_*, etc.), and the full body acts as the prompt; the loader performs no semantic validation and delivers whatever is written in the template.
Before dispatch, the host assembles the prompt in a fixed manner: the template body is sandwiched between SHARED_DESIGN_DIRECTIVES and [Input Format]/[User Content].
next/src/lib/templates/shared.tsWrap a per-template instruction body with the shared design directives and
What is happening here: The template only defines 'what this specific deliverable looks like' (layout/rhythm/components), while shared directives enforce cross-template hard constraints—single-file HTML, prohibition of file tools, CDN usage for Tailwind and Google Fonts, content authenticity, and CJK spacing (Pangu spacing).
Shared directives translate hard constraints into explicit prohibitions for the agent and enforce content-driven quantity (numbers in the template serve only as minimum references).
next/src/lib/templates/shared.ts**禁止使用 Write / Edit / MultiEdit / Bash / Create / 任何文件系统工具**。
Later in the same file is another rule: the quantity of generated slides/frames/cards/sections is entirely determined by the actual length and information structure of [User Content]—this explains why templates of this category do not fail when content expands: at least one card/section per content chunk, with the template merely providing layout archetypes.
Execution is actually handled by the coding agent CLI installed and authenticated on the user's local machine: the host spawns a child process, feeds it the prompt, and captures HTML streamed from stdout.
next/src/lib/agents/invoke.tsimport { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
What is happening here: The template skill only provides prompts; capabilities (including code generation and tool execution) come from the existing permissions of the host CLI; the skill directory itself contains no script entry points, so grading is based solely on assets within the directory (host behavior is excluded from grading).
/api/convert is the execution path for templates: it combines skill.body with user content into a prompt and passes it to invokeAgent.
next/src/app/api/convert/route.tsprompt = assemblePrompt({ body: skill.body, content, format });
Edit mode uses buildEditPrompt (minimal-diff editing, file tools disabled, requiring direct streaming of complete HTML). Thus, artifacts from this category of templates remain stable: single-file HTML, inline CSS/SVG, with external links limited to fonts and charting libraries explicitly required by specific templates.
The template fixes dimensions using a fixed-pixel canvas (1600×900), requires selecting dark or light mode based on content tone first, and limits each card to a single hero quote.
next/src/lib/templates/skills/card-twitter/SKILL.md- 容器 `w-[1600px] h-[900px]`, 暗色 / 亮色二选一根据内容情绪。
What is happening here: Translating the 'ready-to-screenshot-and-post' requirement into hard dimensions (16:9, 1600×900) prevents the model from generating responsive pages that distort screenshot aspect ratios.
Card face elements are strictly defined item by item: a small category badge at the top-left, a central hero quote (limited to 2-3 lines), an author signature + avatar placeholder + handle below, and a brand watermark at the bottom-right.
next/src/lib/templates/skills/card-twitter/SKILL.md- 左上角小标签 (类型: "Insight" / "Data" / "Quote")。
'Limited to 2-3 lines' is a combined constraint on font size and copy length: at text-6xl, exceeding three lines overflows the 1600×900 canvas; the template substitutes dynamic font-size scaling with a strict line-count cap.
Texture drives visual quality: requires the card to have subtle textures such as grid, noise, or dot patterns, implemented in the example with a 48px grid gradient.
next/src/lib/templates/skills/card-twitter/SKILL.md- 整张卡片有微妙的纹理 (grid 网格 / noise / dot pattern)。
Example implementation: .grid-pattern draws 48px squares using two linear-gradient layers at 0.06 opacity over a dark background—pure CSS with zero image assets.
The example artifact is a single fixed-dimension card (width:1600px + aspect-ratio:16/9), corresponding one-to-one with the rules in SKILL.md.
next/src/lib/templates/skills/card-twitter/example.html.card { width:1600px; max-width:96vw; aspect-ratio:16/9; border-radius:24px; overflow:hidden; position:relative;
max-width:96vw prevents the card from overflowing on smaller screens (for preview convenience only), while the core remains a fixed 1600px canvas; the example header also imports the Tailwind CDN and three Google Fonts font families (fetched during artifact runtime).
2Core Capabilities
01Fixed-canvas card generation: 1600×900 (16:9), choice of dark or light theme
02Single-sentence hero quote layout (text-6xl, font-semibold, capped at 2-3 lines)
03Category badge slot (Insight / Data / Quote)
04Author attribution + avatar placeholder + handle, plus bottom-right brand watermark
05Pure CSS textured background (48px grid / noise / dot pattern)
06Ready-to-screenshot finishing requirements (clean and visually impactful)
6Verdict & Scenarios
Fixed dimensions and aspect ratio (1600×900 / 16:9) allow the output to serve directly as screenshot assets, avoiding common screenshot issues with responsive pages.Clear consciousness of information density limits: hero quotes capped at 2-3 lines, paired with category tags and watermarks to avoid cluttering cards with excessive text.Visual texture relies on pure CSS rather than image assets; examples are directly reusable with zero asset dependencies.Avatars use gradient + initial placeholders, avoiding external image links (shared directives also prohibit unreliable external image links).Best for: Ideal for turning a single viewpoint or data point into an image card ready to post directly to X: tweet attachments, quote sharing, data takeaway cards, lecture excerpts; fixed canvas + fixed element positions are well-suited for batch-producing consistent card series.
Not for: Not suitable for dense or multi-part information (single hero sentence is a hard constraint; longer content should use article-* or card-xiaohongshu); not suitable for cards requiring interactivity or animations; not suitable for scenarios requiring precise brand CI/VI (the template provides only a layout frame, while color schemes are selected by the model based on sentiment).