Communitygithub.com

图像生成技能

当任务受益于 AI 创建的位图视觉效果(例如照片、插图、纹理、精灵、模型或透明背景裁剪)时,生成或编辑光栅图像。

图像生成技能 是什么?

该技能专为需要在项目中创建或编辑位图图像的 AI 代理(如 Codex)设计。它支持两种顶层模式:默认的内置 `image_gen` 工具(无需 API 密钥)和备用的 CLI 模式(需要 `OPENAI_API_KEY`)。技能通过结构化工作流指导代理如何根据用户意图(生成/编辑)和资产数量(单个/批量)来执行任务,并提供了详细的决策树和提示词增强规则。其核心价值在于确保代理能准确处理从产品照片、UI 模型到透明背景提取等多种图像任务,同时遵循项目相关的文件保存策略,避免意外覆盖或遗漏资产。

兼容平台~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/aiskillstore/marketplace/tree/HEAD/skills/imagegen

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

图像生成技能 是做什么的?

为当前项目生成或编辑图像(例如网站资源、游戏资源、UI 模型、产品模型、线框图、Logo 设计、逼真图像或信息图表)。

顶层模式和规则

此技能精确包含两种顶层模式:

  • 默认内置工具模式(首选): 内置 image_gen 工具,用于图像生成、编辑和透明图像请求。不需要 OPENAI_API_KEY。
  • 备选 CLI 模式: scripts/image_gen.py CLI。当用户明确请求或确认 CLI/API/模型路径时使用。需要 OPENAI_API_KEY。

在 CLI 备选模式中,CLI 公开了三个子命令:

  • generate
  • edit
  • generate-batch

规则:

  • 对于常规的图像生成和编辑请求,默认使用内置的 image_gen 工具。
  • 不要为了普通的画质、尺寸或文件路径控制而切换到 CLI 备选模式。
  • 对于透明图像,请求内置的 image_gen 提供透明背景并保留生成的 Alpha 通道。
  • 除非用户明确请求了 gpt-image-1.5,否则不要从内置 image_gen 或 CLI gpt-image-2 静默切换到 CLI gpt-image-1.5;请先询问用户。
  • 单词 batch 本身并不代表 CLI 备选模式。如果用户请求大量资源或要求批量生成资源,但没有明确要求 CLI/API/模型控制,请坚持使用内置路径并为每个请求的资源或变体发起一个内置调用。
  • 如果内置工具失败或不可用,请告知用户存在 CLI 备选模式,并且需要 OPENAI_API_KEY。只有在用户明确要求该备选模式时才继续。
  • 如果用户明确要求 CLI 模式,请使用捆绑的 scripts/image_gen.py 工作流。不要创建一次性的 SDK 运行器。
  • 切勿修改 scripts/image_gen.py。如果缺少某些功能,请先询问用户再做其他操作。

