From ca8412356a07446cd8a1544b91a8b91325defdcd Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 15 May 2026 11:26:59 +1000 Subject: [PATCH] Add skill-image-gen plugin: AI image generation with OpenAI and Gemini (#1696) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a skill that lets users generate images (icons, sprites, textures, mockups) directly from their coding workflow using OpenAI gpt-image-2 or Google Gemini. BYO API key — the skill guides users through setup on first use. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/plugin/marketplace.json | 6 ++ docs/README.plugins.md | 1 + docs/README.skills.md | 1 + .../.github/plugin/plugin.json | 25 +++++ plugins/skill-image-gen/README.md | 35 ++++++ skills/generate-image/SKILL.md | 100 ++++++++++++++++++ 6 files changed, 168 insertions(+) create mode 100644 plugins/skill-image-gen/.github/plugin/plugin.json create mode 100644 plugins/skill-image-gen/README.md create mode 100644 skills/generate-image/SKILL.md diff --git a/.github/plugin/marketplace.json b/.github/plugin/marketplace.json index aa115172..e6769ba2 100644 --- a/.github/plugin/marketplace.json +++ b/.github/plugin/marketplace.json @@ -616,6 +616,12 @@ "description": "Security frameworks, accessibility guidelines, performance optimization, and code quality best practices for building secure, maintainable, and high-performance applications.", "version": "1.0.0" }, + { + "name": "skill-image-gen", + "source": "skill-image-gen", + "description": "Generate images using AI directly from your coding workflow. Supports OpenAI (gpt-image-2) and Google Gemini. BYO API key — the skill guides you through setup on first use.", + "version": "1.0.0" + }, { "name": "skills-for-copilot-studio", "description": "Microsoft Copilot Studio plugins for AI coding agents", diff --git a/docs/README.plugins.md b/docs/README.plugins.md index 5cd4e7f0..6138f9c3 100644 --- a/docs/README.plugins.md +++ b/docs/README.plugins.md @@ -83,6 +83,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-plugins) for guidelines on how t | [rust-mcp-development](../plugins/rust-mcp-development/README.md) | Build high-performance Model Context Protocol servers in Rust using the official rmcp SDK with async/await, procedural macros, and type-safe implementations. | 2 items | rust, mcp, model-context-protocol, server-development, sdk, tokio, async, macros, rmcp | | [salesforce-development](../plugins/salesforce-development/README.md) | Complete Salesforce agentic development environment covering Apex & Triggers, Flow automation, Lightning Web Components, Aura components, and Visualforce pages. | 7 items | salesforce, apex, triggers, lwc, aura, flow, visualforce, crm, salesforce-dx | | [security-best-practices](../plugins/security-best-practices/README.md) | Security frameworks, accessibility guidelines, performance optimization, and code quality best practices for building secure, maintainable, and high-performance applications. | 1 items | security, accessibility, performance, code-quality, owasp, a11y, optimization, best-practices | +| [skill-image-gen](../plugins/skill-image-gen/README.md) | Generate images using AI directly from your coding workflow. Supports OpenAI (gpt-image-2) and Google Gemini. BYO API key — the skill guides you through setup on first use. | 1 items | image-generation, openai, gemini, ai, art, sprites, textures, icons | | [software-engineering-team](../plugins/software-engineering-team/README.md) | 7 specialized agents covering the full software development lifecycle from UX design and architecture to security and DevOps. | 7 items | team, enterprise, security, devops, ux, architecture, product, ai-ethics | | [structured-autonomy](../plugins/structured-autonomy/README.md) | Premium planning, thrifty implementation | 3 items | | | [swift-mcp-development](../plugins/swift-mcp-development/README.md) | Comprehensive collection for building Model Context Protocol servers in Swift using the official MCP Swift SDK with modern concurrency features. | 2 items | swift, mcp, model-context-protocol, server-development, sdk, ios, macos, concurrency, actor, async-await | diff --git a/docs/README.skills.md b/docs/README.skills.md index 2ac60176..e9ec5e80 100644 --- a/docs/README.skills.md +++ b/docs/README.skills.md @@ -173,6 +173,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-skills) for guidelines on how to | [gdpr-compliant](../skills/gdpr-compliant/SKILL.md)
`gh skills install github/awesome-copilot gdpr-compliant` | Apply GDPR-compliant engineering practices across your codebase. Use this skill whenever you are designing APIs, writing data models, building authentication flows, implementing logging, handling user data, writing retention/deletion jobs, designing cloud infrastructure, or reviewing pull requests for privacy compliance. Trigger this skill for any task involving personal data, user accounts, cookies, analytics, emails, audit logs, encryption, pseudonymization, anonymization, data exports, breach response, CI/CD pipelines that process real data, or any question framed as "is this GDPR-compliant?". Inspired by CNIL developer guidance and GDPR Articles 5, 25, 32, 33, 35. | `references/Security.md`
`references/data-rights.md` | | [gen-specs-as-issues](../skills/gen-specs-as-issues/SKILL.md)
`gh skills install github/awesome-copilot gen-specs-as-issues` | This workflow guides you through a systematic approach to identify missing features, prioritize them, and create detailed specifications for implementation. | None | | [generate-custom-instructions-from-codebase](../skills/generate-custom-instructions-from-codebase/SKILL.md)
`gh skills install github/awesome-copilot generate-custom-instructions-from-codebase` | Migration and code evolution instructions generator for GitHub Copilot. Analyzes differences between two project versions (branches, commits, or releases) to create precise instructions allowing Copilot to maintain consistency during technology migrations, major refactoring, or framework version upgrades. | None | +| [generate-image](../skills/generate-image/SKILL.md)
`gh skills install github/awesome-copilot generate-image` | Generate images using AI. Use when asked to generate, create, or make images, textures, icons, sprites, artwork, visual assets, or mockups. Supports OpenAI (gpt-image-2) and Google Gemini (Nano Banana). Requires an API key for the chosen provider. | None | | [geofeed-tuner](../skills/geofeed-tuner/SKILL.md)
`gh skills install github/awesome-copilot geofeed-tuner` | Use this skill whenever the user mentions IP geolocation feeds, RFC 8805, geofeeds, or wants help creating, tuning, validating, or publishing a self-published IP geolocation feed in CSV format. Intended user audience is a network operator, ISP, mobile carrier, cloud provider, hosting company, IXP, or satellite provider asking about IP geolocation accuracy, or geofeed authoring best practices. Helps create, refine, and improve CSV-format IP geolocation feeds with opinionated recommendations beyond RFC 8805 compliance. Do NOT use for private or internal IP address management — applies only to publicly routable IP addresses. | `assets/example`
`assets/iso3166-1.json`
`assets/iso3166-2.json`
`assets/small-territories.json`
`references/rfc8805.txt`
`references/snippets-python3.md`
`scripts/templates` | | [git-commit](../skills/git-commit/SKILL.md)
`gh skills install github/awesome-copilot git-commit` | Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping | None | | [git-flow-branch-creator](../skills/git-flow-branch-creator/SKILL.md)
`gh skills install github/awesome-copilot git-flow-branch-creator` | Intelligent Git Flow branch creator that analyzes git status/diff and creates appropriate branches following the nvie Git Flow branching model. | None | diff --git a/plugins/skill-image-gen/.github/plugin/plugin.json b/plugins/skill-image-gen/.github/plugin/plugin.json new file mode 100644 index 00000000..7e1e2a1e --- /dev/null +++ b/plugins/skill-image-gen/.github/plugin/plugin.json @@ -0,0 +1,25 @@ +{ + "name": "skill-image-gen", + "description": "Generate images using AI directly from your coding workflow. Supports OpenAI (gpt-image-2) and Google Gemini. BYO API key — the skill guides you through setup on first use.", + "version": "1.0.0", + "keywords": [ + "image-generation", + "openai", + "gemini", + "ai", + "art", + "sprites", + "textures", + "icons" + ], + "author": { + "name": "adamd9", + "url": "https://github.com/adamd9" + }, + "homepage": "https://github.com/adamd9/skill-image-gen", + "repository": "https://github.com/github/awesome-copilot", + "license": "MIT", + "skills": [ + "./skills/generate-image/" + ] +} diff --git a/plugins/skill-image-gen/README.md b/plugins/skill-image-gen/README.md new file mode 100644 index 00000000..2d4f0255 --- /dev/null +++ b/plugins/skill-image-gen/README.md @@ -0,0 +1,35 @@ +# Skill Image Gen + +Generate images using AI directly from your coding workflow. Supports **OpenAI (gpt-image-2)** and **Google Gemini (Nano Banana)**. + +## What it does + +Use natural language to generate images — icons, sprites, textures, mockups, artwork — without leaving your editor. The skill handles API calls, file saving, and guides you through setup on first use. + +## Providers + +| Provider | Model | Strengths | +|---|---|---| +| OpenAI | gpt-image-2 | High quality, excellent text rendering | +| Google Gemini | gemini-2.0-flash-exp | Fast, free tier available | + +## Setup + +BYO API key. On first use, the skill walks you through: + +1. Choosing a provider +2. Getting an API key ([OpenAI](https://platform.openai.com/api-keys) · [Gemini](https://aistudio.google.com/apikey)) +3. Setting the environment variable (`SKILL_IMAGE_GEN_OPENAI_KEY` or `SKILL_IMAGE_GEN_GEMINI_KEY`) + +## Usage + +Ask Copilot to generate an image: + +- "Generate a pixel art treasure chest" +- "Create a seamless grass texture for my game" +- "Make a minimalist logo for my app" + +## Links + +- **Source repo**: [adamd9/skill-image-gen](https://github.com/adamd9/skill-image-gen) +- **License**: MIT diff --git a/skills/generate-image/SKILL.md b/skills/generate-image/SKILL.md new file mode 100644 index 00000000..21cd4d72 --- /dev/null +++ b/skills/generate-image/SKILL.md @@ -0,0 +1,100 @@ +--- +name: generate-image +description: >- + Generate images using AI. Use when asked to generate, create, or make images, textures, + icons, sprites, artwork, visual assets, or mockups. Supports OpenAI (gpt-image-2) and + Google Gemini (Nano Banana). Requires an API key for the chosen provider. +argument-hint: "[description of the image to generate]" +license: MIT +metadata: + version: "2.1.0" + providers: "openai, gemini" +--- + +# Generate Image + +You are an image generation assistant. When invoked, follow the workflow below. + +## Workflow + +1. **Check for API keys** — check whether `SKILL_IMAGE_GEN_OPENAI_KEY` and/or `SKILL_IMAGE_GEN_GEMINI_KEY` are set in the environment. +2. **If one key is set** — use that provider. No need to ask. +3. **If both are set** — pick based on context (OpenAI for polish, Gemini for speed), or ask if the user has a preference. +4. **If no keys are set** — run the Onboarding section. +5. **Generate the image** using the appropriate API reference. +6. **Tell the user** where the image was saved. + +## Onboarding + +Only run this if no keys are set. Guide the user conversationally. + +1. Ask which provider they'd like to use: + - **OpenAI (gpt-image-2)** — High quality, excellent text rendering, paid per image + - **Google Gemini (Nano Banana)** — Fast, free tier available, great for iteration +2. Direct them to get an API key: + - OpenAI → https://platform.openai.com/api-keys + - Gemini → https://aistudio.google.com/apikey +3. Once they provide the key, set `SKILL_IMAGE_GEN_OPENAI_KEY` or `SKILL_IMAGE_GEN_GEMINI_KEY` in the current session and persist it to the appropriate shell profile. +4. Proceed to generate the image they originally asked for. + +## API Reference: OpenAI + +**Method:** `POST` +**URL:** `https://api.openai.com/v1/images/generations` + +**Headers:** +- `Authorization: Bearer ` +- `Content-Type: application/json` + +**Body (JSON):** +```json +{ + "model": "gpt-image-2", + "prompt": "", + "n": 1, + "size": "1024x1024", + "quality": "medium" +} +``` + +| Field | Default | Options | +|---|---|---| +| model | `gpt-image-2` | `gpt-image-2`, `gpt-image-1` | +| size | `1024x1024` | `1024x1024`, `1024x1536`, `1536x1024`, `auto` | +| quality | `medium` | `low`, `medium`, `high` | + +**Response:** `data[0].b64_json` contains the base64-encoded image. Decode it and save to the output path. If `data[0].url` is present instead, download the image from that URL. + +## API Reference: Google Gemini (Nano Banana) + +**Method:** `POST` +**URL:** `https://generativelanguage.googleapis.com/v1beta/models/:generateContent` + +**Headers:** +- `x-goog-api-key: ` +- `Content-Type: application/json` + +**Body (JSON):** +```json +{ + "contents": [{"parts": [{"text": "Generate an image: "}]}], + "generationConfig": {"responseModalities": ["TEXT", "IMAGE"]} +} +``` + +| Field | Default | Options | +|---|---|---| +| model (in URL) | `gemini-2.0-flash-exp` | `gemini-2.0-flash-exp`, `gemini-2.5-flash-image` | + +**Response:** Find `candidates[0].content.parts[]` — look for a part with `inlineData.data` (base64 image) and `inlineData.mimeType`. Decode and save. + +**Error cases:** `error` key (API error), `promptFeedback.blockReason` (safety block), `finishReason: "SAFETY"` (filtered). + +## Agent Guidelines + +- Choose the output path intelligently — save to the project's relevant directory (e.g., `assets/`, `images/`, or the current directory). +- For game textures, enrich prompts with "seamless", "tileable", "game asset". +- For batch generation, make multiple API calls in parallel. +- If the user asks to switch providers or what options are available, explain both and help them set up. +- Always create the output directory before saving. +- Ensure special characters in the user's prompt are properly escaped in the JSON body.