Snap Illustrator
Instantly analyze long-form markdown articles, extract core scenes, generate prompts, and seamlessly insert AI illustrations with a snap. Designed for blogs, articles, and documentation with zero configuration required.
Trigger Scenarios
When the user asks to "illustrate this article", "add images to this markdown", "为文章配图", or "加配图".
Design Philosophy & Zero-Config Flow
Default to Zero-Config Experience:
- 1. By default, utilize the included Node.js script to run via the unauthenticated
Pollinations.ai API. This process is completely zero-config and requires NO API tokens from the user. - As long as images generate successfully, DO NOT ask the user to configure any tokens. Let the user experience an instant, frictionless image insertion.
- ONLY IF the Node.js script throws an exception or logs
PLEASE_ASK_USER_FOR_TOKEN, indicating the free unauthenticated service is rate-limited or unavailable, should you proactively ask the user: "The free generation service is currently busy. Do you have a HuggingFace Token you could provide to continue?" - If the user provides a HuggingFace Token, instruct them to set it as an environment variable (e.g.,
export HF_TOKEN="<your_token>" in their ~/.zshrc or ~/.bash_profile), or temporarily use the token to run the script. AI agents should NOT permanently save tokens to disk unless explicitly requested by the user.
Execution Workflow
Step 1: Text Analysis & Planning
- 1. Read Content: Read the user's target Markdown file.
- Segmentation: Analyze the structural and semantic boundaries of the text and partition it into sections suitable for illustrations (e.g., placing one image per major heading or roughly one per 300 words).
- Propose an Outline: Before spending time generating images, present a brief "Illustration Outline" to the user. Describe how many images you plan to insert, where they will be placed, and what concepts they represent. Wait for the user's confirmation before proceeding.
Step 2: Generate Prompts
Once the user approves the outline, design high-quality, English-only image generation prompts for each selected insertion point.
- - Suggested format: INLINECODE5
- Avoid Text Generation Constraints: Explicitly design prompts to avoid rendering text, letters, or numbers to prevent garbled artifacts. Append a uniform style keyword (e.g.,
flat vector illustration) unless the user specified a distinct style.
Step 3: Execute Node.js Script
Invoke the included Node.js script using run_in_terminal to perform the actual image generation.
Locating the script: This SKILL.md file is your reference — scripts/generate.mjs lives in the same directory as this file. You already know the absolute path to this SKILL.md (it was provided to you when the skill was loaded). Strip the filename to get the skill root directory, then append scripts/generate.mjs.
For example, if this skill file is at /path/to/skills/snap-illustrator/SKILL.md, then run:
node /path/to/skills/snap-illustrator/scripts/generate.mjs --prompt "Your English Prompt Here" --output "<workspace>/images/img_name.jpg"
(Note: Ensure <workspace> points to the absolute path of the markdown file's directory. Images should typically be placed in an images/ subdirectory adjacent to the markdown file)
Step 4: Finalize & Insert
Insert standard Markdown image syntax referencing the generated images into the original text at the appropriate boundaries:
## Heading

Body paragraph...
Notify the user once all illustrations have been successfully inserted.
Troubleshooting & Connectivity Issues
Handle failures in the following priority order:
Issue 1: Unauthenticated Service Unavailable
If the Node.js script fails immediately (non-network error), exits with a non-zero code, or outputs PLEASE_ASK_USER_FOR_TOKEN:
Immediately tell the user:
"免费的无认证图片生成服务当前不可用(速率限制或服务故障)。建议切换到 HuggingFace API。请问您是否有 HuggingFace Token?"
Do not retry the free service. Proceed to Issue 2 for HuggingFace setup.
Issue 2: Network Connectivity Problems (especially Mainland China)
If the script times out, throws a network/fetch error, or ECONNREFUSED/ENOTFOUND/ETIMEDOUT appears in the output, the user may be experiencing connectivity issues with overseas services.
Ask the user:
"检测到网络连接问题。请确认:
- 1. 您是否能正常访问 https://huggingface.co ?
- 您是否需要配置 HTTP/HTTPS 代理来访问境外服务?"
If the user cannot access HuggingFace or needs a proxy, proceed to Issue 3.
Issue 3: HTTP Proxy Configuration
If the user confirms they have an HTTP proxy, ask them to provide the proxy address:
"请提供您的 HTTP 代理地址(格式如 http://127.0.0.1:7890):"
Once the user provides the proxy address, run the script with proxy environment variables:
CODEBLOCK2
Recording the proxy for future use: Update this SKILL.md file by appending the user's proxy setting to the frontmatter metadata section, so it can be reused automatically in subsequent runs:
CODEBLOCK3
And in all subsequent script executions within this session, automatically prepend HTTPS_PROXY="<proxy_url>" HTTP_PROXY="<proxy_url>" to the command without asking the user again.
Issue 4: All Services Unavailable
If none of the above resolves the issue, inform the user:
"图片生成服务当前无法访问。您可以稍后重试,或手动准备图片后,我可以帮您将图片链接插入到文章中。"
Snap Illustrator
即时分析长篇Markdown文章,提取核心场景,生成提示词,并一键无缝插入AI插图。专为博客、文章和文档设计,无需任何配置。
触发场景
当用户要求为这篇文章配图、给这个Markdown添加图片、为文章配图或加配图时触发。
设计理念与零配置流程
默认采用零配置体验:
- 1. 默认情况下,使用内置的Node.js脚本通过无需认证的Pollinations.ai API运行。此过程完全零配置,无需用户提供任何API令牌。
- 只要图片成功生成,不要要求用户配置任何令牌。让用户体验即时、无摩擦的图片插入。
- 仅当Node.js脚本抛出异常或输出PLEASEASKUSERFORTOKEN(表示免费的无认证服务受到速率限制或不可用)时,才应主动询问用户:免费生成服务当前繁忙。您是否有HuggingFace Token可以提供以继续?
- 如果用户提供了HuggingFace Token,指导他们将其设置为环境变量(例如,在~/.zshrc或~/.bashprofile中设置export HFTOKEN=),或临时使用该令牌运行脚本。除非用户明确要求,AI代理不应将令牌永久保存到磁盘。
执行工作流
步骤1:文本分析与规划
- 1. 读取内容:读取用户的Markdown目标文件。
- 分段:分析文本的结构和语义边界,将其划分为适合配图的部分(例如,每个主要标题放置一张图片,或大约每300字放置一张)。
- 提出大纲:在花费时间生成图片之前,向用户呈现一个简短的插图大纲。描述计划插入多少张图片、它们将放置在哪里以及它们代表什么概念。等待用户确认后再继续。
步骤2:生成提示词
一旦用户批准大纲,为每个选定的插入点设计高质量的纯英文图片生成提示词。
- - 建议格式:[核心概念/主体], [场景/背景], [风格关键词], 4k, 超精细, 杰作
- 避免文字生成限制:明确设计提示词以避免渲染文字、字母或数字,防止出现乱码伪影。除非用户指定了不同的风格,否则附加统一的风格关键词(例如扁平矢量插图)。
步骤3:执行Node.js脚本
使用runinterminal调用内置的Node.js脚本来执行实际的图片生成。
定位脚本:此SKILL.md文件是您的参考——scripts/generate.mjs位于此文件的同一目录中。您已经知道此SKILL.md的绝对路径(加载技能时已提供给您)。去掉文件名即可获得技能根目录,然后附加scripts/generate.mjs。
例如,如果此技能文件位于/path/to/skills/snap-illustrator/SKILL.md,则运行:
bash
node /path/to/skills/snap-illustrator/scripts/generate.mjs --prompt 您的英文提示词 --output /images/img_name.jpg
(注意:确保指向Markdown文件目录的绝对路径。图片通常应放置在Markdown文件旁边的images/子目录中)
步骤4:最终确定并插入
在原文的适当边界处插入引用生成图片的标准Markdown图片语法:
markdown
标题

正文段落...
在所有插图成功插入后通知用户。
故障排除与连接问题
按以下优先级顺序处理故障:
问题1:无认证服务不可用
如果Node.js脚本立即失败(非网络错误)、以非零代码退出或输出PLEASEASKUSERFORTOKEN:
立即告知用户:
免费的无认证图片生成服务当前不可用(速率限制或服务故障)。建议切换到 HuggingFace API。请问您是否有 HuggingFace Token?
不要重试免费服务。转到问题2进行HuggingFace设置。
问题2:网络连接问题(尤其是中国大陆)
如果脚本超时、抛出网络/获取错误,或输出中出现ECONNREFUSED/ENOTFOUND/ETIMEDOUT,用户可能遇到海外服务的连接问题。
询问用户:
检测到网络连接问题。请确认:
- 1. 您是否能正常访问 https://huggingface.co ?
- 您是否需要配置 HTTP/HTTPS 代理来访问境外服务?
如果用户无法访问HuggingFace或需要代理,转到问题3。
问题3:HTTP代理配置
如果用户确认他们有HTTP代理,请他们提供代理地址:
请提供您的 HTTP 代理地址(格式如 http://127.0.0.1:7890):
一旦用户提供代理地址,使用代理环境变量运行脚本:
bash
HTTPSPROXY=url> HTTPPROXY=url> node /path/to/skills/snap-illustrator/scripts/generate.mjs --prompt ... --output ...
记录代理以供将来使用:通过将用户的代理设置附加到frontmatter元数据部分来更新此SKILL.md文件,以便在后续运行中自动重用:
yaml
metadata:
openclaw:
requires:
env:
- HF_TOKEN
bins:
- node
http_proxy: http://127.0.0.1:7890 # ← 在此处添加代理
并且在此会话中的所有后续脚本执行中,自动在命令前添加HTTPSPROXY=url> HTTPPROXY=url>,无需再次询问用户。
问题4:所有服务不可用
如果以上方法均无法解决问题,告知用户:
图片生成服务当前无法访问。您可以稍后重试,或手动准备图片后,我可以帮您将图片链接插入到文章中。