关于 sn-image-resume
sn-image-resume 将简历文本转换为纵向设计图片,适用于制作作品集风格简历的人。它通过 sn-text-optimize 编写图像提示词,再由 sn-image-generate 生成图片,并支持指定风格和宽高比。
主要功能
- 01接收对话中的简历文本
- 02接受可选的视觉风格要求
- 03将文本整理为图像提示词
- 04生成设计型简历图片
- 05设置宽高比和图像尺寸
适用场景
- 01制作作品集风格的简历图片
- 02将简历文本转换为视觉页面
- 03应用指定配色或职业美学
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ opensensenova/ sensenova-skills --skill sn-image-resume安装后在 Claude Code 中输入/sn-image-resume确认已加载。
附带文件prompts/resume.md
详细介绍
sn-image-resume
简历图像生成场景技能(第 1 层),依赖 sn-image-base(第 0 层)提供的 sn-text-optimize 和 sn-image-generate 工具。
功能:
- 直接接受对话文本中的简历内容
- 支持用户可选提供风格方向
- 应用
prompts/resume.md中固定的作品集简历版式规则 - 通过
sn-image-generate生成竖版设计简历图像
非目标
- 编辑或润色纯文本简历文档,但不生成图像
- 将上传的简历文件解析为主要输入格式
- 创建传统的单栏 ATS 简历
- 当图像版式需要压缩内容时,保证每个长段落都能完整保留
输入规范
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
resume_content | 字符串 | 必填 | 用户在对话中提供的简历文本,包括姓名、个人简介、教育经历、工作经历、技能、项目、联系方式等。 |
style | 字符串 | 可选 | 用户指定的视觉风格、基调、配色、职业美学或参考氛围。也可以包含在 resume_content 中。 |
aspect_ratio | 字符串 | 9:16 | 输出宽高比。允许的值:2:3、3:2、3:4、4:3、4:5、5:4、1:1、16:9、9:16、21:9、9:21。默认值为 9:16(竖版),因为模板是纵向堆叠的作品集简历页面。 |
image_size | 字符串 | 2k | 图像尺寸预设:1k 或 2k。 |
output_mode | 字符串 | friendly | 输出模式:friendly 或 verbose。 |
API 配置
此技能中的所有 API 调用均通过 sn-image-base 技能的 sn_agent_runner.py 执行,身份验证参数使用默认值(CLI > 环境变量 > 内置默认值),因此通常无需显式传入。
| 调用类型 | 工具 | 身份验证参数 | 描述 |
|---|---|---|---|
| 大模型 | sn-text-optimize | 默认读取 SN_TEXT_API_KEY -> SN_CHAT_API_KEY -> SN_API_KEY | 使用 prompts/resume.md 作为系统提示词,将用户的简历文本转换为详细的图像生成提示词 |
| 图像生成 | sn-image-generate | 默认读取 SN_IMAGE_GEN_API_KEY -> SN_API_KEY | 生成最终简历图像 |
如果所有功能都使用同一个网关,只需配置:
SN_BASE_URL="https://your-api-endpoint.com/v1"
SN_API_KEY="your-api-key"
遇到 MissingApiKeyError 或需要指定模型时:通过 CLI 显式传入参数。参见 $SN_IMAGE_BASE/references/api_spec.md。
$SN_IMAGE_BASE 路径说明:$SN_IMAGE_BASE 是 sn-image-base 技能的安装目录(其中存在 SKILL.md)。Agent 可以通过技能名称 sn-image-base 查找此路径。
架构:主 Agent + Worker Agent
此技能采用两层 Agent 架构:
| 角色 | 职责 |
|---|---|
| 主 Agent | 接收用户请求、规范化参数、发送预检信息、启动 Worker、收集结果,并向用户发送最终文本/图像 |
| Worker Agent | 执行提示词生成和图像生成,然后返回结构化 JSON |
职责边界:
- Worker Agent 不会直接向用户发送任何消息,只返回结构化 JSON
- 主 Agent 负责所有用户可见消息
- Worker Agent 的最后一条消息必须且只能是返回约定中定义的 JSON 字符串
- Worker Agent 的底层 API 调用通过
sn-image-base直接执行,不会启动嵌套子 Agent
工作流
主 Agent 工作流
- 从用户请求中提取
resume_content、可选的style、aspect_ratio(默认值为9:16)、image_size(默认值为2k)和output_mode(默认值为friendly) - 验证
resume_content非空,且包含足够的简历信息以生成有意义的页面 - 验证
aspect_ratio是否为允许的值之一:2:3、3:2、3:4、4:3、4:5、5:4、1:1、16:9、9:16、21:9、9:21。如果用户提供的值不在此列表中,请告知用户,并回退到默认值9:16 - 发送统一的预检消息:
"Using sn-image-resume skill to generate a resume image, please wait..." - 启动 Worker Agent,并传入完整参数和工作目录
- Worker Agent 返回后:
status=ok:发送简短摘要和生成的图片status=error:向用户报告实际的error字段内容
Worker Agent 工作流
Worker Agent 接收 resume_content、style、aspect_ratio、image_size、output_mode 以及此技能的工作目录(SKILL_DIR)。
第 0 步 — 初始化
- 使用时间戳格式
YYYYMMDD_HHMMSS生成task_id - 创建临时目录:
/tmp/openclaw/sn-image-resume/<task_id>/,作为TEMP_DIR - 持久化规范化后的输入:
echo "$RESUME_CONTENT" > "$TEMP_DIR/resume-content.txt"
echo "$STYLE" > "$TEMP_DIR/style.txt"
第 1 步 — 简历提示词生成
使用 prompts/resume.md 作为系统提示词,并调用 sn-text-optimize 将用户的简历内容转换为详细的图像生成提示词。
USER_PROMPT=$(cat << EOF
Resume content:
$RESUME_CONTENT
Optional style instruction:
${STYLE:-No explicit style instruction. Infer an appropriate professional visual style from the resume content.}
Task:
Convert the resume content into a complete text-to-image prompt for a tall portfolio-resume image.
Follow the fixed layout, language, content mapping, typography, panel, and style translation rules in the system prompt.
Return only the final image generation prompt. Do not include explanations, markdown fences, or alternative options.
EOF
)
python "$SN_IMAGE_BASE/scripts/sn_agent_runner.py" sn-text-optimize \
--system-prompt-path "$SKILL_DIR/prompts/resume.md" \
--user-prompt "$USER_PROMPT" \
--output-format json
解析 JSON 标准输出,并提取 result 作为 generation_prompt。如果进程以非零状态退出、返回无效 JSON,或 result 为空,则返回 status=error,并附上实际错误。
持久化输出:
echo "$GENERATION_PROMPT" > "$TEMP_DIR/generation-prompt.txt"
第 2 步 — 简历图片生成
使用 sn-image-base 的 sn-image-generate 工具生成最终图片。
python "$SN_IMAGE_BASE/scripts/sn_agent_runner.py" sn-image-generate \
--prompt "$GENERATION_PROMPT" \
--image-size "$IMAGE_SIZE" \
--aspect-ratio "$ASPECT_RATIO" \
--save-path "$TEMP_DIR/resume.png" \
--output-format json
解析 JSON 标准输出。如果生成失败,则返回 status=error,并附上实际错误。生成的图片路径为 $TEMP_DIR/resume.png。
错误处理规则
- 如果缺少必要的简历内容,请在开始生成前要求用户提供简历文本
- 如果
sn-text-optimize失败或返回空结果,请停止并报告实际错误 - 如果
sn-image-generate失败,请停止并报告实际错误 - 如果用户内容不完整或提示词生成失败,不要悄悄替换为通用简历提示词
- 不要编造用户未提供的简历事实;只能重新组织、精简和以视觉方式呈现已提供的信息
返回约定
Worker Agent 完成后,其最后一条消息必须且只能是以下 JSON 字符串(裸 JSON,不含代码围栏,也不含前置或后置文本)。
正常流程:
{
"status": "ok",
"need_main_agent_send": true,
"output_mode": "friendly|verbose",
"image": "$TEMP_DIR/resume.png",
"generation_prompt": "<included only when output_mode=verbose>",
"timing": {
"total_elapsed_seconds": 25.12,
"prompt_generation": { "elapsed_seconds": 5.23, "model": "sensenova-6.8-flash-lite" },
"image_generation": { "elapsed_seconds": 19.89, "model": "sn_image_model" }
}
}
错误流程:
{
"status": "error",
"error": "<Actual error information>"
}
规则:
status=ok必须包含need_main_agent_send: true- 当
output_mode=verbose时,generation_prompt必须包含该字段;在friendly模式下省略该字段 timing.prompt_generation.elapsed_seconds和timing.prompt_generation.model从sn-text-optimize的 JSON 输出中读取timing.image_generation.elapsed_seconds从sn-image-generate的 JSON 输出中读取timing.image_generation.model固定为"sn_image_model",因为sn-image-generate不会返回模型字段
输出格式
friendly 模式(默认)
**文本摘要:**用一句话说明简历图片已生成,不超过 50 个单词。
**图片:**发送生成的单张简历图片。
verbose 模式
Resume image generated
---
Aspect ratio: <aspect_ratio>
Image size: <image_size>
---
Generation prompt:
<generation_prompt>
---
Time statistics: Total <total>s | Prompt generation <t>s | Image generation <t>s
---
Image:
<image path>
调用关系
- 底层依赖:
sn-image-base→sn-text-optimize、sn-image-generate - 系统提示词:
prompts/resume.md
参考资料
prompts/resume.md- 固定的作品集简历版式及语言/内容映射规则../sn-image-base/SKILL.md- 基础层图像/文本工具行为../sn-image-base/references/api_spec.md- CLI 参数详情