内置保存路径策略:

  • 在内置工具模式下,Codex 默认将生成的图像保存在 $CODEX_HOME/* 下。
  • 不要描述或依赖操作系统临时目录作为默认的内置目标路径。
  • 不要描述或依赖内置 image_gen 工具的(任何可能的)目标路径参数。如果需要特定位置,请先生成,然后从 $CODEX_HOME/generated_images/... 移动或复制选定的输出。
  • 在内置模式下的保存路径优先级:
    1. 如果用户指定了目标路径,则将选定的输出移动或复制到该路径。
    2. 如果图像用于当前项目,则在完成前将最终选定的图像移动或复制到工作区。
    3. 如果图像仅用于预览或头脑风暴,则内联渲染;底层文件可保留在默认的 $CODEX_HOME/* 路径。
  • 切勿将项目引用的资源仅留在默认的 $CODEX_HOME/* 路径。
  • 除非用户明确要求替换,否则不要覆盖现有资源;相反,创建一个带版本号的同级文件名,例如 hero-v2.png 或 item-icon-edited.png。

两种模式的共享提示词指导存在于 references/prompting.md 和 references/sample-prompts.md 中。

仅用于 CLI 模式的备选文档/资源:

  • references/cli.md
  • references/image-api.md
  • references/codex-network.md
  • scripts/image_gen.py

何时使用

  • 生成新图像(概念艺术、产品照片、封面、网站英雄图)
  • 使用一个或多个参考图像生成新图像(用于风格、构图或氛围)
  • 编辑现有图像(内绘、光照或天气变换、背景替换、物体去除、合成、透明背景)
  • 为一个任务生成大量资源或变体

何时不使用

  • 扩展或匹配仓库中现有的 SVG/矢量图标集、Logo 系统或插图库
  • 创建更适合直接用 SVG、HTML/CSS 或 Canvas 生成的简单形状、图表、线框图或图标
  • 当源文件已以可编辑的本地格式存在时,进行小的项目本地资源编辑
  • 用户明确需要确定性的代码原生输出而非生成的位图的任何任务

决策树

思考两个独立问题:

  1. 意图: 是生成新图像还是编辑现有图像?
  2. 执行策略: 是一个资源还是多个资源/变体?

意图:

  • 如果用户想要修改现有图像同时保留其部分内容,则将请求视为 编辑。
  • 如果用户仅提供图像作为风格、构图、氛围或主体指导的参考,则将请求视为 生成。
  • 如果用户没有提供图像,则将请求视为 生成。

内置编辑语义:

  • 内置编辑模式适用于已可见于对话上下文的图像,例如附件图像或之前在线程中生成的图像。
  • 如果用户想使用内置工具编辑本地图像文件,请先使用内置的 view_image 工具加载它,使其可见于对话上下文,然后再进行内置编辑流程。
  • 不要通过内置工具承诺任意的文件系统路径编辑。
  • 如果本地文件仍然需要直接的文件路径控制、蒙版或其他仅在 CLI 中可用的显式参数,则仅当用户要求时才使用明确的 CLI 备选模式。
  • 对于编辑,积极保留不变量并默认进行非破坏性保存。

执行策略:

  • 在默认的内置路径中,通过为每个请求的资源或变体发起一次 image_gen 调用来生成多个资源或变体。
  • 在 CLI 备选路径中,仅当用户明确选择了 CLI 模式并且需要大量提示/资源时,才使用 CLI generate-batch 子命令。
  • 对于多个不同的资源,不要使用 n 作为独立提示的替代。n 用于一个提示的变体;不同的资源需要不同的内置调用或不同的 CLI generate-batch 任务。

假设用户想要一张新图像,除非他们明确要求更改现有图像。

工作流

  1. 决定顶层模式:默认使用内置模式,包括透明输出请求;仅当明确请求或确认时才使用备选 CLI。
  2. 决定意图:generate 或 edit。
  3. 决定输出是仅预览还是要被当前项目使用。
  4. 决定执行策略:单个资源 vs 重复内置调用 vs CLI generate-batch。
  5. 提前收集输入:提示、精确文本(逐字)、约束/避免列表以及任何输入图像。
  6. 对于每个输入图像,明确标记其作用:
    • 参考图像
    • 编辑目标
    • 辅助插入/样式/合成输入
  7. 如果编辑目标仅存在于本地文件系统并且您坚持使用内置路径,请先使用 view_image 检查它,以便图像在对话上下文中可用。
  8. 如果用户要求的是照片、插图、精灵、产品图片、横幅或其他显式光栅类型的资源,请使用 image_gen,而不是用 SVG/HTML/CSS 占位符替代。如果请求是图标、Logo 或应与现有仓库原生 SVG/矢量/代码资源匹配的 UI 图形,则优先直接编辑这些资源。
  9. 根据具体程度增强提示:
    • 如果用户的提示已经具体且详细,将其规范化为清晰的规范,不要添加创意要求。
    • 如果用户的提示是通用的,仅在可以显著提高输出质量时添加品味良好的增强。
  10. 默认使用内置的 image_gen 工具。
  11. 对于透明输出请求,请求内置 image_gen 提供透明背景并保留生成的 Alpha 通道。
  12. 检查输出并验证:主体、风格、构图、文本准确性以及不变量/避免的项目。
  13. 通过单一针对性更改进行迭代,然后重新检查。
  14. 对于仅预览的工作,内联渲染图像;底层文件可以保留在默认的 $CODEX_HOME/generated_images/... 路径。
  15. 对于项目绑定的工作,将选定的工件移动或复制到工作区,并更新任何消费代码或引用。切勿将项目引用的资源仅留在默认的 $CODEX_HOME/generated_images/... 路径。
  16. 对于批量或多资源请求,将每个请求的最终交付物持久保存到工作区,除非用户明确要求输出仅用于预览。丢弃的变体无需保留,除非被要求。
  17. 如果用户明确选择或确认 CLI 备选模式,则使用仅备选的文档来处理模型、质量、尺寸、input_fidelity、蒙版、输出格式、输出路径和网络设置。
  18. 始终报告任何工作区绑定资产的最终保存路径,以及最终提示或提示集,以及使用的是内置工具还是备选 CLI 模式。

透明图像请求

请求内置 image_gen 提供真正透明的背景并保留其 Alpha 通道。

提示增强

将用户提示重新格式化为结构化的、面向生产的规范。使用户的目标更清晰、更可操作,但不要盲目增加细节。

将其视为提示塑造指导,而不是一个封闭的模式。只使用有帮助的字段,并在能显著提高清晰度时添加一个简短的额外标记行。

具体性策略

根据用户提示的具体程度来决定多少增强是合适的:

  • 如果提示已经具体且详细,保留该具体性,仅进行规范/结构化。
  • 如果提示是通用的,当能显著改善结果时,可以添加品味良好的增强。

允许的增强:

  • 构图或取景提示
  • 润色级别或预期用途提示
  • 实用布局指导
  • 支持所述请求的合理场景具体化

不允许的增强:

  • 请求中未隐含的额外角色或物体
  • 未隐含的品牌名称、口号、调色板或叙事节拍
  • 任意特定侧面的放置,除非周围布局支持

用例分类(精确标识符)

将每个请求归类到以下一个桶中,并在提示和参考中保持一致标识符。

生成:

  • photorealistic-natural — 具有真实纹理和自然光线的纪实/编辑类生活场景。
  • product-mockup — 产品/包装拍摄、目录图像、商品概念。
  • ui-mockup — 应用/网页界面模型和线框图;指定所需的保真度。
  • infographic-diagram — 具有结构化布局和文本的图表/信息图。
  • scientific-educational — 课堂解释器、科学图表和带有所需标签和准确性约束的学习视觉内容。
  • ads-marketing — 具有受众、品牌定位、场景和确切标语/文案的活动概念和广告创意。
  • productivity-visual — 幻灯片、图表、工作流和数据密集型业务视觉内容。
  • logo-brand — Logo/标志探索,矢量友好。
  • illustration-story — 漫画、儿童书籍艺术、叙事场景。
  • stylized-concept — 风格驱动的概念艺术、3D/风格化渲染。
  • historical-scene — 时期准确/世界知识场景。

编辑:

  • text-localization — 翻译/替换图像内文本,保留布局。
  • identity-preserve — 试穿、人物场景;锁定脸部/身体/姿势。
  • precise-object-edit — 移除/替换特定元素(包括内部替换)。
  • lighting-weather — 仅改变时间/季节/氛围。
  • background-extraction — 透明背景/干净裁剪。请求内置 image_gen 提供实际透明度。
  • style-transfer — 应用参考风格,同时改变主体/场景。
  • compositing — 多图像插入/合并,匹配光照/透视。
  • sketch-to-render — 绘画/线稿转逼真渲染。

共享提示模式

使用以下标记规范作为两种顶层模式的共享提示框架:

Use case: <分类标识符>
Asset type: <资源将用于何处>
Primary request: <用户的主要提示>
Input images: <Image 1: 作用; Image 2: 作用> (可选)
Scene/backdrop: <环境>
Subject: <主要主体>
Style/medium: <照片/插图/3D 等>
Composition/framing: <广角/近景/俯拍;放置>
Lighting/mood: <光照 + 氛围>
Color palette: <调色板说明>
Materials/textures: <表面细节>
Text (verbatim): "<精确文本>"
Constraints: <必须保持/必须避免>
Avoid: <负面约束>

注意:

  • Asset type 和 Input images 是提示框架元素,不是专用的 CLI 标志。
  • Scene/backdrop 指的是视觉环境。它与备选 CLI 的 background 参数不同,后者控制输出透明度行为。
  • 仅用于备选模式的执行说明,例如 Quality:、Input fidelity:、蒙版、输出格式和输出路径,仅属于 CLI 路径。不要将它们视为内置 image_gen 工具的参数。

增强规则:

  • 保持简短。
  • 仅添加能显著改进提示所必需的细节。
  • 对于编辑,明确列出不变量(仅更改 X;保持 Y 不变)。
  • 如果缺少任何关键细节且会阻碍成功,请提出一个问题;否则继续。

示例

生成示例(英雄图)

Use case: product-mockup
Asset type: landing page hero
Primary request: 一个极简的陶瓷咖啡杯英雄图
Style/medium: 干净的产品摄影
Composition/framing: 宽幅构图,如有需要可为页面文案保留可用的负空间
Lighting/mood: 柔和的工作室灯光
Constraints: 无 Logo,无文本,无水印

编辑示例(不变量)

Use case: precise-object-edit
Asset type: product photo background replacement
Primary request: 仅将背景替换为温暖的日落渐变
Constraints: 仅更改背景;保持产品和其边缘不变;无文本;无水印

提示词最佳实践

  • 将提示结构化为:场景/背景 -> 主体 -> 细节 -> 约束。
  • 包含预期用途(广告、UI 模型、信息图)以设置模式和润色级别。
  • 对于逼真图像,使用相机/构图语言。
  • 仅当用户明确要求矢量输出或非图像占位符时才使用 SVG/矢量替代。
  • 引用精确文本并指定排版 + 放置。
  • 对于棘手的问题...

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

aiskillstore/marketplace

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

aiskillstore/marketplace

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

aiskillstore/marketplace

Use when the user asks to "pre-launch check the landing page", "run a Quality-Score preflight", or "verify ad-to-page message match before launch"; produces an ad↔page continuity report — message-match gaps, above-the-fold check, page-speed read, form-friction count, mobile-render flags — as a pass/fix punch list. Not for redesigning or rewriting the page — use landing-optimizer; not for scoring the account or the RQS — use ad-account-auditor. 落地页体验预检/广告落地页一致性检查

aiskillstore/marketplace

Use when the user asks to "optimize our landing page for influencer traffic", "fix our promo-code landing page", or "improve conversion from a creator campaign"; produces a message-match audit, page-structure and social-proof recommendations, a promo-code/CTA conversion plan, and an A/B test roadmap. Not for measuring campaign results after launch — use performance-analyzer.

aiskillstore/marketplace

Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review, critique or improve a landing page, sales page, opt-in page, product page or checkout flow, when conversion rate is low, when paid traffic is not converting, or when someone asks "why isn't this page converting" or wants a CRO / landing page review.

aiskillstore/marketplace

This skill helps users extract GitHub repository project details and contributor contact information using keywords, stars, and update dates. Agent should proactively apply this skill when users express needs like search for GitHub projects by keywords, find top open-source contributors in specific domains, extract developer contacts from GitHub repositories, discover trending repositories with high stars, gather contributor profiles and social links for tech recruiting, retrieve GitHub project descriptions and metrics, build developer communities by finding active contributors, search for repositories updated recently, collect personal website and Twitter links of developers, generate targeted leads for developer tools, or track active open-source contributors for collaboration.

aiskillstore/marketplace

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

aiskillstore/marketplace

Using the Wonda CLI to generate images, videos, music, and audio from the terminal — plus LinkedIn, Reddit, and X/Twitter research and automation

aiskillstore/marketplace

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

aiskillstore/marketplace

Generates creative domain name ideas for your project and checks availability across multiple TLDs (.com, .io, .dev, .ai, etc.). Saves hours of brainstorming and manual checking.

aiskillstore/marketplace

Process video files with audio extraction, format conversion (mp4, webm), and Whisper transcription. Use when user mentions video conversion, audio extraction, transcription, mp4, webm, ffmpeg, or whisper transcription.

aiskillstore/marketplace

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

aiskillstore/marketplace

Router skill for LLMQuant portfolio workflows. Use when the user needs company profiles, thesis tracking, theme research, watchlist monitoring, or alert management.

aiskillstore/marketplace

Account assets, equity and fund positions, P&L, cash flow records, account statements, margin ratios, buy-power estimates, order management, and DCA recurring investments via Longbridge (most require Trade permission). Frameworks: portfolio diagnosis, rebalancing, asset allocation, risk analysis (VaR/CVaR), performance attribution, and tax-loss harvesting. Triggers: "持仓", "账户", "盈亏", "资产", "对账单", "下单", "买入", "卖出", "撤单", "定投", "组合诊断", "再平衡", "资产配置", "风险分析", "绩效归因", "税损收割", "持倉", "賬戶", "盈虧", "對賬單", "下單", "買入", "賣出", "組合診斷", "再平衡", "稅損收割", "positions", "portfolio", "P&L", "order", "buy", "sell", "DCA", "statement", "risk analysis", "rebalancing", "tax harvesting", "我的风险", "持仓风险", "风险敞口", "資產", "資產配置", "風險分析", "績效歸因", "撤單

aiskillstore/marketplace

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

aiskillstore/marketplace

Use for Codex models/pricing, scheduled tasks, skills, settings, setup, troubleshooting, customization, automations, and self-knowledge—including 'you,' 'your,' 'this app,' or 'this coding agent' when they refer to Codex—and for OpenAI APIs/products and ChatGPT Work. Also use for model choice/migration, prompting, SDKs, Responses, Realtime, agents, evals, and Chat/Work/Codex comparisons. Do not use for generic app/software tasks that merely mention Codex.

aiskillstore/marketplace

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

aiskillstore/marketplace

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

aiskillstore/marketplace

Perform a read-only, defect-first review of a specified code change and return every actionable finding. Use when another agent delegates review of uncommitted changes, a base-branch diff, a commit, or custom review instructions.

aiskillstore/marketplace

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

相关技能