$npx -y skills add nexus-research-lab/nexus --skill imagegenGenerate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, UI mockups, product shots, or transparent-background cutouts. Use when the result should be an image asset rather than repo-native SVG,
| 1 | # Image Generation Skill |
| 2 | |
| 3 | 为当前 workspace 生成或编辑位图资产。默认使用内置 `nexus_imagegen` MCP 工具;Provider、鉴权、接口兼容和响应解析全部由 Go 服务负责。`nexusctl imagegen` 只作为显式 CLI 兜底和手工调试入口。 |
| 4 | |
| 5 | ## 快路径 |
| 6 | |
| 7 | 普通单图生成必须走内置工具快路径。 |
| 8 | |
| 9 | - 调用 `generate_image`,不要调用 Bash。 |
| 10 | - 不读取 references。 |
| 11 | - 不创建 prompt 文件。 |
| 12 | - 不读取输出图片。 |
| 13 | - 不做目录探测。 |
| 14 | - 不使用 Write、Read、LS、Glob、TaskOutput。 |
| 15 | - 不主动用 high quality。 |
| 16 | |
| 17 | 工具入参模板: |
| 18 | |
| 19 | ```json |
| 20 | { |
| 21 | "prompt": "A concise production prompt", |
| 22 | "size": "1024x1024", |
| 23 | "quality": "low", |
| 24 | "output_format": "png", |
| 25 | "file_name": "stable-name" |
| 26 | } |
| 27 | ``` |
| 28 | |
| 29 | 如果用户明确要横幅、封面或宽图,使用 `size=1792x1024`,仍保持 `quality=low`。如果图片服务返回 429/过载,最多再调用 1 次工具,降低尺寸或保持 low 重试。 |
| 30 | |
| 31 | 工具返回的 `item.path` 和 `item.markdown` 是结果真相源。不要打开生成后的 PNG/JPG/WebP 文件验证,这会把二进制或 base64 塞回上下文。 |
| 32 | 不要在工具入参里选择 Provider 或模型,让 Settings 里的默认生图模型决定;只有用户明确要求 CLI/provider/model 控制时,才使用 `nexusctl imagegen` 兜底。 |
| 33 | |
| 34 | ## 判断 |
| 35 | |
| 36 | - 没有输入图片:默认 `generate`。 |
| 37 | - 用户要求改图、局部替换、合成、mask:使用 `edit`。 |
| 38 | - 用户提供图片只是做风格或构图参考:仍使用 `generate`,除非明确要求编辑原图。 |
| 39 | - 多个不同资产使用多次 `generate_image` 调用,每个资产一条 prompt;不要把多资产塞进一个 prompt。 |
| 40 | - 需求更适合 SVG、HTML/CSS、Canvas 或现有矢量源时,不用本 skill。 |
| 41 | |
| 42 | ## 生成 |
| 43 | |
| 44 | 把用户描述整理成一条不超过 600 字符的 `prompt`。用户描述已经具体时不要读取任何 reference。 |
| 45 | |
| 46 | ```json |
| 47 | { |
| 48 | "prompt": "Nexus AI assistant promotional banner, futuristic dark blue background, glowing neural network core, large clean NEXUS text, premium technology style", |
| 49 | "size": "1024x1024", |
| 50 | "quality": "low", |
| 51 | "output_format": "png", |
| 52 | "file_name": "nexus-promo-banner" |
| 53 | } |
| 54 | ``` |
| 55 | |
| 56 | 只有用户明确选择 CLI 模式,或需要 provider/model 覆盖时,才参考 `references/cli.md` 使用 `nexusctl imagegen`。 |
| 57 | |
| 58 | ## 编辑 |
| 59 | |
| 60 | ```json |
| 61 | { |
| 62 | "image_path": "input.png", |
| 63 | "mask_path": "mask.png", |
| 64 | "prompt": "Make this black and white", |
| 65 | "output_format": "png", |
| 66 | "file_name": "edited-image" |
| 67 | } |
| 68 | ``` |
| 69 | |
| 70 | 调用 `edit_image`;`image_path` 和 `mask_path` 使用 workspace 相对路径。只有路径不明确时才做一次必要的文件查找。 |
| 71 | |
| 72 | ## 回复 |
| 73 | |
| 74 | 最终回复保持极简,只给工具返回的 markdown 和路径。不要输出尺寸、大小、配色说明、过程说明或下一步建议,除非用户明确询问。 |
| 75 | |
| 76 | ```markdown |
| 77 | 已生成:`output/imagegen/nexus-promo-banner.png` |
| 78 | |
| 79 |  |
| 80 | ``` |
| 81 | |
| 82 | ## 复杂任务参考 |
| 83 | |
| 84 | 普通单图生成不要读取 references。只有复杂多资产、透明背景、强文字约束或编辑失败排查时再打开对应文件: |
| 85 | |
| 86 | - `references/prompting.md` |
| 87 | - `references/sample-prompts.md` |
| 88 | - `references/cli.md` |
| 89 | - `scripts/remove_chroma_key.py` |