frame-data-chart-nyt
NYT-newsroom typography + staggered reveal animation + editorial-grade charts (line/bar/range band)
1How It Works & Mechanism
This skill is not an executable program, but a prompt injected into the local coding-agent CLI: the host takes the body of SKILL.md, prepends site-wide shared design instructions, appends user content, concatenates them into a single prompt for the logged-in agent, and retrieves the agent's stdout as HTML.
【输入格式】: ${opts.format} 【用户内容】: ${opts.content}
The shared instruction layer (which does not belong to any single skill but sits atop every template) enforces the output as a 'self-contained single-file HTML', explicitly prohibiting the agent from using filesystem tools like Write/Edit/Bash, and streams HTML directly into the conversation body.
- **禁止使用 Write / Edit / MultiEdit / Bash / Create / 任何文件系统工具**。不要把 HTML 写到任何 \`.html\` 文件里。前端直接捕获你的 stdout 文本, 文件落盘由前端负责。
Beyond SKILL.md, there is a 'content-driven quantity' override rule: any page, frame, or card counts specified in the template are treated as reference minimums, with the actual quantity determined by user content—preventing the agent from compressing user content to match template numbers.
- 模板只定义"可用版面 / 风格 / 配色 / 字体 / 组件库", **不定义** slide / 帧 / 卡片 / section 的数量。
The loading convention is 'one skill = one folder': SKILL.md (YAML frontmatter for the selector + body as template prompt), optional example.md (sample input), and example.html (preview sample ready to open directly); adding a new template only requires adding a directory without modifying TS code.
* SKILL.md — frontmatter (id, scenario, tags, …) + prompt body * example.md — (optional) sample input content * example.html — (optional) pre-rendered preview, shown inline in the picker
The selection pipeline (CLI side) is a three-stage funnel: strong keyword signals (2 points per matched word, threshold of 3) → fallback to tags/scenario scoring → if still uncertain, sending the first 800 characters of user content to the local agent for a one-sentence classification.
const CONFIDENCE_THRESHOLD = 3;
The preview pipeline is decoupled from generation: /api/templates/<id>/preview returns example.html verbatim as text/html to the iframe; the frontend iframe uses sandbox="allow-scripts allow-same-origin".
sandbox="allow-scripts allow-same-origin"
The template deconstructs 'a piece of data → one frame of a New York Times column-style chart' into a fixed layout: a top kicker (data source + category), a conclusion headline synthesized from the data, a chart area occupying 55-65% of the canvas, and a bottom source + footnote, delivered in a 16:9 single frame.
【画布】1920×1080, 暖白底 `#f7f5ee` 或墨黑底 `#0e0e0e` 二选一; 文字色和背景相反。 【布局】 - **顶部 kicker** (11px uppercase letterspace 0.14em, 颜色 = accent 红 `#a91d1d` 或 mint `#5fb38a`): 数据来源 + 类目, 如 "GLOBAL · WEEKLY ACTIVE USERS · 2018–2026"。 - **大字标题** (Cheltenham / Playfair / Source Serif Pro, 5.6vw, italic 副标可选): 一句结论。**结论必须从用户数据中提炼**, 不是描述图。 - **图表区** (占画布 55-65%): - 折线: 1-2 条线, 主线 ink 实心 2.5px, 次线 dashed 1.5px; 数据点用 6px 实心圆; 关键点旁标注 `2024 · 412M` 黑色 mono 小字。 - 柱状: 全部 ink 单色或加 1 道 accent 高亮柱; 柱顶大数字; 柱底类目斜体 (Cheltenham italic)。 - 范围带 (range band): 浅灰填充 `#e6e2d2` 包络 + 中线 ink。 - **底部 source + footnote** (10px mono, opacity 0.6): "Source: 用户数据 · Chart by html-anything"。
The chart implementation route is restricted to hand-crafted SVG: explicitly forbidding chart.js / d3 (unless imported via jsdelivr CDN), and imposing a line count upper limit to avoid generating a heavyweight charting project.
- **绝不**: 使用 chart.js / d3 库 (除非 jsdelivr CDN 引入); 推荐手写 SVG, 不超过 80 行 inline。
Provides distinct specifications for three chart types: line (1-2 lines, primary line ink 2.5px solid, secondary line 1.5px dashed, 6px solid circular data points); bar (single color or 1 accent highlight + large numbers on bar tops + italicized categories); range band (light gray envelope + median line).
- 折线: 1-2 条线, 主线 ink 实心 2.5px, 次线 dashed 1.5px; 数据点用 6px 实心圆; 关键点旁标注 `2024 · 412M` 黑色 mono 小字。
The animation discipline follows staggered reveals: headline 0s, kicker 200ms, line stroke-dashoffset 1.2s ease-out (starting at 400ms), data labels appearing sequentially every 100ms, and respects prefers-reduced-motion to disable.
description: "NYT-newsroom 排版 + 错峰揭示动画 + 编辑级图表 (折线/柱/范围带)"
Data authenticity has fallback rules: must use user data; if the input is purely textual conclusions, coordinates may be estimated but must be labeled as schematic; CSV/JSON is rendered directly.
- 必须用用户提供的数据。如果输入是文本结论, 自动估算合理坐标 (但要标注 "schematic"); 如果是 CSV/JSON, 直接绘制。
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| network | Google Fonts(Source Serif Pro / IBM Plex Sans / IBM Plex Mono / Noto Sans SC,示例页实际引用) |
| network | Tailwind Play CDN(共享指令强制;示例页亦引用) |
| network | jsdelivr CDN(仅出现在『禁止图表库』的例外条款,条件性、非默认路径) |
| network | hyperframes 目录页(frontmatter 出处标注,非运行时请求) |
4Recommended Governance & Evidence
- SKILL.md: Pure prompt instructions and rule text, without script execution or external side effects
5Second-Pass Verification
- [ok] 图型与动画规格 — 重读 SKILL.md 折线/柱状/范围带与『错峰揭示动画』两段,引用逐字一致。
- [ok] 『不引图表库』结论 — 示例页仅一个 <script src="https://cdn.tailwindcss.com">,无 d3/chart.js 引用,与 SKILL.md 的手写 SVG 路线一致。
- [ok] jsdelivr 条目定性 — source 中该词仅出现在 `- **绝不**: 使用 chart.js / d3 库 (除非 jsdelivr CDN 引入); 推荐手写 SVG, 不超过 80 行 inline。`(SKILL.md:37);按批4 口径(非明确强制)未升档,已在 deps/reason 标注。
- [ok] 外部端点存在性 — example.html 实测命中 cdn.tailwindcss.com 与 fonts.googleapis.com;example_source_url 指向 heygen 的 hyperframes 目录页,仅作出处标注。
- [ok] 数据真实性条款 — SKILL.md『必须用用户提供的数据…自动估算合理坐标 (但要标注 "schematic")』逐字复核通过。
- [ok] 安全面 — skill 目录 3 个文件无自写脚本/凭证/写盘;示例页无 fetch、无表单外发。
- [ok] meta 元数据 — GitHub API 实查 stars=8827、pushed_at=2026-09-15T03:36:24Z、license Apache-2.0。
6Verdict & Scenarios
bb37abe4f6f66d85…