Article Summary Card
Turn an article into a concise summary bundle.
When to use
- - Summarize a webpage or article and deliver the result as an image.
- Convert long text into a reusable set of outputs:
JSON, Markdown, HTML, PNG. - Produce repeatable summary cards with a consistent layout and predictable sizing.
Runtime Requirements
- - INLINECODE4
- INLINECODE5
- Chrome or Chromium for headless screenshots
- Python package: INLINECODE6
If Chrome is not installed at the default path, adjust the browser candidate list in scripts/render_card.py.
Workflow
- 1. Read the input article from a URL or local file.
- Extract the title and article body; remove obvious page chrome when possible.
- In the current session, run two prompt rounds:
- Round 1: create a summary plan that decides how the article should be divided into sections.
- Round 1 must also generate 3 to 8 short tags for the article.
- Round 2: write the final summary JSON according to that plan.
- 4. Use the unified renderer to export the final summary JSON as
Markdown, HTML, and PNG. - Verify the outputs exist and have a reasonable size.
Commands
Extract article text for the session workflow:
CODEBLOCK0
The extracted JSON contains:
- - INLINECODE11
- INLINECODE12
- INLINECODE13
Then in the current session:
- - Use
references/prompts/plan-system.md and references/prompts/plan-user.md to design the summary structure. - Use
references/prompts/summary-system.md and references/prompts/summary-user.md to write the final summary JSON. - Include
tags in the final summary JSON and show them at the end of the rendered card and Markdown output.
Preferred final export:
CODEBLOCK1
This produces:
- - INLINECODE19
- INLINECODE20
- INLINECODE21
Optional lower-level renderers:
CODEBLOCK2
Adjust styles in:
CODEBLOCK3
The renderer keeps HTML and CSS separate:
CODEBLOCK4
The size system is based on a 375px design width multiplied by SCREEN_RATIO in CSS and Python.
Optional helper: generate a local heuristic draft JSON when you want a quick bootstrap, but do not treat it as the preferred path for high-quality output:
CODEBLOCK5
For final output, replace or rewrite that draft in-session and then use render_outputs.py.
summarize_article.py is a compatibility helper, not the main summarizer.
Cross-Platform Adapters
- Native entrypoint is this skill folder itself:
article-summary-card/SKILL.md
- Optional UI metadata:
article-summary-card/agents/openai.yaml
- Project slash command:
.claude/commands/article-summary-card.md
- Usage pattern:
/article-summary-card <url-or-file> [output-stem]
- OpenClaw uses skill folders containing
SKILL.md, so this same directory is portable.
- Install helper:
CODEBLOCK6
- Default destination: INLINECODE33
Notes
- - This skill prefers deterministic rendering over image-generation models so long Chinese text stays accurate.
- The preferred summarizer is the current session model, not an API call inside Python.
- Summary instructions are intentionally extracted into
references/prompts/ so they can be revised without editing Python code. - Cross-platform portability comes from keeping one shared skill core and only adding thin platform entrypoints.
- If a site is hard to extract, inspect the HTML and add a site-specific extraction rule in
scripts/summarize_article.py. - For very long articles, keep the summary short enough to fit on one card. If it still overflows, shorten section points before re-rendering.
- INLINECODE36 no longer performs LLM calls; it only generates a heuristic draft JSON.
- When DOM height measurement succeeds, the renderer trusts that height and skips whitespace auto-cropping to avoid cutting off low-contrast tags or footer content.
- The renderer uses overscan-then-crop for long screenshots to avoid incomplete bottom rendering in headless Chrome.
文章摘要卡片
将一篇文章转化为简洁的摘要包。
使用场景
- - 总结网页或文章,并以图片形式输出结果。
- 将长文本转换为可复用的输出格式:JSON、Markdown、HTML、PNG。
- 生成具有一致布局和可预测尺寸的可重复摘要卡片。
运行环境要求
- - python3
- curl
- Chrome 或 Chromium(用于无头截图)
- Python 包:Pillow
如果 Chrome 未安装在默认路径,请调整 scripts/render_card.py 中的浏览器候选列表。
工作流程
- 1. 从 URL 或本地文件读取输入文章。
- 提取标题和文章正文;尽可能移除明显的页面装饰元素。
- 在当前会话中运行两轮提示:
- 第一轮:创建摘要计划,决定文章应如何划分章节。
- 第一轮还必须为文章生成 3 到 8 个简短标签。
- 第二轮:根据该计划编写最终的摘要 JSON。
- 4. 使用统一渲染器将最终摘要 JSON 导出为 Markdown、HTML 和 PNG。
- 验证输出文件是否存在且大小合理。
命令
为会话工作流提取文章文本:
bash
python3 article-summary-card/scripts/extract_article.py \
--url https://example.com/article \
--out output/article-input.json
提取的 JSON 包含:
- - title
- source
- article_text
然后在当前会话中:
- - 使用 references/prompts/plan-system.md 和 references/prompts/plan-user.md 设计摘要结构。
- 使用 references/prompts/summary-system.md 和 references/prompts/summary-user.md 编写最终摘要 JSON。
- 在最终摘要 JSON 中包含 tags,并在渲染卡片和 Markdown 输出的末尾显示它们。
首选最终导出:
bash
python3 article-summary-card/scripts/render_outputs.py \
--summary output/article-summary.json \
--out-stem output/article-summary
这将生成:
- - output/article-summary.md
- output/article-summary.html
- output/article-summary.png
可选的底层渲染器:
bash
python3 article-summary-card/scripts/render_markdown.py --summary output/article-summary.json --out output/article-summary.md
python3 article-summary-card/scripts/render_card.py --summary output/article-summary.json --out output/article-summary.png
在以下位置调整样式:
bash
article-summary-card/assets/templates/mobile-card.css
渲染器保持 HTML 和 CSS 分离:
bash
article-summary-card/assets/templates/mobile-card.html
article-summary-card/assets/templates/mobile-card.css
尺寸系统基于 375px 设计宽度乘以 CSS 和 Python 中的 SCREEN_RATIO。
可选辅助工具:当需要快速启动时,生成本地启发式草稿 JSON,但不要将其视为高质量输出的首选路径:
bash
python3 article-summary-card/scripts/summarize_article.py \
--url https://example.com/article \
--out output/article-summary-draft.json \
--mode heuristic
对于最终输出,在会话中替换或重写该草稿,然后使用 render_outputs.py。
summarize_article.py 是兼容性辅助工具,不是主要的摘要生成器。
跨平台适配器
- 原生入口点即此技能文件夹本身:article-summary-card/SKILL.md
- 可选的 UI 元数据:article-summary-card/agents/openai.yaml
- 项目斜杠命令:.claude/commands/article-summary-card.md
- 使用模式:/article-summary-card
[output-stem]
- OpenClaw 使用包含 SKILL.md 的技能文件夹,因此同一目录可移植。
- 安装辅助工具:
bash
python3 article-summary-card/scripts/install_openclaw.py
- 默认目标路径:~/.openclaw/workspace/skills/article-summary-card
注意事项
- - 此技能优先使用确定性渲染而非图像生成模型,以确保长中文文本保持准确。
- 首选的摘要生成器是当前会话模型,而非 Python 内部的 API 调用。
- 摘要指令特意提取到 references/prompts/ 中,以便无需编辑 Python 代码即可修改。
- 跨平台可移植性源于保持一个共享的技能核心,仅添加薄层平台入口点。
- 如果某个网站难以提取,请检查 HTML 并在 scripts/summarizearticle.py 中添加特定于该网站的提取规则。
- 对于非常长的文章,保持摘要足够简短以适合一张卡片。如果仍然溢出,请在重新渲染前缩短章节要点。
- summarizearticle.py 不再执行 LLM 调用;它仅生成启发式草稿 JSON。
- 当 DOM 高度测量成功时,渲染器信任该高度并跳过空白自动裁剪,以避免截断低对比度的标签或页脚内容。
- 渲染器对长截图使用过扫描再裁剪的方式,以避免无头 Chrome 中底部渲染不完整。